How to find out half-configured/broken packages in Debian?
13,934
Solution 1
Quick to type:
dpkg -l | grep -v '^ii'
This lists any package that's at least a little known to the system but not perfectly installed.
If you want parseable output, use dpkg-query
with a custom format. Adjust the filter according to your wishes.
dpkg-query -f '${status} ${package}\n' -W | awk '$3 != "installed" {print $4}'
dpkg-query -f '${status} ${package}\n' -W | awk '$3 == "half-configured" {print $4}'
Solution 2
dpkg --audit
-C, --audit [package-name...]
Performs database sanity and consistency checks for package-name
or all packages if omitted (per package checks since dpkg 1.17.10).
For example, searches for packages that have been installed only
partially on your system or that have missing, wrong or obsolete
control data or files. dpkg will suggest what to do with them to
get them fixed.
source:man dpkg
Related videos on Youtube
Author by
shirish
A GNU/Linux and Debian user. Debian user for more than 5 years and yet still feel like a kid who has just started using the system yesterday.
Updated on September 18, 2022Comments
-
shirish over 1 year
Is there a way to find half-configured packages in Debian ? This is coming from Debian strech - update broken - seems buggy dpkg .
I try to see if packages are broken by two ways -
a. $ aptb ┌─[shirish@debian] - [~] - [5289] └─[$] alias aptb aptb='aptitude search '\''~b'\'
The more better one -
┌─[shirish@debian] - [~] - [5288] └─[$] dpkg --audit ┌─[shirish@debian] - [~] - [5289] └─[$]
Are there any other tools which do the desired/above thing ?
Update - I get this -
[$] dpkg -f '${status} ${package}\n' -W | awk '$2 == "half-configured" {print $4}' dpkg-deb: error: failed to read archive '${status} ${package}\n': No such file or directory [$] dpkg -f '${status} ${package}\n' -W | awk '$2 == "half-configured" {print $4}' dpkg-deb: error: failed to read archive '${status} ${package}\n': No such file or directory
Are these the expected outputs ?
-
shirish over 7 yearsI have updated my question with query, could you please verify that the output should be the one that came ? Also are there any other states which are/might be problematic for the system ?
-
Gilles 'SO- stop being evil' over 7 yearsI corrected my answer, I meant
dpkg-query
in the second set of examples, and also I'd picked the wrong field in awk. You can find the list of states in the dpkg documentation; there are a few more that indicate that things are half-way through (through unpacking, through configuration, and with pending triggers).