For one of my project, I need to install an older version of Ubuntu (11.10 oneiric release). But apt-get failed (install) or apt-get update was no longer working and failed with an error message “Failed to fetch” and “404 not found”. Below are the errors:
$ sudo apt-get update W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/oneiric-security/main/source/Sources 404 Not Found [IP: 91.189.88.162 80] W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/oneiric-security/universe/source/Sources 404 Not Found [IP: 91.189.88.162 80]
And the errors from apt-get upgrade resulted in “403 forbidden”.
Well, the errors were expected, because Ubuntu 11.10 is an unsupported release due to which apt-get is not able to find the packages under security.ubuntu.com and archive.ubuntu.com. So I had to find an alternative solution (I mean, I had to find an URL that contains packages for unsupported releases) and fortunately Ubuntu has made it available in an alternative URL.
apt-get failed – How to make it work on an unsupported Ubuntu OS?
Ubuntu has a repository for older versions and it’s available in old-releases.ubuntu.com. So we’ll quickly make apt-get to look for the packages under old releases repository. To do that, edit /etc/apt/sources.list.
# vim /etc/apt/sources.list
Look for the URLs security.ubuntu.com and archive.ubuntu.com and replace both with old-releases.ubuntu.com. The new sources.list should look like the one shown below:
deb http://old-releases.ubuntu.com/ubuntu/ oneiric main deb-src http://old-releases.ubuntu.com/ubuntu/ oneiric main deb http://old-releases.ubuntu.com/ubuntu/ oneiric-updates main deb-src http://old-releases.ubuntu.com/ubuntu/ oneiric-updates main deb http://old-releases.ubuntu.com/ubuntu/ oneiric universe deb-src http://old-releases.ubuntu.com/ubuntu/ oneiric universe deb http://old-releases.ubuntu.com/ubuntu/ oneiric-updates universe deb-src http://old-releases.ubuntu.com/ubuntu/ oneiric-updates universe deb http://old-releases.ubuntu.com/ubuntu oneiric-security main deb-src http://old-releases.ubuntu.com/ubuntu oneiric-security main deb http://old-releases.ubuntu.com/ubuntu oneiric-security universe deb-src http://old-releases.ubuntu.com/ubuntu oneiric-security universe
That’s it!
Now you should be able to perform apt-get update or apt-get upgrade.
$ sudo apt-get update
$ sudo apt-get upgrade
Note: If you are still getting 403 or 404 errors, then make sure the URLs are entered corrected in sources.list file and try again.