How to completely remove a package in Debian?

15,460

Solution 1

Will remove a package and all configuration files.

apt-get --purge remove package

If it is still giving you issues, try reinstalling then purging:

apt-get --reinstall install package
apt-get --purge remove package

You still might need to:

killall package

Reboot and if it started again run:

update-rc.d remove package

Story Time: Once for some unknown reason, when I purge removed ejabberd; it continued running. I trusted apt-get to kill it and remove it. It didn't. Needless to say, it eventually filled up my entire /var with a ramdisk log file. It continued until I killed all of the ejabberd processes and that quickly resolved the issue. So it taught me to always be sure that apt-get worked and killed all needed processes.

Solution 2

In case you prefer aptitude:

# aptitude purge denyhosts

purge should also remove the init scripts, so the update-rc.d step is not really necessary.

Another thing that is possible that another package also provides a daemon called denyhosts. To search for all installed packages that contain files with denyhosts in them:

$ dpkg -S denyhosts
Share:
15,460

Related videos on Youtube

datasn.io
Author by

datasn.io

Updated on September 17, 2022

Comments

  • datasn.io
    datasn.io over 1 year

    I tried to use this:

    aptitude remove denyhosts
    

    And it seemed successfully but after a reboot after I use:

    ps aux | grep "denyhosts"
    

    I see denyhosts is still loaded after startup.

    So what am I supposed to do so that I can stop and destroy it once and for all? "aptitude remove something" isn't meant for uninstalling?

  • liori
    liori over 14 years
    Spelling...
  • Michael Pobega
    Michael Pobega over 14 years
    Just so you know, aptitude is the preferred package manager in Debian.
  • 0x89
    0x89 over 14 years
    Thanks, but IF you want to help, point out where somebody misspelled something, don't make them scan the entire post. If you just want to bitch about some non-native speaker making a mistake, have fun.
  • David Rickman
    David Rickman over 14 years
    apt-get, aptitude, and dpkg are all preferred package managers for Debian. It doesn't really matter much anymore as it has before. If Debian really only wanted a single package manager, they would symlink one of them to the others and teach the new one the same switches.
  • cas
    cas over 14 years
    i would guess that the spelling mistake he's referring to is "dpgk" instead of "dpkg" - it's a typing mistake i make frequently when i'm typing too fast. often enough that i've got used to typing "^gk^kg<ENTER>" to fix it.
  • 0x89
    0x89 over 14 years
    Thanks Craig. I thought it was deamon <-> daemon - that's a mistake I frequently make. When I misstype dpkg my zsh kindly asks me if it is allowed to correct my mistake, but Serverfault currently misses that feature ;-)
  • datasn.io
    datasn.io over 14 years
    Thanks! I found that apt-get couldn't really get rid of the package completely as I installed it with 'aptitude install' in the first place. apatitude purge denyhosts successfully removed the package completely!
  • user649102
    user649102 over 13 years
    @kavoir.com "apt-get couldn't really get rid of the package completely" <---- this is just wrong.