Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

like image 912
TamerB Avatar asked Jun 14 '17 22:06

TamerB


People also ask

What does RVM stand for Ruby?

RVM stands for Ruby Version Manager. It is a command line tool which allows you to easily install, manage and work with different Ruby environments. With RVM, you can easily install different versions of Ruby and easily switch between them.

Can we install RVM in Windows?

RVM supports most UNIX like systems and Windows (with Cygwin or Bash on Ubuntu on Windows). The basic requirements are bash , curl , gpg2 and overall GNU version of tools - but RVM tries to autodetect it and install anything that is needed.


2 Answers

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

like image 77
TamerB Avatar answered Sep 21 '22 19:09

TamerB


I am just posting an update solution for it as I faced the same issue in Ubuntu 18.04 while trying to fetch keys for RVM.

The following method is provided by RVM.

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

If it doesn't work out and you try to install rvm directly, the process will fail and provides three suggestions to receive keys. One of which have a step to receive the keys with gpg2.

Install gpg2 in your system before that.

sudo apt install gnupg2

The command is

gpg2 --recv-keys 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

But this command too will not work. So here's an alternative. Just replace the gpg from the older command to gpg2 which worked for me.

gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
like image 35
Vigneshwaran Sivalingam Avatar answered Sep 20 '22 19:09

Vigneshwaran Sivalingam