Cannot write to `-' (Broken pipe) when trying to install a repository signature key

What would be the reason for this? Do I have to add something after:

apt-key add

Yes. Exactly. Look at the official INetSim installation instructions and look at your command in the text example here:

sudo wget -O - 'http://www.inetsim.org/inetsim.org-archive-signing-key.asc' | apt-key add -

Note the - at the end right after apt-key add. Now look at your screenshot and the command you are using; text version below:

sudo wget -O - 'http://www.inetsim.org/inetsim.org-archive-signing-key.asc' | apt-key add

You are not including that - after apt-key add. So the output from sudo wget -O - which should be piped to apt-key add -. So yes, you definitely have a broken pipe happening—or not happening—right there.


You can easily add sudo before apt-key, just like this:

sudo wget -O - 'http://www.inetsim.org/inetsim.org-archive-signing-key.asc' | sudo apt-key add -

I had the same problem with a docker image I was creating. I was using a slim base image which has only a minimal set of packages installed.

To investigate the issue I retrieved the key-file first. After this I tried the import command which failed. But this time I got a decent error message, which stated that I need to install gnupg, gnupg2 and gnupg1 packages. After I installed these packages import is working succesfully.

So I'd suggest that anyone facing this issue would first retrieve the key

wget http://[server]/file.key

and then do the import with

apt-key add file.key

If this still fails atleast you'll see the cause for failure.

Tags:

Ubuntu

Wget