Monday, April 22, 2013

Ubuntu apt-get update Err 404 Not Found [IP: w.x.y.z]

Ubuntu as any other OS should be upgraded when the time comes. Keeping an unsupported version of the OS is a no-no. Yet for whatever reason it looks on the technology side we need to deal with upgrades in servers that have not been patched. When you say that the solution is an upgrade and that it will take longer the statement, believe me, will be not appreciated.

In those case you better try to correct the issue even if providing a non-secure solution and later state what should be done ASAP to avoid possible exploits to compromise your outdated servers.

Commonly the first problem arises when you try to install a package in an old distro:
$ sudo apt-get  install nfs-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package nfs-common is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'nfs-common' has no installation candidate
To illustrate a possible "fix" with an example let us say you get the below error when trying to update an old maverick distro:
Err maverick-updates/main portmap amd64 6.0.0-2ubuntu1.1 404 Not Found [IP: 80]
Maverick is not longer a supported release so it won't be found in the original servers. You need to look for them in the old-releases server so most likely the below will work:
sudo sed -i 's/' /etc/apt/sources.list
Most likely you will get then some key related issues like:
W: GPG error: maverick-security Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
Which you can solve with:
$ sudo apt-key adv --keyserver --recv-keys 40976EAF437D05B5
Now you should be able to install that package which was missing in your old distribution. However let me state this once again, you should never rely on this procedure. You should always upgrade your distribution. To safely upgrade the distribution I believe automated server management in terms of recipes is the way to go.

No comments: