why `dpkg -l | grep package` is showing a package after being purged

6,676

Note the first two letters of the output of dpkg -l tor which says un

u: Unknown (an unknown state)
n: Not- The package is not currently installed

sometimes dpkg keeps such entries for references. To remove those problematic entries, run in terminal,

sudo dpkg --clear-avail

From man dpkg

--clear-avail
          Erase  the  existing  information  about   what   packages   are
          available.
Share:
6,676

Related videos on Youtube

Mohammad Reza Rezwani
Author by

Mohammad Reza Rezwani

Msc of computer networks.

Updated on September 18, 2022

Comments

  • Mohammad Reza Rezwani
    Mohammad Reza Rezwani almost 2 years

    To uninstall a package (Ex: tor) installed from repository one should use

    sudo apt-get remove tor
    

    I did this but dpkg -l | grep tor shown something against the package. Next I try

    sudo apt-get purge tor
    

    But when I check dpkg -l | grep tor I got,

    reza@reza-N43JM:/$ dpkg -l tor    
    Desired=Unknown/Install/Remove/Purge/Hold
    | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
    |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
    ||/ Name           Version        Description
    +++-==============-==============-============================================
    un  tor            <none>         (no description available)
    

    I think when I uninstall any package I should not get anything in dpkg -l list. Is it true? Or apt-get remove or purge does another work but not uninstall?

  • wsw
    wsw over 8 years
    Using sudo dpkg --clear-avail doesn't work for me.
  • HeinrichStack
    HeinrichStack over 7 years
    Neither for me. (Ubuntu 16.04 LTS)