For all its benefits, occasionally Ubuntu can throw some errors when updating the system that can confuse and even worry a new user. I recall the first time I had “broken packages” with a lack of experience – I ended up nuking the OS and reinstalling, vowing never to use the command line again. The reality is far less dramatic, especially now that Ubuntu has matured from the days of 8.04 when I first installed it.
What follows are common error messages and how to fix them with minimal fuss.
Package Hash Mismatch
As common as this sounds, Ubuntu will unfortunately produce this error generically, meaning it gives little information about the problem, should there not be an Internet issue. In order to diagnose this, return to the Terminal and type:
sudo apt-get update
A long series of text will scroll across the screen, but within this will be the following line or similar:
W:Failed to fetch package:/var/lib/apt/lists/partial/in.archive.ubuntu.com_ubuntu_dists_oneiric_restricted_binary-i386_Packages Hash Sum mismatch W:Failed to fetch package:/var/lib/apt/lists/partial/in.archive.ubuntu.com_ubuntu_dists_oneiric_multiverse_binary-i386_Packages Hash Sum mismatch E:Some index files failed to download. They have been ignored, or old ones used instead
In order to fix this, you can enter this into the Terminal:
sudo rm -rf /var/lib/apt/lists/* sudo apt-get update
This will remove all the cached packages and force the system to re-download them again.
Failed to Download Repository Information
This error is more straightforward and usually due to a PPA that you have added which is no longer available or simply not responding.
If this a PPA issue, then simply identify which of the PPAs is failing and remove it from sources. Do this as above by entering:
sudo apt-get update
Failed to Download Package Information
This is another straightforward package error. Simply go to the sources and change the source to the Main Server.
Changing this means that future downloads might be slightly slower, due to the main server being busier than a local one, but it should be more stable and have a longer up-time than local servers which can be occasionally patchy.
Partial Upgrade Error
When running an update within the Terminal, users can be presented with the following error:
Not all updates can be installed Run a partial upgrade, to install as many updates as possible
Run this command to fix the problem:
sudo apt-get install -f
Could Not Get Lock /var/cache/apt/archives/lock
When another package is using apt, then this error will appear. To explain, perhaps you are installing a .deb package like Google Chrome and then decide to use the Terminal to install something else, like Chromium or Firefox, at the same time.
E: Could not get lock /var/cache/apt/archives/lock - open (11: Resource temporarily unavailable) E: Unable to lock directory /var/cache/apt/archives/
Usually you can wait for the .deb package to finish installing and simply close the Software Center or gdebi if you use this. However, if the problem continues, you can resolve it by entering the following within the Terminal:
sudo rm /var/lib/apt/lists/lock
If this should fail, you can kill the process via:
sudo killall apt-get
GPG Error: The Following Signatures Cannot Be Verified
This isn’t really an error as such, just a small matter of configuration. It used to happen a lot with Intel Graphics Drivers when adding the PPA. Trying to update via the Terminal will give:
W: GPG error: http://repo.mate-desktop.org saucy InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 68980A0EA10B4DE8
The solution is to get the public key in the system. Take the key from the message above and enter the following:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68980A0EA10B4DE8
Inevitably, this will change based on what you are trying to verify and trying to import, so use the above as a guide.
Hopefully, this will resolve a lot of errors that users experience and will help avoid dramatic re-installations. How do you solve errors within Ubuntu? Let us know in the comments section, especially if you have other methods.
Our latest tutorials delivered straight to your inbox