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:
A long series of text will scroll across the screen, but within this will be the following line or similar:
In order to fix this, you can enter this into the Terminal:
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:
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:
Run this command to fix the problem:
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.
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:
If this should fail, you can kill the process via:
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:
The solution is to get the public key in the system. Take the key from the message above and enter the following:
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.