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

3

I’m trying to install INetSim on Ubunutu 14.04 desktop. I edited the sources list with the pre compiled Debian Packages. Then when trying to install the signature key using wget I run across this issue here when I run the command:

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

I get a broken pipe issue above.

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

apt-key add

enter image description here

Sad CRUD Developer

Posted 2015-09-08T22:05:11.767

Reputation: 201

Try "sudo -i" instead of just "sudo". – ss4566654768 – 2015-09-08T22:10:42.453

@RACING121 Doesn't change anything – Sad CRUD Developer – 2015-09-08T22:12:19.413

1Try with sudo apt-key add - – nKn – 2015-09-08T22:17:51.857

See my answer below. This is similar to the situation you had in this question/answer thread here; you are missing the - right after apt-key add.

– JakeGould – 2015-09-08T22:44:47.833

Answers

5

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.

JakeGould

Posted 2015-09-08T22:05:11.767

Reputation: 38 217

4

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 -

Moe Far

Posted 2015-09-08T22:05:11.767

Reputation: 151

3

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.

Matti

Posted 2015-09-08T22:05:11.767

Reputation: 31