The wget
command in your question text is not matching the command in your screenshot. Here is the command in your screenshot:
sudo wget -O http://www.inetsim.org/inetsim.org-archive-signing-key.asc | apt-key add -
Here is the command in your example text; also check the command used in the official INetSim installation instructions:
sudo wget -O - http://www.inetsim.org/inetsim.org-archive-signing-key.asc | apt-key add -
Note the subtle difference? The one that is failing is missing the -
between sudo wget -O
and the URL that follows it. Try it with the -
and it should work fine.
Just so you understand what was—or wasn’t—happening, the -O
(--output-document
flag needed that -
to tell wget
to stream the contents of that URL to standard output. If you just ran the command like this:
wget http://www.inetsim.org/inetsim.org-archive-signing-key.asc
All wget
would do is save that file locally on your system to a file named inetsim.org-archive-signing-key.asc
. But setting -O -
and then having that pipe (|
) to | apt-key add -
the command is basically saying, stream the contents of that file to standard put, then pipe that output to apt-key add
so the key contents can be added to your apt
repository list.
Also, your screenshot shows the additional error:
ERROR: This command can only be used by root.
That is directly related to the lack of the dash in your command; it causes everything else to fail as well.
If the command’s pipe(s) are broken the whole command fails and it will never get to the point where you are prompted to enter the sudo
password. But the rest of the command is still being parsed anyway.
So even thought the full command fails it’s still trying to run apt-key
. And since the remaining part of the one-line command is basically detached from the rest of the previous sudo
invoked command—which never was ever invoked as sudo
due to the error—it attempts to run apt-key
as a normal user it then says:
ERROR: This command can only be used by root.
Because, yes… Attempting to run apt-key
as a normal/unprivileged user is indeed an error.
Thanks that seemed to solve it.
Also why is it giving me 'ERROR - This command can only be used by root' when I'm using sudo? Is that intentional? – Sad CRUD Developer – 2015-09-08T21:40:55.197
Also someone edited the post with the added dash. Weird – Sad CRUD Developer – 2015-09-08T21:41:43.393
@BDillan I edited the question to better focus it and format it but I never added the
– JakeGould – 2015-09-08T21:43:35.737-
into the text. Look at your original post; it’s clearly there from the beginning. Also, 100% no idea what that “ERROR - This command can only be used by root” message is about. Seems like a setup issue idiosyncratic to your setup. I can’t reproduce that.Alright, I apologize – Sad CRUD Developer – 2015-09-08T21:49:24.493
1@BDillan Okay, I managed to reproduce the “ERROR: This command can only be used by root.” If the command pipes are broken the whole command fails and you don’t get to the point where you enter the sudo password. So when it fails it tries to run
apt-key add
it’s basically detached from the rest of thesudo
command, attempts to run as a normal user and then says… “ERROR: This command can only be used by root.” So no problem on your system past these errors you are having with this one command. – JakeGould – 2015-09-08T22:47:59.633