Some time ago I ran into trouble while installing debian packages (something went wrong and a few packages claimed to be installed – their corresponding files however didn’t make it to disk).
While I was able to fix most of them from time to time I still got random errors that – after some investigation – were caused by missing files of some packages.
So I finally decided to fix this once and for all.
Find packages with missing files
The first step is to list all installed packages using dpkg
. After that we filter all unneeded output and finally check whether the path is a file, a directory or a symbolic link:
linux # dpkg --get-selections | grep 'install$' | cut -f1 | xargs -n1 dpkg -L | grep "^/" | while read FILE; do if [ ! -f "$FILE" -a ! -d "$FILE" -a ! -L "$FILE" ]; then echo "$FILE"; fi; done
/usr/share/icons/ubuntu-mono-dark/status/24/xfpm-ups-100-charging.svg
/usr/share/icons/ubuntu-mono-dark/status/24/xfpm-ups-100.svg
/usr/share/icons/ubuntu-mono-dark/status/24/xfpm-ups-charged.svg
/usr/share/icons/ubuntu-mono-dark/status/24/xfpm-ups-missing.svg
<...>
Now we got a list of the missing files. The package containing the file can easily be found with:
linux # dpkg -S /usr/share/icons/ubuntu-mono-dark/status/24/xfpm-ups-100-charging.svg
ubuntu-mono: /usr/share/icons/ubuntu-mono-dark/status/24/xfpm-ups-100-charging.svg
So let’s just re-install this file and hope for the best:
linux # apt install --reinstall ubuntu-mono