14

When I try to google how to do this, all the results I get are "How to fix broken packages".

Could you give me a hint how to only list them in the console one by one?

muru
  • 197,895
  • 55
  • 485
  • 740
  • I am not sure how to find broken packages, but if you suspect about one and don't remember the specific name, try dpkg --list to see all the stuff you have installed. Be careful! Do not delete random stuff that you don't know what it is. – Nandete82 Feb 07 '23 at 21:14

4 Answers4

17

It seems that nobody has recommended this:

sudo apt-get check

also for more info try

apt-get --help
Zanna
  • 70,465
JesseB
  • 171
15

You can list broken packages :

dpkg -l | grep ^..r 

r state (on the third field) means: reinst-required (package broken, reinstallation required)

dpkg fields explanation

EdiD
  • 4,457
  • 3
  • 26
  • 41
6

To get the list of partially installed packages (with architecture information) preceded by their states, one by line, run

dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' | grep -E ^.[^nci]

See man dpkg-query for information about the states etc. (I suppose the Reinst-required i.e. R flag can not appear with states n, c or i. If it could, the extended regular expression in grep command should be modified.)

jarno
  • 5,600
1

I did a dist-upgrade which completed, but had puked some errors during the process. So I wanted to validate the errors weren't merely just noise.

apt-get check -v returned NO faults.

HOWEVER: Suspicious the previous command didn't provide correct feedback, I next executed:

dpkg -C

This command DID validate the errors

Given the above experience, I'd suggest not to take the output of apt-get check -v as the gospel everything is clean...

F1Linux
  • 1,066