rvm / ubuntu_rvm

Ubuntu package for RVM
https://launchpad.net/~rael-gc/+archive/ubuntu/rvm
Apache License 2.0
694 stars 84 forks source link

Ubuntu 22 - Error installing Ruby 2.6.9 #67

Closed MarcusPetri closed 2 years ago

MarcusPetri commented 2 years ago

Description

Problem installing Ruby 2.6.9 with RVM on freshly released Ubuntu 22.04 final version (downloaded and installed 4/22).

Steps to reproduce

  1. Just try to install Ruby 2.6.9 with RVM package as described in the README.

Expected behavior

Ruby 2.6.9 installed

Actual behavior

Just like Readme:

sudo apt-get install software-properties-common

sudo apt-add-repository -y ppa:rael-gc/rvm
sudo apt-get update
sudo apt-get install rvm

sudo usermod -a -G rvm $USER

echo 'source "/etc/profile.d/rvm.sh"' >> ~/.bashrc

rvm user gemsets

rvm install ruby-2.6.9

Screenshot from 2022-04-22 17-46-21

Environment info

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04 LTS"
$ rvm install ruby-2.6.9
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/22.04/x86_64/ruby-2.6.9.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for ubuntu.
Requirements installation successful.
Installing Ruby from source to: /usr/share/rvm/rubies/ruby-2.6.9, this may take a while depending on your cpu(s)...
ruby-2.6.9 - #downloading ruby-2.6.9, this may take a while depending on your connection...
ruby-2.6.9 - #extracting ruby-2.6.9 to /usr/share/rvm/src/ruby-2.6.9.....
ruby-2.6.9 - #configuring.......................................................................
ruby-2.6.9 - #post-configuration..
ruby-2.6.9 - #compiling..............................................................................|
Error running '__rvm_make -j8',
please read /home/mpetri/.rvm/log/1650658988_ruby-2.6.9/make.log
There has been an error while running make. Halting the installation.

make-log.txt

fsdevblog commented 2 years ago

the same error with 3.x versions.. As I understood, the problem that RVM cant work with the openssl v3. So I installed the v1 version of openssl and compiled ruby with the old version

installing the openssl v1

$ cd /usr/local/src/
$ sudo wget https://www.openssl.org/source/openssl-1.1.1s.tar.gz
$ sudo tar -xf openssl-1.1.1s.tar.gz
$ cd openssl-1.1.1s
$ sudo ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib
$ sudo make
$ sudo make install
$ sudo rmdir certs
$ sudo ln -sf /etc/ssl/certs/ certs

installing ruby

$ rvm install 3.1.2 --with-openssl-dir=/usr/local/ssl

I hope it will help

raelgc commented 2 years ago

As this repository is dedicated to the Ubuntu installer, and this is a rvm issue, I'll close it. In the case you need more help, please, open it (or check if there is any related issue) in the rvm repository.

MarcusPetri commented 2 years ago

@fsdevblog Thanks for raising this and to find a solution!

Optionally, you could install the openssl v1 provided with the PPA: sudo apt install openssl1.0

I tried before opening the issue

the same error with 3.x versions.. As I understood, the problem that RVM cant work with the openssl v3. So I installed the v1 version of openssl and compiled ruby with the old version

installing the openssl v1

$ cd /usr/local/src/
$ sudo wget https://www.openssl.org/source/openssl-1.1.1c.tar.gz
$ sudo tar -xf openssl-1.1.1c.tar.gz
$ cd openssl-1.1.1c
$ sudo ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib
$ sudo make
$ sudo make install

installing ruby

$ rvm install 3.1.2 --with-openssl-dir=/usr/local/ssl

I hope it will help

Thanks! Ruby installed! Now I have problem with bundle install:

$ bundle -v
Bundler version 1.17.3

$ bundle install
Fetching source index from https://gems.contribsys.com/

Retrying fetcher due to error (2/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://gems.contribsys.com/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see http://bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Retrying fetcher due to error (3/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://gems.contribsys.com/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see http://bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Retrying fetcher due to error (4/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate for https://gems.contribsys.com/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see http://bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
Could not verify the SSL certificate for https://gems.contribsys.com/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see
http://bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.

@raelgc , can you reopen the issue?

MikkelRBech commented 2 years ago

The openssl you've compiled does not have access to the CA certificates. Symlink the certs/ dir to /etc/ssl/certs then it will work.

diogeneshas commented 2 years ago

@fsdevblog Thanks for raising this and to find a solution!

Optionally, you could install the openssl v1 provided with the PPA: sudo apt install openssl1.0

E: Unable to locate package openssl1.0 E: Couldn't find any package by glob 'openssl1.0'

raelgc commented 2 years ago

@diogeneshas The package is available only if you added the PPA, but it'll not help on this case, as the required version is 1.1

raelgc commented 2 years ago

Issue on parent repo: https://github.com/rvm/rvm/issues/5209

raelgc commented 2 years ago

@fsdevblog I just updated your solution to use openssl1.1 version n (instead of version c) and added steps to link to /etc/ssl/certs.

raelgc commented 2 years ago

Ok, finally I've backported openssl1.1 to 22.04 for those using the PPA.

You want, after sudo apt update, downgrade packages with:

sudo apt install libssl-dev=1.1.1l-1ubuntu1.4  openssl=1.1.1l-1ubuntu1.4
kidlab commented 2 years ago

@raelgc Thanks for the tip, it worked well for me :+1:

DGaffney commented 1 year ago

Great work here - thank you!

ghost commented 1 year ago

Ok, finally I've backported openssl1.1 to 22.04 for those using the PPA.

You want, after sudo apt update, downgrade packages with:

sudo apt install libssl-dev=1.1.1l-1ubuntu1.4  openssl=1.1.1l-1ubuntu1.4

Is there any way to block libssl-dev and openssl from updating? Because they are always updated and it is necessary to keep downgrading again!

raelgc commented 1 year ago

@mpetri-wert, 3 possible solutions:

Hold upgrade using apt

Warning: This can lead to some problems during upgrade. Run at your own risk!

Hold a package: sudo apt-mark hold <package-name> Remove the hold: sudo apt-mark unhold <package-name> Show all packages on hold: sudo apt-mark showhold

Use local SSL source

Use the above solution in comment https://github.com/rvm/ubuntu_rvm/issues/67#issuecomment-1107065230 (I keep updating it to point to the latest SSL 1.1.1 build)

Upgrade to Ruby 3.1.3

Few days ago I've built and uploaded a binary for Ruby 3.1.3, which appears to works fine in Ubuntu 22.04. Try the default install command: rvm install 3.1.3.

hurricup commented 1 year ago

a little correction to the script above. it should be:

$ sudo rmdir /usr/local/ssl/certs
$ sudo ln -sf /etc/ssl/certs/ /usr/local/ssl/certs
duaneking commented 1 year ago

with all the respect possible this defect was not fixed before it was closed as I'm still not able to install Ruby 2.6.2 on Ubuntu 22.04.2 LTS

Edit: https://github.com/rvm/rvm/issues/5209