Occasionally, you might try to run the Software Updater program on an Ubuntu machine, only to find that you get a “Failed to download repository information” message. It might remind you to check your Internet connection. If you were instead attempting to use the terminal to update Ubuntu, then you might have received some other sort of software updater error from the apt-get package management utility. This problem is found on all Ubuntu derivatives as well, including Lubuntu, Xubuntu and Kubuntu as well as Ubuntu Mate. Users of Ubuntu Server editions that don’t include a graphical user interface or an X Server will still see the same warnings in the virtual console.
While it might be considered a tad embarrassing, the first step is always to check your Internet connection. If you can’t access the repositories, then you might not be able to access anything online. Open Mozilla Firefox, or w3m if you’re unable or unwilling to access an X Server, and then try visiting any page that you don’t have cached. Make sure your Ethernet cable or WiFi connection is working, and if you have physical access to the modem then also check the indicators on it. It’s very easy to overlook something, and taking these steps now can save a little time later. Once you’ve done so, try running sudo apt-get update again from the terminal before proceeding.
Method 1: Checking Your Connection with the ping Command
If you still didn’t get an affirmative response, then you’ll want to use the ping commands to check if you can access the repositories at all. You should also do so if the sudo apt-get update command gave you a line that reads something like “The repository ‘http://archive.canonical.com/ubuntu releaseName’ does not have a Release file.” The term releaseName would get replaced with the release you’re currently running from. If you try to run the graphical updater, then you might get an error or even a message that the software on your machine is up to date when you know this isn’t actually correct.
At the terminal, type ping -c4 archive.canonical.com and push return. If you’re getting a positive response, then try ping6 -c4 archive.canonical.com and see if you get the same. If you’re not getting one, then there’s a chance that the official Ubuntu software repositories are down for whatever reason. This can happen, though it’s actually quite rare. On the other hand, more than likely it means that your IP or IPv6 addresses aren’t getting passed through correctly. Check your Internet connection again to make sure it’s stable, and then take a look at the file to see if your hostname is correctly set. You can look at this file as a normal user, but you’ll need root permissions to actually edit it.
You’ll need to make sure that the first line reads 127.0.0.1 localhost and then the second reads 127.0.1.1 followed by your hostname. Edit the file if there’s any mistaken setting. You might want to try rebooting if you’ve not already done so. Try loading the apt-get repository data once again as soon as you complete the reboot. Should you have any need to edit this file, you can do so using nano, vi or any other terminal editor. You could also theoretically use a graphical one, but make sure to preface gedit or mousepad with gksu before you launch it rather than using sudo. You may also prefer to use gksudo instead of gksu depending on how you run things.
Method 2: Removing Faulty PPA Entries
If your connection has no further issues and the Canonical servers that feed Ubuntu updates are completely accessible, you should look at any repositories that are giving you issues. Let’s assume you were working with the ffmulticonverter PPA, which doesn’t have a repository for Xenial. Users of Ubuntu Xenial, or any of the other official spins that use it as a basis, will get an error if they have this PPA installed. Use sudo ppa-purge ppa:ffmulticonverter to remove it and then run sudo apt-get update to update the repositories again. Once the update completes, which it should now be able to do successfully without errors, you can use sudo apt-get upgrade to update the packages on your system properly.
You may want to check the PPA that caused you problems through a Web browser. Note that most of these show a folder listing that may or may not be directly mapped to physical directories somewhere. What the repository’s custodians map the folders to is unimportant, despite what some users might say. What’s important is whether one of them reads the name of the release you’re working with. Notice in the example that the folder listing for ppa:ffmulticonverter doesn’t actually show Xenial, which was the cause of the problem here. Repositories not geared to work with the way that Ubuntu sets releases might also cause a similar problem, since the software might make mistakes regarding the naming of certain packages.
Once you’ve isolated the issue, you can actually elect to eliminate the program if you so choose. If you no longer need it, then you can use sudo apt-get purge ffmulticonverter, replacing that name with whatever package you want gone. You may then wish to run sudo apt-get autoremove and sudo apt-get autoclean to clean up the mess that might have been left behind. Running bleachbit can also fix this problem, providing that you have it installed and all of the settings ticked correctly.
Should you find yourself often dealing with cases where you have packages that are sorely out of date and link to older repositories, you might want to search through the official Ubuntu ones for replacements. These are updated automatically with your operating system, so you won’t have to worry about this problem nearly as much, at least in theory. You may also consider using Web apps instead of installed applications if possible, since these don’t require updates whatsoever as long as they remain online.