Investigating dpkg Errors (Enabling Detailed Logging)
Eiko WagenknechtWhen the dpkg package manager on Linux encounters problems, the error messages can often be cryptic. In this article, I’ll show you how to enable detailed logging to analyze errors more precisely - especially for SD card issues on Raspberry Pi.
Table of Contents
Materials Used
- Raspberry Pi (e.g., the Raspberry Pi 4 with 4GB RAM as a complete kit, approx. €95).
- A microSD card suitable for Raspberry Pi, preferably with 16GB or more storage. In 2020 alone, I lost 5 inexpensive cards due to read/write errors and now only use the Samsung PRO Endurance 64GB (approx. €14).
The Problem
With the error message above, I could hardly find useful information even with Google’s help. None of the suggested solutions worked. In a rather obscure post, I came across a command that increases dpkg’s logging level so that it outputs every single command in detail. The command is:
sudo dpkg --debug=77777 --configure -a
The important part is the string of sevens. This is actually documented in the dpkg help:

In practice, you need to combine these options bitwise… and the result is 77777 if you want everything logged to see exactly where it stops. Elsewhere, this is simply called “verbose” 😉
With this command, I could see that writing to the filesystem was taking too long, which led me to discover the defective SD card.
In the end, this didn’t save me from having to replace the card, but at least I learned something new. After replacing the card, the command also corrected the remaining errors (even without the --debug=77777
).
In another Raspberry Pi, the issue turned out to be inadequate power supply. The following command lists how often the Raspberry Pi experienced undervoltage. Anything other than zero here is a significant problem!
sudo grep -a Under-voltage /var/log/syslog | wc -l
Conclusion
I’d love to hear your comments on whether this post was helpful to you. Feel free to write if you have questions or if something remained unclear. Or if you were able to implement exciting automation projects building on this information 🙂
No Comments? No Problem.
This blog doesn't support comments, but your thoughts and questions are always welcome. Reach out through the contact details in the footer below.
Support Me
If you found this page helpful and want to say thanks, I would be very grateful if you could use this link for your next purchase on amazon.com. I get a small commission, and it costs you nothing extra. If you'd like to support me in another way, you can find more options here.