Friday, August 21, 2015

requirements_debian_update_system ruby-2.2.2 error

Today I got new laptop with Ubuntu 15.04 and I was trying to install ruby on rails with rvm.
I have successfully installed rvm and I can see that rvm is installed properly.
But when I have tried to install ruby within rvm using command 'rvm install 2.2.2' then I got below error.

Error:
sachinlenovo@sachinlenovo-g-5070:~$ rvm install 2.2.2
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/15.04/x86_64/ruby-2.2.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system...................
Error running 'requirements_debian_update_system ruby-2.2.2',
showing last 15 lines of /home/sachinlenovo/.rvm/log/1440068704_ruby-2.2.2/update_system.log
++ case "${TERM:-dumb}" in
++ case "$1" in
++ [[ -t 2 ]]
++ return 1
++ printf %b 'There has been error while updating '\''apt-get'\'', please give it some time and try again later.
404 errors should be fixed for rvm to proceed. Check your sources configured in:
   /etc/apt/sources.list
   /etc/apt/sources.list.d/*.list
\n'
There has been error while updating 'apt-get', please give it some time and try again later.
404 errors should be fixed for rvm to proceed. Check your sources configured in:
   /etc/apt/sources.list
   /etc/apt/sources.list.d/*.list

++ return 100
Requirements installation failed with status: 100.

Then I found solution like this:

RVM will refuse to work, if apt-get update has any errors and it doesn't behave well. If your system's apt sources have an invalid repository than apt-get update gives you 404 or GPG error. This confused me for some time because this invalid or faulty repository has no connection with Ruby as well RVM. and after referring some documentation and solutions I came to know below scenario:

So for check the errors you have to run this command and need to find that which ppa is firing errors:
sudo apt-get update | grep "Failed"
then it will give you result like this:

W: Failed to fetch http://ppa.launchpad.net/chris-lea/node.js/ubuntu vivid main  404  Not Found                                                                                      W: .......                                                         
E: Some index files failed to download. They have been ignored, or old ones used instead.

Then for resolve this error you have to press Windows key and need to search "Software & Updates" 

Then open it and go into Other Software there you can see some URLs which is failed while update.

Then uncheck that urls from this and close this window then you can do 
sudo apt-get update 
and then you can install ruby with
rvm install 2.2.2