Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rvm install: ruby installation error

I want to install ruby on my Linux Mint 12.

I am following this tutorial and this one.

when I run rvm install 1.9.3 I see this error:

Installing Ruby from source to: /usr/share/ruby-rvm/rubies/ruby-1.9.3, this may take a while depending on your cpu(s)...

ruby-1.9.3 - #fetching 
ruby-1.9.3 - #extracting ruby-1.9.3- to /usr/share/ruby-rvm/src/ruby-1.9.3
ERROR: Error running 'bunzip2 < '/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2' | tar xf - -C /usr/share/ruby-rvm/tmp/rvm_src_4428', please read /usr/share/ruby-rvm/log/ruby-1.9.3/extract.log
ERROR: There has been an error while trying to extract the source.  
Halting the installation.
ERROR: There has been an error fetching the ruby interpreter. Halting the installation.

How to fix it?

EDIT: @ka8725

bunzip2 is installed. When i run cat /usr/share/ruby-rvm/log/ruby-1.9.3/extract.log

I see

[2012-02-25 01:11:55] bunzip2 < '/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2' | tar xf - -C /usr/share/ruby-rvm/tmp/rvm_src_32604
bunzip2: (stdin) is not a bzip2 file.
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
[2012-02-25 01:12:16] bunzip2 < '/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2' | tar xf - -C /usr/share/ruby-rvm/tmp/rvm_src_32740
bunzip2: (stdin) is not a bzip2 file.
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
[2012-02-25 01:13:50] bunzip2 < '/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2' | tar xf - -C /usr/share/ruby-rvm/tmp/rvm_src_383
bunzip2: (stdin) is not a bzip2 file.
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
[2012-02-25 01:13:52] bunzip2 < '/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2' | tar xf - -C /usr/share/ruby-rvm/tmp/rvm_src_474
bunzip2: (stdin) is not a bzip2 file.
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
[2012-02-25 01:13:58] bunzip2 < '/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2' | tar xf - -C /usr/share/ruby-rvm/tmp/rvm_src_568
bunzip2: (stdin) is not a bzip2 file.
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
[2012-02-25 01:18:57] bunzip2 < '/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2' | tar xf - -C /usr/share/ruby-rvm/tmp/rvm_src_4428
bunzip2: (stdin) is not a bzip2 file.
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors

ANOTHER EDIT @EVERYONE :)

here whats happening guys:

rvm requirements outputs unrecognized error etc. However rvm notes will show me the needed stuff that i should install. BUT when i install these things, rvm will be removed and so i have to reinstall lol!! :) once, twice, ten times, forever:) this what would happen

these are the packages that i need

 sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
like image 470
Lynob Avatar asked Feb 24 '12 23:02

Lynob


People also ask

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.


3 Answers

If you cat /usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2 you will see

<html> <head><title>404 Not Found</title></head> <body bgcolor="white"> <center><h1>404 Not Found</h1></center> <hr><center>nginx/1.2.1</center> </body>

So, rvm doesn't know where to find ruby-1.9.3 (it seems the path is mangled around '3-.tar')

And, 1.9.1 "compatibility" with 1.9.3 is a (not so funny) joke in Ubuntu.

The fix for me was:

rvm package install openssl

rvm install ruby-1.9.2 --with-openssl-dir=/usr/share/ruby-rvm/usr

As 1.9.2 happened matched all of my gem dependencies (e.g. nokogiri)

like image 142
Andrew Avatar answered Nov 16 '22 00:11

Andrew


For Ubuntu 18.10, I had the same error after installing via APT. rvm install 2.5.1 failed with the same error as referenced. After completing the instructions for Ubuntu on github and restarting my VPS, ruby v 2.6.3 installed using the command 'rvm install ruby' As I was on a vps, I had to run source /etc/profile.d/rvm.sh first.

Github RVM Repo for Ubuntu

like image 31
uberdave Avatar answered Nov 16 '22 00:11

uberdave


Doing an rvm update as suggested in one of the comments gave me some good errors on how to fix the problem. I purged apt-get ruby-rvm as suggested in the errors and installed with curl. Worked like a charm. Looking at the file name the apt-get version of rvm is grabbing it looks like the last part of the version is missing for some reason. Instead of ruby-1.9.3-.tar.bz2 it should be ruby-1.9.3-p327.tar.bz2 or something to that effect.

Here is what I did and what was suggested by the errors after rvm update:

  sudo apt-get --purge remove ruby-rvm
  sudo rm -rf /usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/rvm.sh

  open new terminal and validate environment is clean from old rvm settings:

  env | GREP_OPTIONS= \grep rvm

install RVM:

  curl -L https://get.rvm.io | bash -s stable

fix some more screwed up stuff from apt-get ruby-gem

   make ~/.bash_profile look like this(it loads rvm as a function in bash):

      [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

update RVM:

  rvm update
  rvm reload

install ruby

  rvm install 1.9.3
  rvm use 1.9.3 --default

install current rubygems

  rvm rubygems current

install rails

  gem install rails

Done!

like image 40
user1881102 Avatar answered Nov 15 '22 23:11

user1881102