How can I "clean house" so that dpkg -l no longer lists packages I've removed?

9,436

Run

sudo dpkg --purge <package>

or

sudo apt-get purge <package>

to uninstall <package> AND its configuration files.

Share:
9,436
Wang Wei
Author by

Wang Wei

I like Ruby, Lua, Io, JavaScript…and my real-life children and wife :) "It is better to illuminate than merely to shine; to deliver to others contemplated truths than merely to contemplate." ~Thomas Aquinas

Updated on September 18, 2022

Comments

  • Wang Wei
    Wang Wei over 1 year

    As the solution to another problem I was forced to use dpkg --remove to uninstall a package. However, after I do this the package is still listed in dpkg -l:

    phrogz@planar:/boot$ dpkg -l | grep linux-image-2
    ii  linux-image-2.6.32-30-server  2.6.32-30.59  Linux kernel image for version 2.6.32 on x86
    ii  linux-image-2.6.32-31-server  2.6.32-31.61  Linux kernel image for version 2.6.32 on x86
    ii  linux-image-2.6.32-32-server  2.6.32-32.62  Linux kernel image for version 2.6.32 on x86
    
    phrogz@planar:/boot$ sudo dpkg --remove linux-image-2.6.32-30-server
    (Reading database ... 141902 files and directories currently installed.)
    Removing linux-image-2.6.32-30-server ...
    Running postrm hook script /usr/sbin/update-grub.
    Generating grub.cfg ...
    [...]
    done
    
    phrogz@planar:/boot$ dpkg -l | grep linux-image-2
    rc  linux-image-2.6.32-30-server  2.6.32-30.59  Linux kernel image for version 2.6.32 on x86
    ii  linux-image-2.6.32-31-server  2.6.32-31.61  Linux kernel image for version 2.6.32 on x86
    ii  linux-image-2.6.32-32-server  2.6.32-32.62  Linux kernel image for version 2.6.32 on x86
    
    phrogz@planar:/boot$ sudo apt-get --purge remove linux-image-2.6.32-30-server
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Package linux-image-2.6.32-30-server is not installed, so not removed
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    

    How can I 'clean house' so that dpkg-l no longer lists these older, non-existent packages?

  • tudor -Reinstate Monica-
    tudor -Reinstate Monica- about 9 years
    This deletes the config files also. Is there an option that doesn't delete these?