11

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 ?

2 Answers 2

15

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}'
2
  • I 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 ?
    – shirish
    Nov 18, 2016 at 7:56
  • I 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). Nov 18, 2016 at 10:11
9

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.