Ruby RVM apt-get update error
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
.
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
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