rvm install: ruby installation error

26,345

Solution 1

Uninstall and reinstall rvm with

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

For posterity, I'll add that the part of the error that says

Installing Ruby from source to: /usr/share/...

is what got me thinking about a broken installation of rvm which, as I said, is normally entirely contained in the ~/.rvm directory.

Solution 2

I solved my problem simply doing:

rvm get head rvm reload and rvm install 1.9.3

Solution 3

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!

Solution 4

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)

Solution 5

Issue solved, here's how in case you want to know:

As s.m. said, I uninstalled everything, then I opened another terminal session as a normal user and run:

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

then i run source /home/my-desktop-username/.rvm/scripts/rvm as a normal user NOT ROOT

then i run rvm requirements as a normal user. Then I copy the requirements and close the session, open a root session and install the requirements using sudo

Then I close the session and open a normal user session and run rvm install ruby-1.9.3-p125 if you run this command as root, it will say that rvm is not installed and will suggest that you install it using sudo apt-get install rvm Don't do that!

So basically I had two problems, the tutorials that i followed didn't say that i should run

source /home/my-desktop-username/.rvm/scripts/rvm and didn't say that I should not run rvm as root, s.m told me that. Thanks to everyone, especially to s.m

Don't trust bloggers, Youtube users or forums. ONLY TRUST STACKOVERFLOW USERS!

Share:
26,345
Lynob
Author by

Lynob

Updated on May 13, 2020

Comments

  • Lynob
    Lynob almost 4 years

    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
    
  • mpapis
    mpapis about 12 years
    /usr/share/ruby-rvm - this is nonstandard installation path for RVM, it is created by Ubuntu, and what's in this path is broken, not only the problems you have - but many more, that's why I recommend cleaning it out and starting fresh
  • Lynob
    Lynob about 12 years
    i followed your answer so i should have cleared my environment and still had to use usr/share/ruby-rvm so if i have other problems as you say, then my issue is not really solved lol!!!