During the removal of package, corresponding .prerm
and .postrm
scripts (stored in /var/lib/dpkg/info
) for the package should clean up and remove the files for the package, but those scripts may be missing removal for a few files or something failed in the process while script was running.
When a package is installed via apt-get
or apt
, there will be a .list
file in /var/lib/dpkg/info
folder with list of all directories and files that were used by the package. You could go over contents of that file and remove items individually via sudo rm <filename>
command. One possible quick way to figure out which items from the list are still there would be to do the following:
while IFS= read -r line || [ -n "$line" ];
do
[ -f "$line" ] && printf "%s\n" "$line"
done < /var/lib/dpkg/info/<PACKAGE-NAME>.list
Of course you could replace printf
part with rm
, and run this loop as root, but I wouldn't recommend doing that. Use discretion, verify each file is not used by something else and is actually something you can remove without breaking your system.
sudo rm filename
, and any directory withsudo rm -r dirname
, if you have sudo rights. Just be careful, and don't delete too much.