rvm install: ruby installation error
Asked Answered
M

9

10

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
Melodymeloid answered 24/2, 2012 at 23:26 Comment(11)
Are we talking about a fresh rvm installation?Penultimate
@Penultimate yes, i didn't have rvm beforeMelodymeloid
Are you trying to install as root, by any chance? Also, try running rvm requirements to make sure you have all the dependencies in place.Penultimate
@Penultimate i tried root and i tried not to use root, same error sirMelodymeloid
Good, 'cause you aren't supposed to use rvm as root anyway. I edited my comment, BTW.Penultimate
bunzip2 < '/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2' | tar xf - -C /usr/share/ruby-rvm/tmp/rvm_src_474 what is result?Calvillo
What I don't understand is that /usr/share. rvm should be confined to ~/.rvm. You must be doing something wrong. Uninstall and reinstall rvm with bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)Penultimate
@Calvillo the output is bash: /usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2: No such file or directory tar: This does not look like a tar archive tar: Exiting with failure status due to previous errorsMelodymeloid
Does tar exist in your system? And, yes, it seems you have installed rvm incorrectly. You should reinstall it according documentationCalvillo
@Calvillo issue solved, and tar is installed anyway lol :)Melodymeloid
Glad you could solve :) I'll post an answer just in case.Penultimate
P
14

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.

Penultimate answered 25/2, 2012 at 12:58 Comment(0)
M
11

I solved my problem simply doing:

rvm get head rvm reload and rvm install 1.9.3

Mesenchyme answered 1/8, 2012 at 13:54 Comment(0)
C
6

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!

Cabby answered 6/12, 2012 at 3:37 Comment(0)
M
2

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!

Melodymeloid answered 25/2, 2012 at 11:22 Comment(0)
E
2

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)

Epidemiology answered 3/4, 2014 at 19:48 Comment(0)
D
1

have you tried this answer Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v ?

it seams you use "apt-get broken rvm" make sure you follow the above answer.

Deccan answered 24/2, 2012 at 23:47 Comment(2)
/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 freshDeccan
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!!!Melodymeloid
G
1

I had the same problem with bunzip2.

A tail on ~/.rvm/log/ruby-1.9.3-p125/extract.log said:

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

It turns out that the downloaded file was the HTML homepage of rvm website instead of the archive itself.

So if like me all previous solutions didn't worked out. Check file type of your archive:

$ file ruby-1.9.3-p125.tar.bz2
ruby-1.9.3-p125.tar.bz2: HTML document, UTF-8 Unicode text, with very long lines

If you get something like this, just remove the archive and try to install it again.

Groveman answered 28/4, 2012 at 14:0 Comment(0)
D
1

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

Dorice answered 12/5, 2019 at 18:1 Comment(0)
C
0

cat /usr/share/ruby-rvm/log/ruby-1.9.3/extract.log

It seems to me you don't have installed bunzip2. You should install it

Calvillo answered 24/2, 2012 at 23:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.