Ubuntu – What do the various dpkg flags like ‘ii’ ‘rc’ mean

command linedpkg

I frequently need to check which packages are installed, and I use the following command:

dpkg -l | grep foo

which gives the following output

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                       Version         Description
ii   foo                       <version>         <description>
  1. What does the ii mean?
  2. What other flags are there?
  3. How to read the flags? (because the explanation is quite complicated, IMO)

Thanks.

Best Answer

  • Where to find this information in the system

    You can find this information out in the head of dpkg -l output, as it's just a formatting convention:

    dpkg -l | head -3
    

    Copied here for reference:

    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)                    
    

    Description of each field

    As you can see from the first three lines:

    First letter -> desired package state ("selection state"):

    • u ... unknown
    • i ... install
    • r ... remove/deinstall
    • p ... purge (remove including config files)
    • h ... hold

    Second letter -> current package state:

    • n ... not-installed
    • i ... installed
    • c ... config-files (only the config files are installed)
    • U ... unpacked
    • F ... half-configured (configuration failed for some reason)
    • h ... half-installed (installation failed for some reason)
    • W ... triggers-awaited (package is waiting for a trigger from another package)
    • t ... triggers-pending (package has been triggered)

    Third letter -> error state (you normally shouldn't see a third letter, but a space, instead):

    • R ... reinst-required (package broken, reinstallation required)
  • Related Question