Can't install Ruby rvm on Ubuntu 16.04 due to gpg bug

TamerB picture TamerB · Jun 15, 2017 · Viewed 12.4k times · Source

I'm trying to install Ruby on Ubuntu 16.04. However when I enter to following command to 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 requesting https://rvm.io/mpapis.asc through the browser. Then running the following:

$ gpg --import mpapis.asc

but I got the following:

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 do something that I don't understand, so I stopped their and didn't try sudo.

So how can I install Ruby?

Update

I also tried installing gpg2 using:

$ sudo apt-get install gnupg2 -y

and then I tried

$ gpg2 --keyserver hkp://keys.gnupg.net --recv-keys <key>

and also

$ curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -

But still, the same result when I try install rvm with the first command.

n.b. I noticed that I have gpg v1.4.20 and gpg2 v2.1.11

Answer

TamerB picture TamerB · Jun 15, 2017

After trying many ways. I did succeed to install rails as follows:

$ \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