How to interpret the status of dpkg (–list)?

Posted by Joys of Programming on in dpkg, Linux, Ubuntu

dpkg (debian package manager) is the package manager for Ubuntu (debian based distributions). dpkg can be used to install packages in Ubuntu. With dpkg, you can see the status of various packages like:

  • the packages are currently installed
  • the packages are removed
  • the configuration files are present
  • marked for removal

Let’s explore the output of dpkg –list.

$ dpkg --list
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  acpi-support                                    0.136                                           scripts for handling many ACPI events
ii  acpid                                           1.0.10-5ubuntu2                                 Advanced Configuration and Power Interface e
...
rc  dvipdfmx                                        1:20090115-1.2                                  A DVI to PDF translator with CJK support
ii  e2fslibs                                        1.41.11-1ubuntu2                                ext2/ext3/ext4 file system libraries


The first column corresponds to the status of a package. How to interpret this status.
Status of every package is represented by three characters xxx

Let’s explore each of the character signify.

First character: The possible value for the first character. The first character signifies the desired state, like we (or some user) is marking the package for installation

  1. u: Unknown (an unknown state)
  2. i: Install (marked for installation)
  3. r: Remove (marked for removal)
  4. p: Purge (marked for purging)
  5. h: Hold

Second Character: The second character signifies the current state, whether it is installed or not. The possible values are

  1. n: Not- The package is not installed
  2. i: Inst – The package is successfully installed
  3. c: Cfg-files – Configuration files are present
  4. u: Unpacked- The package is stilled unpacked
  5. f: Failed-cfg- Failed to remove configuration files
  6. h: Half-inst- The package is only partially installed
  7. W: trig-aWait
  8. t: Trig-pend

Let’s move to the third character
Third Character: This corresponds to the error state. The possible value include

  1. R: Reinst-required The package must be installed.

Now you can easily interpret what ii, pn and rc correspond to.

Tags: , , , ,

Comments:

6 Comments

  • John Meisner says:

    Just what I was looking for. I don’t understand why these status codes aren’t part of the dpkg man pages.

  • Eric says:

    In Let’s explore the output of dpkg –list……dpkg –list should be dpkg –list..

  • Joys of Programming says:

    @Eric Check the updated post

  • Eric says:

    Mmm, what’s wrong….I meant something different ( two hyphens before list ), now it looks the same

  • Joys of Programming says:

    Actually there are two hyphens, but they seem to be one (because of the theme settings). So I added in the sample output section. Check the section below the portion you mentioned

  • ronny stalker says:

    Thanks for this list. Can you go into more detail, perhaps on another blog post, about how packages are managed – this would help me to understand the significance of the states. I.e ‘why i should care if a package is unpacked or not’.

    I’m not entirely sure what the some states mean: Purge, Hold, trig-aWait, Trig-pend

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Copyright © 2009-2012 Joys of Programming All rights reserved.
Desk Mess Mirrored v1.8.1 theme from BuyNowShop.com.