Lets see what files are missing from packages that are partially installed. Note this will not work on packages that are not at least part way installed (they need to be listed in dpkg -l output). This is building off the article here: http://www.infotinks.com/debian-see-all-files-from-packages-with-word-in-them/

Sometimes you get a package thats halfway installed, or is missing some files. It has a weird status when you run dpkg -l (here is a diagnosis: https://linuxprograms.wordpress.com/2010/05/11/status-dpkg-list/). Here is an exerpt (in green & italics).

First character: The possible value for the first character. The first character signifies the desired state, like we (or some user) is marking the package for installation

  1. u: Unknown (an unknown state)
  2. i: Install (marked for installation)
  3. r: Remove (marked for removal)
  4. p: Purge (marked for purging)
  5. h: Hold

Second Character: The second character signifies the current state, whether it is installed or not. The possible values are

  1. n: Not- The package is not installed
  2. i: Inst – The package is successfully installed
  3. c: Cfg-files – Configuration files are present
  4. u: Unpacked- The package is stilled unpacked
  5. f: Failed-cfg- Failed to remove configuration files
  6. h: Half-inst- The package is only partially installed
  7. W: trig-aWait
  8. t: Trig-pend

Let’s move to the third character
Third Character: This corresponds to the error state. The possible value include

  1. R: Reinst-required The package must be installed.

So lets say the package less (that program that reads files page by page) is not listed as “ii” (installed well). Here is how we find out whats missing. Just change PKG to less or whatever package your curious about (note it will look for all packages that have the word “less” in them. So it will analyze packages that are named “lessloss” which could be something completely unrelated – therefore just ignore the output of lessloss – the output is has seperators to see which package is being analyzed).

Example output for package less (I purposely deleted the symlink /usr/bin/lesspipe and deleted the file /usr/share/man/man1/lesspipe.1.gz.  mv /usr/share/man/man1/lesspipe.1.gz /tmp/lesspipe.1.gz; rm -f /usr/bin/lesspipe; ), lets see how it looks:

How to read output:

  • Each section seperated by “—- package —-” are the files and folders for that file (as received from dpkg -L, capital L)
  • Notice that files that exist have the full “ls -lisah” type of listing.
  • Folders that exist say “FOLDER EXISTS“.
  • Weird files that are not folder and not regular files will list as EXISTS NOT-FILE NOT-FOLDER.
  • When something (file, empty file, folder, symlink, hardlink, etc…) doesnt exist it will list as DOESNT EXIST

NOTE: that PKG=”less” selected the package “less”, and “libflac8” and “libwavpack1.” Its because libflac8 and libwavpack1 list less in their description column in the dpkg -l output. I made the package selection very ambiguous. If you want it less ambigous and only select packages that have less in the name of the package, use this

Now the output is only:

Lets look at the package “less” (Everything below “—- less —-” ). Notice the lines that start with DOESNT EXIST (we could grep for “DOESNT”)

We see that these files (they could be anything, symlinks, folder, regular file, socket file, whatever) dont exist. To find out what they are its best to go online and probably best to delete (remove and purge, and possibly repeat to fully remove )and install the package again – or just reinstall the package.

SIDENOTE: in my case I just recreated the symlink and put the lesspipe.1.gz file back to where it should be  ln -s /bin/lesspipe /usr/bin/lesspipe; mv /tmp/lesspipe.1.gz /usr/share/man/man1/lesspipe.1.gz; And now the complete “less” package has this output, notice everything EXISTS.

The end.


Leave a Reply

Your email address will not be published.