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
- u: Unknown (an unknown state)
- i: Install (marked for installation)
- r: Remove (marked for removal)
- p: Purge (marked for purging)
- h: Hold
Second Character: The second character signifies the current state, whether it is installed or not. The possible values are
- n: Not- The package is not installed
- i: Inst – The package is successfully installed
- c: Cfg-files – Configuration files are present
- u: Unpacked- The package is stilled unpacked
- f: Failed-cfg- Failed to remove configuration files
- h: Half-inst- The package is only partially installed
- W: trig-aWait
- t: Trig-pend
Let’s move to the third character
Third Character: This corresponds to the error state. The possible value include
- 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).
# (PKG="less"; dpkg -l | grep $PKG | awk '{print $2}' | xargs -I %% /bin/bash -c 'echo "---- %% ----"; dpkg -L "%%" | xargs -I @@ /bin/bash -c "[[ -f '@@' ]] && ls -lisah '@@' || ( [[ -d '@@' ]] && echo FOLDER EXISTS @@ || ( [[ -e '@@' ]] && echo EXISTS NOT-FILE NOT-FOLDER @@ || echo DOESNT EXIST @@))"' | nl > /tmp/${PKG}.pktxt; cat /tmp/${PKG}.pktxt; )
# (PKG="less"; dpkg -l | grep $PKG | awk '{print $2}' | xargs -I %% /bin/bash -c 'echo "---- %% ----"; dpkg -L "%%" | xargs -I @@ /bin/bash -c "[[ -f '@@' ]] && ls -lisah '@@' || ( [[ -d '@@' ]] && echo FOLDER EXISTS @@ || ( [[ -e '@@' ]] && echo EXISTS NOT-FILE NOT-FOLDER @@ || echo DOESNT EXIST @@))"' | nl > /tmp/${PKG}.pktxt; cat /tmp/${PKG}.pktxt; )
# (PKG="less"; dpkg -l | grep $PKG | awk '{print $2}' | xargs -I %% /bin/bash -c 'echo "---- %% ----"; dpkg -L "%%" | xargs -I @@ /bin/bash -c "[[ -f '@@' ]] && ls -lisah '@@' || ( [[ -d '@@' ]] && echo FOLDER EXISTS @@ || ( [[ -e '@@' ]] && echo EXISTS NOT-FILE NOT-FOLDER @@ || echo DOESNT EXIST @@))"' | nl > /tmp/${PKG}.pktxt; cat /tmp/${PKG}.pktxt; )
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:
4 50989794 152K -rwxr-xr-x 1 root root 150K Jun 10 2012 /bin/less
5 50989796 16K -rwxr-xr-x 1 root root 16K Jun 10 2012 /bin/lesskey
6 50989795 12K -rwxr-xr-x 1 root root 11K Jun 10 2012 /bin/lessecho
7 50989797 8.0K -rwxr-xr-x 1 root root 7.6K Jun 10 2012 /bin/lesspipe
10 FOLDER EXISTS /usr/share
11 FOLDER EXISTS /usr/share/doc
12 FOLDER EXISTS /usr/share/doc/less
13 4332989 4.0K -rw-r--r-- 1 root root 2.0K Jan 22 2008 /usr/share/doc/less/copyright
14 4332987 12K -rw-r--r-- 1 root root 9.6K Jun 10 2012 /usr/share/doc/less/changelog.Debian.gz
15 4332985 4.0K -rw-r--r-- 1 root root 2.1K Oct 22 2007 /usr/share/doc/less/LESSOPEN
16 4332988 12K -rw-r--r-- 1 root root 8.5K Jun 9 2011 /usr/share/doc/less/changelog.gz
17 4332986 4.0K -rw-r--r-- 1 root root 401 Jul 3 2009 /usr/share/doc/less/README.Debian
18 FOLDER EXISTS /usr/share/man
19 FOLDER EXISTS /usr/share/man/man1
20 4594974 4.0K -rw-r--r-- 1 root root 3.6K Jun 10 2012 /usr/share/man/man1/lesskey.1.gz
21 4594973 4.0K -rw-r--r-- 1 root root 568 Jun 10 2012 /usr/share/man/man1/lessecho.1.gz
22 4594972 20K -rw-r--r-- 1 root root 20K Jun 10 2012 /usr/share/man/man1/less.1.gz
23 DOESNT EXIST /usr/share/man/man1/lesspipe.1.gz
24 FOLDER EXISTS /usr/lib
25 FOLDER EXISTS /usr/lib/mime
26 FOLDER EXISTS /usr/lib/mime/packages
27 4208356 4.0K -rw-r--r-- 1 root root 94 Oct 22 2007 /usr/lib/mime/packages/less
28 50989704 0 lrwxrwxrwx 1 root root 8 Jun 10 2012 /bin/lessfile -> lesspipe
29 4201355 0 lrwxrwxrwx 1 root root 9 Jun 10 2012 /usr/bin/less -> /bin/less
30 4201357 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessfile -> /bin/lesspipe
31 4201358 0 lrwxrwxrwx 1 root root 12 Jun 10 2012 /usr/bin/lesskey -> /bin/lesskey
32 4201356 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessecho -> /bin/lessecho
33 DOESNT EXIST /usr/bin/lesspipe
34 DOESNT EXIST /usr/share/man/man1/lessfile.1.gz
35 ---- libflac8:amd64 ----
38 FOLDER EXISTS /usr/lib
39 FOLDER EXISTS /usr/lib/x86_64-linux-gnu
40 4196262 316K -rw-r--r-- 1 root root 313K Nov 29 2014 /usr/lib/x86_64-linux-gnu/libFLAC.so.8.2.0
41 FOLDER EXISTS /usr/share
42 FOLDER EXISTS /usr/share/doc
43 FOLDER EXISTS /usr/share/doc/libflac8
44 4331450 12K -rw-r--r-- 1 root root 8.5K Nov 29 2014 /usr/share/doc/libflac8/changelog.Debian.gz
45 4331451 4.0K -rw-r--r-- 1 root root 3.0K Nov 29 2014 /usr/share/doc/libflac8/copyright
46 4196263 0 lrwxrwxrwx 1 root root 16 Nov 29 2014 /usr/lib/x86_64-linux-gnu/libFLAC.so.8 -> libFLAC.so.8.2.0
47 ---- libwavpack1:amd64 ----
50 FOLDER EXISTS /usr/share
51 FOLDER EXISTS /usr/share/doc
52 FOLDER EXISTS /usr/share/doc/libwavpack1
53 4460002 4.0K -rw-r--r-- 1 root root 2.2K Apr 1 2012 /usr/share/doc/libwavpack1/changelog.Debian.gz
54 4460004 4.0K -rw-r--r-- 1 root root 2.0K Dec 5 2011 /usr/share/doc/libwavpack1/copyright
55 4460003 8.0K -rw-r--r-- 1 root root 4.9K Nov 30 2009 /usr/share/doc/libwavpack1/changelog.gz
56 FOLDER EXISTS /usr/lib
57 FOLDER EXISTS /usr/lib/x86_64-linux-gnu
58 4212874 164K -rw-r--r-- 1 root root 163K Apr 1 2012 /usr/lib/x86_64-linux-gnu/libwavpack.so.1.1.4
59 4212443 0 lrwxrwxrwx 1 root root 19 Apr 1 2012 /usr/lib/x86_64-linux-gnu/libwavpack.so.1 -> libwavpack.so.1.1.4
1 ---- less ----
2 FOLDER EXISTS /.
3 FOLDER EXISTS /bin
4 50989794 152K -rwxr-xr-x 1 root root 150K Jun 10 2012 /bin/less
5 50989796 16K -rwxr-xr-x 1 root root 16K Jun 10 2012 /bin/lesskey
6 50989795 12K -rwxr-xr-x 1 root root 11K Jun 10 2012 /bin/lessecho
7 50989797 8.0K -rwxr-xr-x 1 root root 7.6K Jun 10 2012 /bin/lesspipe
8 FOLDER EXISTS /usr
9 FOLDER EXISTS /usr/bin
10 FOLDER EXISTS /usr/share
11 FOLDER EXISTS /usr/share/doc
12 FOLDER EXISTS /usr/share/doc/less
13 4332989 4.0K -rw-r--r-- 1 root root 2.0K Jan 22 2008 /usr/share/doc/less/copyright
14 4332987 12K -rw-r--r-- 1 root root 9.6K Jun 10 2012 /usr/share/doc/less/changelog.Debian.gz
15 4332985 4.0K -rw-r--r-- 1 root root 2.1K Oct 22 2007 /usr/share/doc/less/LESSOPEN
16 4332988 12K -rw-r--r-- 1 root root 8.5K Jun 9 2011 /usr/share/doc/less/changelog.gz
17 4332986 4.0K -rw-r--r-- 1 root root 401 Jul 3 2009 /usr/share/doc/less/README.Debian
18 FOLDER EXISTS /usr/share/man
19 FOLDER EXISTS /usr/share/man/man1
20 4594974 4.0K -rw-r--r-- 1 root root 3.6K Jun 10 2012 /usr/share/man/man1/lesskey.1.gz
21 4594973 4.0K -rw-r--r-- 1 root root 568 Jun 10 2012 /usr/share/man/man1/lessecho.1.gz
22 4594972 20K -rw-r--r-- 1 root root 20K Jun 10 2012 /usr/share/man/man1/less.1.gz
23 DOESNT EXIST /usr/share/man/man1/lesspipe.1.gz
24 FOLDER EXISTS /usr/lib
25 FOLDER EXISTS /usr/lib/mime
26 FOLDER EXISTS /usr/lib/mime/packages
27 4208356 4.0K -rw-r--r-- 1 root root 94 Oct 22 2007 /usr/lib/mime/packages/less
28 50989704 0 lrwxrwxrwx 1 root root 8 Jun 10 2012 /bin/lessfile -> lesspipe
29 4201355 0 lrwxrwxrwx 1 root root 9 Jun 10 2012 /usr/bin/less -> /bin/less
30 4201357 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessfile -> /bin/lesspipe
31 4201358 0 lrwxrwxrwx 1 root root 12 Jun 10 2012 /usr/bin/lesskey -> /bin/lesskey
32 4201356 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessecho -> /bin/lessecho
33 DOESNT EXIST /usr/bin/lesspipe
34 DOESNT EXIST /usr/share/man/man1/lessfile.1.gz
35 ---- libflac8:amd64 ----
36 FOLDER EXISTS /.
37 FOLDER EXISTS /usr
38 FOLDER EXISTS /usr/lib
39 FOLDER EXISTS /usr/lib/x86_64-linux-gnu
40 4196262 316K -rw-r--r-- 1 root root 313K Nov 29 2014 /usr/lib/x86_64-linux-gnu/libFLAC.so.8.2.0
41 FOLDER EXISTS /usr/share
42 FOLDER EXISTS /usr/share/doc
43 FOLDER EXISTS /usr/share/doc/libflac8
44 4331450 12K -rw-r--r-- 1 root root 8.5K Nov 29 2014 /usr/share/doc/libflac8/changelog.Debian.gz
45 4331451 4.0K -rw-r--r-- 1 root root 3.0K Nov 29 2014 /usr/share/doc/libflac8/copyright
46 4196263 0 lrwxrwxrwx 1 root root 16 Nov 29 2014 /usr/lib/x86_64-linux-gnu/libFLAC.so.8 -> libFLAC.so.8.2.0
47 ---- libwavpack1:amd64 ----
48 FOLDER EXISTS /.
49 FOLDER EXISTS /usr
50 FOLDER EXISTS /usr/share
51 FOLDER EXISTS /usr/share/doc
52 FOLDER EXISTS /usr/share/doc/libwavpack1
53 4460002 4.0K -rw-r--r-- 1 root root 2.2K Apr 1 2012 /usr/share/doc/libwavpack1/changelog.Debian.gz
54 4460004 4.0K -rw-r--r-- 1 root root 2.0K Dec 5 2011 /usr/share/doc/libwavpack1/copyright
55 4460003 8.0K -rw-r--r-- 1 root root 4.9K Nov 30 2009 /usr/share/doc/libwavpack1/changelog.gz
56 FOLDER EXISTS /usr/lib
57 FOLDER EXISTS /usr/lib/x86_64-linux-gnu
58 4212874 164K -rw-r--r-- 1 root root 163K Apr 1 2012 /usr/lib/x86_64-linux-gnu/libwavpack.so.1.1.4
59 4212443 0 lrwxrwxrwx 1 root root 19 Apr 1 2012 /usr/lib/x86_64-linux-gnu/libwavpack.so.1 -> libwavpack.so.1.1.4
1 ---- less ----
2 FOLDER EXISTS /.
3 FOLDER EXISTS /bin
4 50989794 152K -rwxr-xr-x 1 root root 150K Jun 10 2012 /bin/less
5 50989796 16K -rwxr-xr-x 1 root root 16K Jun 10 2012 /bin/lesskey
6 50989795 12K -rwxr-xr-x 1 root root 11K Jun 10 2012 /bin/lessecho
7 50989797 8.0K -rwxr-xr-x 1 root root 7.6K Jun 10 2012 /bin/lesspipe
8 FOLDER EXISTS /usr
9 FOLDER EXISTS /usr/bin
10 FOLDER EXISTS /usr/share
11 FOLDER EXISTS /usr/share/doc
12 FOLDER EXISTS /usr/share/doc/less
13 4332989 4.0K -rw-r--r-- 1 root root 2.0K Jan 22 2008 /usr/share/doc/less/copyright
14 4332987 12K -rw-r--r-- 1 root root 9.6K Jun 10 2012 /usr/share/doc/less/changelog.Debian.gz
15 4332985 4.0K -rw-r--r-- 1 root root 2.1K Oct 22 2007 /usr/share/doc/less/LESSOPEN
16 4332988 12K -rw-r--r-- 1 root root 8.5K Jun 9 2011 /usr/share/doc/less/changelog.gz
17 4332986 4.0K -rw-r--r-- 1 root root 401 Jul 3 2009 /usr/share/doc/less/README.Debian
18 FOLDER EXISTS /usr/share/man
19 FOLDER EXISTS /usr/share/man/man1
20 4594974 4.0K -rw-r--r-- 1 root root 3.6K Jun 10 2012 /usr/share/man/man1/lesskey.1.gz
21 4594973 4.0K -rw-r--r-- 1 root root 568 Jun 10 2012 /usr/share/man/man1/lessecho.1.gz
22 4594972 20K -rw-r--r-- 1 root root 20K Jun 10 2012 /usr/share/man/man1/less.1.gz
23 DOESNT EXIST /usr/share/man/man1/lesspipe.1.gz
24 FOLDER EXISTS /usr/lib
25 FOLDER EXISTS /usr/lib/mime
26 FOLDER EXISTS /usr/lib/mime/packages
27 4208356 4.0K -rw-r--r-- 1 root root 94 Oct 22 2007 /usr/lib/mime/packages/less
28 50989704 0 lrwxrwxrwx 1 root root 8 Jun 10 2012 /bin/lessfile -> lesspipe
29 4201355 0 lrwxrwxrwx 1 root root 9 Jun 10 2012 /usr/bin/less -> /bin/less
30 4201357 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessfile -> /bin/lesspipe
31 4201358 0 lrwxrwxrwx 1 root root 12 Jun 10 2012 /usr/bin/lesskey -> /bin/lesskey
32 4201356 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessecho -> /bin/lessecho
33 DOESNT EXIST /usr/bin/lesspipe
34 DOESNT EXIST /usr/share/man/man1/lessfile.1.gz
35 ---- libflac8:amd64 ----
36 FOLDER EXISTS /.
37 FOLDER EXISTS /usr
38 FOLDER EXISTS /usr/lib
39 FOLDER EXISTS /usr/lib/x86_64-linux-gnu
40 4196262 316K -rw-r--r-- 1 root root 313K Nov 29 2014 /usr/lib/x86_64-linux-gnu/libFLAC.so.8.2.0
41 FOLDER EXISTS /usr/share
42 FOLDER EXISTS /usr/share/doc
43 FOLDER EXISTS /usr/share/doc/libflac8
44 4331450 12K -rw-r--r-- 1 root root 8.5K Nov 29 2014 /usr/share/doc/libflac8/changelog.Debian.gz
45 4331451 4.0K -rw-r--r-- 1 root root 3.0K Nov 29 2014 /usr/share/doc/libflac8/copyright
46 4196263 0 lrwxrwxrwx 1 root root 16 Nov 29 2014 /usr/lib/x86_64-linux-gnu/libFLAC.so.8 -> libFLAC.so.8.2.0
47 ---- libwavpack1:amd64 ----
48 FOLDER EXISTS /.
49 FOLDER EXISTS /usr
50 FOLDER EXISTS /usr/share
51 FOLDER EXISTS /usr/share/doc
52 FOLDER EXISTS /usr/share/doc/libwavpack1
53 4460002 4.0K -rw-r--r-- 1 root root 2.2K Apr 1 2012 /usr/share/doc/libwavpack1/changelog.Debian.gz
54 4460004 4.0K -rw-r--r-- 1 root root 2.0K Dec 5 2011 /usr/share/doc/libwavpack1/copyright
55 4460003 8.0K -rw-r--r-- 1 root root 4.9K Nov 30 2009 /usr/share/doc/libwavpack1/changelog.gz
56 FOLDER EXISTS /usr/lib
57 FOLDER EXISTS /usr/lib/x86_64-linux-gnu
58 4212874 164K -rw-r--r-- 1 root root 163K Apr 1 2012 /usr/lib/x86_64-linux-gnu/libwavpack.so.1.1.4
59 4212443 0 lrwxrwxrwx 1 root root 19 Apr 1 2012 /usr/lib/x86_64-linux-gnu/libwavpack.so.1 -> libwavpack.so.1.1.4
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
# (PKG="less"; dpkg -l | awk '{print $2}' | grep $PKG | xargs -I %% /bin/bash -c 'echo "---- %% ----"; dpkg -L "%%" | xargs -I @@ /bin/bash -c "[[ -f '@@' ]] && ls -lisah '@@' || ( [[ -d '@@' ]] && echo FOLDER EXISTS @@ || ( [[ -e '@@' ]] && echo EXISTS NOT-FILE NOT-FOLDER @@ || echo DOESNT EXIST @@))"' | nl > /tmp/${PKG}.pktxt; cat /tmp/${PKG}.pktxt; )
# (PKG="less"; dpkg -l | awk '{print $2}' | grep $PKG | xargs -I %% /bin/bash -c 'echo "---- %% ----"; dpkg -L "%%" | xargs -I @@ /bin/bash -c "[[ -f '@@' ]] && ls -lisah '@@' || ( [[ -d '@@' ]] && echo FOLDER EXISTS @@ || ( [[ -e '@@' ]] && echo EXISTS NOT-FILE NOT-FOLDER @@ || echo DOESNT EXIST @@))"' | nl > /tmp/${PKG}.pktxt; cat /tmp/${PKG}.pktxt; )
# (PKG="less"; dpkg -l | awk '{print $2}' | grep $PKG | xargs -I %% /bin/bash -c 'echo "---- %% ----"; dpkg -L "%%" | xargs -I @@ /bin/bash -c "[[ -f '@@' ]] && ls -lisah '@@' || ( [[ -d '@@' ]] && echo FOLDER EXISTS @@ || ( [[ -e '@@' ]] && echo EXISTS NOT-FILE NOT-FOLDER @@ || echo DOESNT EXIST @@))"' | nl > /tmp/${PKG}.pktxt; cat /tmp/${PKG}.pktxt; )
Now the output is only:
4 50989794 152K -rwxr-xr-x 1 root root 150K Jun 10 2012 /bin/less
5 50989796 16K -rwxr-xr-x 1 root root 16K Jun 10 2012 /bin/lesskey
6 50989795 12K -rwxr-xr-x 1 root root 11K Jun 10 2012 /bin/lessecho
7 50989797 8.0K -rwxr-xr-x 1 root root 7.6K Jun 10 2012 /bin/lesspipe
10 FOLDER EXISTS /usr/share
11 FOLDER EXISTS /usr/share/doc
12 FOLDER EXISTS /usr/share/doc/less
13 4332989 4.0K -rw-r--r-- 1 root root 2.0K Jan 22 2008 /usr/share/doc/less/copyright
14 4332987 12K -rw-r--r-- 1 root root 9.6K Jun 10 2012 /usr/share/doc/less/changelog.Debian.gz
15 4332985 4.0K -rw-r--r-- 1 root root 2.1K Oct 22 2007 /usr/share/doc/less/LESSOPEN
16 4332988 12K -rw-r--r-- 1 root root 8.5K Jun 9 2011 /usr/share/doc/less/changelog.gz
17 4332986 4.0K -rw-r--r-- 1 root root 401 Jul 3 2009 /usr/share/doc/less/README.Debian
18 FOLDER EXISTS /usr/share/man
19 FOLDER EXISTS /usr/share/man/man1
20 4594974 4.0K -rw-r--r-- 1 root root 3.6K Jun 10 2012 /usr/share/man/man1/lesskey.1.gz
21 4594973 4.0K -rw-r--r-- 1 root root 568 Jun 10 2012 /usr/share/man/man1/lessecho.1.gz
22 4594972 20K -rw-r--r-- 1 root root 20K Jun 10 2012 /usr/share/man/man1/less.1.gz
23 DOESNT EXIST /usr/share/man/man1/lesspipe.1.gz
24 FOLDER EXISTS /usr/lib
25 FOLDER EXISTS /usr/lib/mime
26 FOLDER EXISTS /usr/lib/mime/packages
27 4208356 4.0K -rw-r--r-- 1 root root 94 Oct 22 2007 /usr/lib/mime/packages/less
28 50989704 0 lrwxrwxrwx 1 root root 8 Jun 10 2012 /bin/lessfile -> lesspipe
29 4201355 0 lrwxrwxrwx 1 root root 9 Jun 10 2012 /usr/bin/less -> /bin/less
30 4201357 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessfile -> /bin/lesspipe
31 4201358 0 lrwxrwxrwx 1 root root 12 Jun 10 2012 /usr/bin/lesskey -> /bin/lesskey
32 4201356 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessecho -> /bin/lessecho
33 DOESNT EXIST /usr/bin/lesspipe
34 DOESNT EXIST /usr/share/man/man1/lessfile.1.gz
1 ---- less ----
2 FOLDER EXISTS /.
3 FOLDER EXISTS /bin
4 50989794 152K -rwxr-xr-x 1 root root 150K Jun 10 2012 /bin/less
5 50989796 16K -rwxr-xr-x 1 root root 16K Jun 10 2012 /bin/lesskey
6 50989795 12K -rwxr-xr-x 1 root root 11K Jun 10 2012 /bin/lessecho
7 50989797 8.0K -rwxr-xr-x 1 root root 7.6K Jun 10 2012 /bin/lesspipe
8 FOLDER EXISTS /usr
9 FOLDER EXISTS /usr/bin
10 FOLDER EXISTS /usr/share
11 FOLDER EXISTS /usr/share/doc
12 FOLDER EXISTS /usr/share/doc/less
13 4332989 4.0K -rw-r--r-- 1 root root 2.0K Jan 22 2008 /usr/share/doc/less/copyright
14 4332987 12K -rw-r--r-- 1 root root 9.6K Jun 10 2012 /usr/share/doc/less/changelog.Debian.gz
15 4332985 4.0K -rw-r--r-- 1 root root 2.1K Oct 22 2007 /usr/share/doc/less/LESSOPEN
16 4332988 12K -rw-r--r-- 1 root root 8.5K Jun 9 2011 /usr/share/doc/less/changelog.gz
17 4332986 4.0K -rw-r--r-- 1 root root 401 Jul 3 2009 /usr/share/doc/less/README.Debian
18 FOLDER EXISTS /usr/share/man
19 FOLDER EXISTS /usr/share/man/man1
20 4594974 4.0K -rw-r--r-- 1 root root 3.6K Jun 10 2012 /usr/share/man/man1/lesskey.1.gz
21 4594973 4.0K -rw-r--r-- 1 root root 568 Jun 10 2012 /usr/share/man/man1/lessecho.1.gz
22 4594972 20K -rw-r--r-- 1 root root 20K Jun 10 2012 /usr/share/man/man1/less.1.gz
23 DOESNT EXIST /usr/share/man/man1/lesspipe.1.gz
24 FOLDER EXISTS /usr/lib
25 FOLDER EXISTS /usr/lib/mime
26 FOLDER EXISTS /usr/lib/mime/packages
27 4208356 4.0K -rw-r--r-- 1 root root 94 Oct 22 2007 /usr/lib/mime/packages/less
28 50989704 0 lrwxrwxrwx 1 root root 8 Jun 10 2012 /bin/lessfile -> lesspipe
29 4201355 0 lrwxrwxrwx 1 root root 9 Jun 10 2012 /usr/bin/less -> /bin/less
30 4201357 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessfile -> /bin/lesspipe
31 4201358 0 lrwxrwxrwx 1 root root 12 Jun 10 2012 /usr/bin/lesskey -> /bin/lesskey
32 4201356 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessecho -> /bin/lessecho
33 DOESNT EXIST /usr/bin/lesspipe
34 DOESNT EXIST /usr/share/man/man1/lessfile.1.gz
1 ---- less ----
2 FOLDER EXISTS /.
3 FOLDER EXISTS /bin
4 50989794 152K -rwxr-xr-x 1 root root 150K Jun 10 2012 /bin/less
5 50989796 16K -rwxr-xr-x 1 root root 16K Jun 10 2012 /bin/lesskey
6 50989795 12K -rwxr-xr-x 1 root root 11K Jun 10 2012 /bin/lessecho
7 50989797 8.0K -rwxr-xr-x 1 root root 7.6K Jun 10 2012 /bin/lesspipe
8 FOLDER EXISTS /usr
9 FOLDER EXISTS /usr/bin
10 FOLDER EXISTS /usr/share
11 FOLDER EXISTS /usr/share/doc
12 FOLDER EXISTS /usr/share/doc/less
13 4332989 4.0K -rw-r--r-- 1 root root 2.0K Jan 22 2008 /usr/share/doc/less/copyright
14 4332987 12K -rw-r--r-- 1 root root 9.6K Jun 10 2012 /usr/share/doc/less/changelog.Debian.gz
15 4332985 4.0K -rw-r--r-- 1 root root 2.1K Oct 22 2007 /usr/share/doc/less/LESSOPEN
16 4332988 12K -rw-r--r-- 1 root root 8.5K Jun 9 2011 /usr/share/doc/less/changelog.gz
17 4332986 4.0K -rw-r--r-- 1 root root 401 Jul 3 2009 /usr/share/doc/less/README.Debian
18 FOLDER EXISTS /usr/share/man
19 FOLDER EXISTS /usr/share/man/man1
20 4594974 4.0K -rw-r--r-- 1 root root 3.6K Jun 10 2012 /usr/share/man/man1/lesskey.1.gz
21 4594973 4.0K -rw-r--r-- 1 root root 568 Jun 10 2012 /usr/share/man/man1/lessecho.1.gz
22 4594972 20K -rw-r--r-- 1 root root 20K Jun 10 2012 /usr/share/man/man1/less.1.gz
23 DOESNT EXIST /usr/share/man/man1/lesspipe.1.gz
24 FOLDER EXISTS /usr/lib
25 FOLDER EXISTS /usr/lib/mime
26 FOLDER EXISTS /usr/lib/mime/packages
27 4208356 4.0K -rw-r--r-- 1 root root 94 Oct 22 2007 /usr/lib/mime/packages/less
28 50989704 0 lrwxrwxrwx 1 root root 8 Jun 10 2012 /bin/lessfile -> lesspipe
29 4201355 0 lrwxrwxrwx 1 root root 9 Jun 10 2012 /usr/bin/less -> /bin/less
30 4201357 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessfile -> /bin/lesspipe
31 4201358 0 lrwxrwxrwx 1 root root 12 Jun 10 2012 /usr/bin/lesskey -> /bin/lesskey
32 4201356 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessecho -> /bin/lessecho
33 DOESNT EXIST /usr/bin/lesspipe
34 DOESNT EXIST /usr/share/man/man1/lessfile.1.gz
Lets look at the package “less” (Everything below “—- less —-” ). Notice the lines that start with DOESNT EXIST (we could grep for “DOESNT”)
23 DOESNT EXIST /usr/share/man/man1/lesspipe.1.gz
33 DOESNT EXIST /usr/bin/lesspipe
34 DOESNT EXIST /usr/share/man/man1/lessfile.1.gz
23 DOESNT EXIST /usr/share/man/man1/lesspipe.1.gz
33 DOESNT EXIST /usr/bin/lesspipe
34 DOESNT EXIST /usr/share/man/man1/lessfile.1.gz
23 DOESNT EXIST /usr/share/man/man1/lesspipe.1.gz
33 DOESNT EXIST /usr/bin/lesspipe
34 DOESNT EXIST /usr/share/man/man1/lessfile.1.gz
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.
# (PKG="less"; dpkg -l | awk '{print $2}' | grep $PKG | xargs -I %% /bin/bash -c 'echo "---- %% ----"; dpkg -L "%%" | xargs -I @@ /bin/bash -c "[[ -f '@@' ]] && ls -lisah '@@' || ( [[ -d '@@' ]] && echo FOLDER EXISTS @@ || ( [[ -e '@@' ]] && echo EXISTS NOT-FILE NOT-FOLDER @@ || echo DOESNT EXIST @@))"' | nl > /tmp/${PKG}.pktxt; cat /tmp/${PKG}.pktxt; )
4 50989794 152K -rwxr-xr-x 1 root root 150K Jun 10 2012 /bin/less
5 50989796 16K -rwxr-xr-x 1 root root 16K Jun 10 2012 /bin/lesskey
6 50989795 12K -rwxr-xr-x 1 root root 11K Jun 10 2012 /bin/lessecho
7 50989797 8.0K -rwxr-xr-x 1 root root 7.6K Jun 10 2012 /bin/lesspipe
10 FOLDER EXISTS /usr/share
11 FOLDER EXISTS /usr/share/doc
12 FOLDER EXISTS /usr/share/doc/less
13 4332989 4.0K -rw-r--r-- 1 root root 2.0K Jan 22 2008 /usr/share/doc/less/copyright
14 4332987 12K -rw-r--r-- 1 root root 9.6K Jun 10 2012 /usr/share/doc/less/changelog.Debian.gz
15 4332985 4.0K -rw-r--r-- 1 root root 2.1K Oct 22 2007 /usr/share/doc/less/LESSOPEN
16 4332988 12K -rw-r--r-- 1 root root 8.5K Jun 9 2011 /usr/share/doc/less/changelog.gz
17 4332986 4.0K -rw-r--r-- 1 root root 401 Jul 3 2009 /usr/share/doc/less/README.Debian
18 FOLDER EXISTS /usr/share/man
19 FOLDER EXISTS /usr/share/man/man1
20 4594974 4.0K -rw-r--r-- 1 root root 3.6K Jun 10 2012 /usr/share/man/man1/lesskey.1.gz
21 4594973 4.0K -rw-r--r-- 1 root root 568 Jun 10 2012 /usr/share/man/man1/lessecho.1.gz
22 4594972 20K -rw-r--r-- 1 root root 20K Jun 10 2012 /usr/share/man/man1/less.1.gz
23 4594975 4.0K -rw-r--r-- 1 root root 2.2K Jun 10 2012 /usr/share/man/man1/lesspipe.1.gz
24 FOLDER EXISTS /usr/lib
25 FOLDER EXISTS /usr/lib/mime
26 FOLDER EXISTS /usr/lib/mime/packages
27 4208356 4.0K -rw-r--r-- 1 root root 94 Oct 22 2007 /usr/lib/mime/packages/less
28 50989704 0 lrwxrwxrwx 1 root root 8 Jun 10 2012 /bin/lessfile -> lesspipe
29 4201355 0 lrwxrwxrwx 1 root root 9 Jun 10 2012 /usr/bin/less -> /bin/less
30 4201357 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessfile -> /bin/lesspipe
31 4201358 0 lrwxrwxrwx 1 root root 12 Jun 10 2012 /usr/bin/lesskey -> /bin/lesskey
32 4201356 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessecho -> /bin/lessecho
33 4195315 0 lrwxrwxrwx 1 root root 13 Mar 1 17:09 /usr/bin/lesspipe -> /bin/lesspipe
34 4592163 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/share/man/man1/lessfile.1.gz -> lesspipe.1.gz
# (PKG="less"; dpkg -l | awk '{print $2}' | grep $PKG | xargs -I %% /bin/bash -c 'echo "---- %% ----"; dpkg -L "%%" | xargs -I @@ /bin/bash -c "[[ -f '@@' ]] && ls -lisah '@@' || ( [[ -d '@@' ]] && echo FOLDER EXISTS @@ || ( [[ -e '@@' ]] && echo EXISTS NOT-FILE NOT-FOLDER @@ || echo DOESNT EXIST @@))"' | nl > /tmp/${PKG}.pktxt; cat /tmp/${PKG}.pktxt; )
1 ---- less ----
2 FOLDER EXISTS /.
3 FOLDER EXISTS /bin
4 50989794 152K -rwxr-xr-x 1 root root 150K Jun 10 2012 /bin/less
5 50989796 16K -rwxr-xr-x 1 root root 16K Jun 10 2012 /bin/lesskey
6 50989795 12K -rwxr-xr-x 1 root root 11K Jun 10 2012 /bin/lessecho
7 50989797 8.0K -rwxr-xr-x 1 root root 7.6K Jun 10 2012 /bin/lesspipe
8 FOLDER EXISTS /usr
9 FOLDER EXISTS /usr/bin
10 FOLDER EXISTS /usr/share
11 FOLDER EXISTS /usr/share/doc
12 FOLDER EXISTS /usr/share/doc/less
13 4332989 4.0K -rw-r--r-- 1 root root 2.0K Jan 22 2008 /usr/share/doc/less/copyright
14 4332987 12K -rw-r--r-- 1 root root 9.6K Jun 10 2012 /usr/share/doc/less/changelog.Debian.gz
15 4332985 4.0K -rw-r--r-- 1 root root 2.1K Oct 22 2007 /usr/share/doc/less/LESSOPEN
16 4332988 12K -rw-r--r-- 1 root root 8.5K Jun 9 2011 /usr/share/doc/less/changelog.gz
17 4332986 4.0K -rw-r--r-- 1 root root 401 Jul 3 2009 /usr/share/doc/less/README.Debian
18 FOLDER EXISTS /usr/share/man
19 FOLDER EXISTS /usr/share/man/man1
20 4594974 4.0K -rw-r--r-- 1 root root 3.6K Jun 10 2012 /usr/share/man/man1/lesskey.1.gz
21 4594973 4.0K -rw-r--r-- 1 root root 568 Jun 10 2012 /usr/share/man/man1/lessecho.1.gz
22 4594972 20K -rw-r--r-- 1 root root 20K Jun 10 2012 /usr/share/man/man1/less.1.gz
23 4594975 4.0K -rw-r--r-- 1 root root 2.2K Jun 10 2012 /usr/share/man/man1/lesspipe.1.gz
24 FOLDER EXISTS /usr/lib
25 FOLDER EXISTS /usr/lib/mime
26 FOLDER EXISTS /usr/lib/mime/packages
27 4208356 4.0K -rw-r--r-- 1 root root 94 Oct 22 2007 /usr/lib/mime/packages/less
28 50989704 0 lrwxrwxrwx 1 root root 8 Jun 10 2012 /bin/lessfile -> lesspipe
29 4201355 0 lrwxrwxrwx 1 root root 9 Jun 10 2012 /usr/bin/less -> /bin/less
30 4201357 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessfile -> /bin/lesspipe
31 4201358 0 lrwxrwxrwx 1 root root 12 Jun 10 2012 /usr/bin/lesskey -> /bin/lesskey
32 4201356 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessecho -> /bin/lessecho
33 4195315 0 lrwxrwxrwx 1 root root 13 Mar 1 17:09 /usr/bin/lesspipe -> /bin/lesspipe
34 4592163 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/share/man/man1/lessfile.1.gz -> lesspipe.1.gz
# (PKG="less"; dpkg -l | awk '{print $2}' | grep $PKG | xargs -I %% /bin/bash -c 'echo "---- %% ----"; dpkg -L "%%" | xargs -I @@ /bin/bash -c "[[ -f '@@' ]] && ls -lisah '@@' || ( [[ -d '@@' ]] && echo FOLDER EXISTS @@ || ( [[ -e '@@' ]] && echo EXISTS NOT-FILE NOT-FOLDER @@ || echo DOESNT EXIST @@))"' | nl > /tmp/${PKG}.pktxt; cat /tmp/${PKG}.pktxt; )
1 ---- less ----
2 FOLDER EXISTS /.
3 FOLDER EXISTS /bin
4 50989794 152K -rwxr-xr-x 1 root root 150K Jun 10 2012 /bin/less
5 50989796 16K -rwxr-xr-x 1 root root 16K Jun 10 2012 /bin/lesskey
6 50989795 12K -rwxr-xr-x 1 root root 11K Jun 10 2012 /bin/lessecho
7 50989797 8.0K -rwxr-xr-x 1 root root 7.6K Jun 10 2012 /bin/lesspipe
8 FOLDER EXISTS /usr
9 FOLDER EXISTS /usr/bin
10 FOLDER EXISTS /usr/share
11 FOLDER EXISTS /usr/share/doc
12 FOLDER EXISTS /usr/share/doc/less
13 4332989 4.0K -rw-r--r-- 1 root root 2.0K Jan 22 2008 /usr/share/doc/less/copyright
14 4332987 12K -rw-r--r-- 1 root root 9.6K Jun 10 2012 /usr/share/doc/less/changelog.Debian.gz
15 4332985 4.0K -rw-r--r-- 1 root root 2.1K Oct 22 2007 /usr/share/doc/less/LESSOPEN
16 4332988 12K -rw-r--r-- 1 root root 8.5K Jun 9 2011 /usr/share/doc/less/changelog.gz
17 4332986 4.0K -rw-r--r-- 1 root root 401 Jul 3 2009 /usr/share/doc/less/README.Debian
18 FOLDER EXISTS /usr/share/man
19 FOLDER EXISTS /usr/share/man/man1
20 4594974 4.0K -rw-r--r-- 1 root root 3.6K Jun 10 2012 /usr/share/man/man1/lesskey.1.gz
21 4594973 4.0K -rw-r--r-- 1 root root 568 Jun 10 2012 /usr/share/man/man1/lessecho.1.gz
22 4594972 20K -rw-r--r-- 1 root root 20K Jun 10 2012 /usr/share/man/man1/less.1.gz
23 4594975 4.0K -rw-r--r-- 1 root root 2.2K Jun 10 2012 /usr/share/man/man1/lesspipe.1.gz
24 FOLDER EXISTS /usr/lib
25 FOLDER EXISTS /usr/lib/mime
26 FOLDER EXISTS /usr/lib/mime/packages
27 4208356 4.0K -rw-r--r-- 1 root root 94 Oct 22 2007 /usr/lib/mime/packages/less
28 50989704 0 lrwxrwxrwx 1 root root 8 Jun 10 2012 /bin/lessfile -> lesspipe
29 4201355 0 lrwxrwxrwx 1 root root 9 Jun 10 2012 /usr/bin/less -> /bin/less
30 4201357 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessfile -> /bin/lesspipe
31 4201358 0 lrwxrwxrwx 1 root root 12 Jun 10 2012 /usr/bin/lesskey -> /bin/lesskey
32 4201356 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/bin/lessecho -> /bin/lessecho
33 4195315 0 lrwxrwxrwx 1 root root 13 Mar 1 17:09 /usr/bin/lesspipe -> /bin/lesspipe
34 4592163 0 lrwxrwxrwx 1 root root 13 Jun 10 2012 /usr/share/man/man1/lessfile.1.gz -> lesspipe.1.gz
The end.