DISCOVER
X

Fixing Errors While Upgrading Raspberry Pi

September 7, 2013 1:37 pm Leave your thoughts
FacebooktwitterredditpinterestlinkedinmailFacebooktwitterredditpinterestlinkedinmail

I have been idle from writing for a while (as you might have noticed) this is due to my work projects, ventures and travels. As a result of that, my Raspberry Pi has been left un-updated for a while. Now that I have some more time to play with it, I decided to turn in back on and do the usual apt-get update and then apt-get upgrade.

Normally, upgrading would work just absolutely fine, however in my case, it wasn’t. The otherwise smooth upgrade was stoppped by this very error:

Because this was something related to bootloader I make sure that I did not restart my Raspberry Pi, just in case I cannot boot anymore.

Aside from the error above, there were other archive related errors too in the upgrade run, which was quite alarming in some respect. Thankfully with a bit of research as well as trial-and-error I was able to resolve the upgrade issue.

The Fixes

These are the steps that I have taken in order to continue my upgrade properly.

Clean the Apt Archive

Most of the dpkg errors were due to broken archive files, therefore forcing apt to clean its cache and download new archives is the first thing you should do.

After the autoclean finished running, do an upgrade again with the -f flag to fix the dependencies before upgrading.

This step fixed almost all of my apt errors during my upgrade. If you still have an error after this, do the next step

Remove Archives Manually

The next step to fix broken packages is to remove the archive files manually. Broken packages can happen due to bad connection during the initial download so the logical step is to force it to re-download. Note that autoclean does not remove the packages that is still in use, in my case the bootloader might still be marked as in use.

Here’s a good explanation of the difference between autoclean, clean and autoremove if you are interested. http://askubuntu.com/questions/3167/what-is-difference-between-the-options-autoclean-autoremove-and-clean

Identify the broken package by looking at the dpkg errors. If you are not in a windows manager and wishes to scroll up and down your fullscreen terminal, you can use shift + pageUp and shift + pageDown.

errorupgrade

The broken package that I had was:

When you have identified the broken package, remove it manually from the cache directory.

Of course you would change the filename from the example above to suit your error.

Then lastly, re-install the application that had the broken package.

When done, you can easily run sudo apt-get update again. If you encounter more broken packages issue, repeat the manual removal of the broken archives.

Conclusion

Upgrading large amount of packages on the Raspberry Pi can result in few broken packages, this can be caused by internet connection quality, sdcard write and various other reasons. The point is that when errors like this happen you should be comfortable to run autoclean and do the manual package removal.

I hope this article has helped you in some ways. If you have any other tips regarding upgrade issues, please leave your ideas in the comments for others to benefit too. Thanks for reading.

FacebooktwitterredditpinterestlinkedinmailFacebooktwitterredditpinterestlinkedinmail
Tags: ,

Categorised in: