Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby RVM apt-get update error

Tags:

ruby

rvm

I get following error when trying to install anything with RVM:

Searching for binary rubies, this might take some time.
Found remote file https://rvm.io/binaries/ubuntu/13.04/x86_64/ruby-2.1.1.tar.bz2
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system..kshitiz password required for 'apt-get --quiet --yes update': 
............................
Error running 'requirements_debian_update_system ruby-2.1.1',
showing last 15 lines of /home/kshitiz/.rvm/log/1400047196_ruby-2.1.1/update_system.log
++ /scripts/functions/logging : rvm_pretty_print()  78 > case "${TERM:-dumb}" in
++ /scripts/functions/logging : rvm_pretty_print()  81 > case "$1" in
++ /scripts/functions/logging : rvm_pretty_print()  83 > [[ -t 2 ]]
++ /scripts/functions/logging : rvm_pretty_print()  83 > return 1
++ /scripts/functions/logging : rvm_error()  117 > printf %b 'There has been error while updating '\''apt-get'\'', please give it some time and try again later.
For 404 errors 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.
For 404 errors check your sources configured in:
    /etc/apt/sources.list
    /etc/apt/sources.list.d/*.list

++ /scripts/functions/requirements/ubuntu : requirements_debian_update_system()  53 > return 100
Requirements installation failed with status: 100.

How can I fix this?

like image 998
Kshitiz Sharma Avatar asked May 14 '14 09:05

Kshitiz Sharma


3 Answers

RVM doesn't behave well if apt-get update has errors. If your apt sources have an invalid repository that gives 404 or GPG error, RVM will refuse to work. This can be confusing because it happens even if the faulty repository has nothing to do with ruby or RVM.

The following fix worked for me (Ubuntu):

Run apt-get update and see if there are any errors. Edit your sources.list and precise.list in /etc/apt to remove the faulty repositories. Repeat until apt-get update succeeds without any errors. Then try running RVM.

like image 134
Kshitiz Sharma Avatar answered Oct 23 '22 19:10

Kshitiz Sharma


You can try to skip the rvm updating system so apt-get won't be called.

# Disable RVM from trying to install necessary software via apt-get
rvm autolibs disable

# Then try installing Ruby:
rvm install 2.4.0

See https://stackoverflow.com/a/16759839/1212791

like image 42
Tim Yao Avatar answered Oct 23 '22 18:10

Tim Yao


I also had to remove failing repositories but I had hard time spotting them and removing them based on instructions here. So I found this link which explains exactly why this happens and how to remove failing repositories:

In short, run following to find failing repositories:

sudo apt-get update | grep "Failed"

An example output can be like this:

:~# apt-get update  | grep "Failed"
W: Failed to fetch http://ppa.launchpad.net/upubuntu-com/web/ubuntu/dists/trusty/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://ppa.launchpad.net/upubuntu-com/web/ubuntu/dists/trusty/main/binary-i386/Packages  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead.

And finally use this command to remove the failing repo(s):

sudo add-apt-repository --remove ppa:{failing ppa}

for the example here it will look like this:

sudo add-apt-repository --remove ppa:upubuntu-com/web
like image 39
MajiK Avatar answered Oct 23 '22 19:10

MajiK