Can't install Ruby rvm on Ubuntu 16.04 due to a bug in gpg
I am trying to install Ruby on Ubuntu 16.04. However, when I enter the following command into the terminal:
$ \curl -sSL https://get.rvm.io | bash -s stable --ruby
I get the following:
Downloading https://github.com/rvm/rvm/archive/1.29.1.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.1/1.29.1.tar.gz.asc
gpg: Signature made 19 ΩΨ¨Ψ±, 2017 EET 10:02:47 Ω
using RSA key ID ********
gpg: Can't check signature: No public key
Warning, RVM 1.26.0 introduces signed releases and automated check of signatures when GPG software found. Assuming you trust Michal Papis import the mpapis public key (downloading the signatures).
GPG signature verification failed for '/home/tamer/.rvm/archives/rvm-1.29.1.tgz' - 'https://github.com/rvm/rvm/releases/download/1.29.1/1.29.1.tar.gz.asc'! Try to install GPG v2 and then fetch the public key:
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys ****************************************
or if it fails:
command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
the key can be compared with:
https://rvm.io/mpapis.asc
https://keybase.io/mpapis
NOTE: GPG version 2.1.17 have a bug which cause failures during fetching keys from remote server. Please downgrade or upgrade to newer version (if available) or use the second method described above.
When I tried any rvm command, I got "command not found".
I tried to request https://rvm.io/mpapis.asc through the browser. Then the following is done:
$ gpg --import mpapis.asc
but i got this:
gpg: fatal: can't open '/home/tamer/.gnupg/trustdb.gpg': Permission denied
secmem usage: 1408/1408 bytes in 2/2 blocks of pool 1408/65536
I'm not used to doing what I don't understand, so I stopped them and didn't try sudo.
So how can I install Ruby?
Refresh
I also tried to install gpg2 using:
$ sudo apt-get install gnupg2 -y
and then i tried
$ gpg2 --keyserver hkp://keys.gnupg.net --recv-keys <key>
and
$ curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
But still, the same result when I try to install rvm with the first command.
nb I noticed that I have gpg v1.4.20 and gpg2 v2.1.11
source to share
After several ways. I was able to install rails like this:
$ \curl -sSL https://get.rvm.io | bash
$ source /home/<user>/.rvm/scripts/rvm
$ rvm -v
$ rvm install ruby
$ ruby -v
$ sudo apt-get install rubygems
$ gem update
$ sudo apt-get install ruby-dev zlib1g-dev liblzma-dev build-essential patch
$ rvm gemset list
$ gem install rails
$ rails -v
Where "user" is my username
source to share
I am just posting a solution to update it as I ran into the same issue on Ubuntu 18.04 while trying to get keys for RVM.
The following method is provided by RVM.
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
If that doesn't work and you try to install rvm directly, the process will fail and provide three suggestions for getting keys. One of which is a step to get keys with gpg2.
Install gpg2 on your system before that.
sudo apt install gnupg2
Command
gpg2 --recv-keys 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
But this command won't work either. So there is an alternative. Just replace the gpg from the old command with gpg2 which worked for me.
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
source to share
I had the same problem, but on Debian I used an alternative approach. The error message says "Try to install GPG v2 and then get the public key:" using the command gpg2
after it. First I went and installed gpg2 and ran the command it told me and it worked for me.
sudo apt-get install gnupg2
sudo apt-get install dirmngr
gpg2 --recv-keys <key>
# <Run curl command to install rvm>
source to share
In addition to the previous answers, if you are behind a firewall, the following command may not work.
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
In this case, you can use the following command to get the keys -
sudo apt-key adv --keyserver hkp://keys.gnupg.net:80 --recv-keys <<key>> <<key>>
source to share
Thanks JSnow The answer works for me (Ubuntu 16.04). You just need to do the same as the sudoer
keys specified in the error message.
source to share