10.04.07

apt-get Package Status Codes

Posted in Intermediate, Linux at 5:55 pm by Techie

If you’re a debian user (this includes all of you Ubuntu folks!), then you may be familiar with the strangeness of status codes for dpkg -l. For example, let’s say you install postfix:


sudo apt-get install postfix

We can look at the package list with dpkg -l. Let’s take a look at postfix:


$ dpkg -l | grep postfix
ii postfix 2.2.10-1ubuntu0.1 A high-performance mail transport agent

The ii at the start is some sort of status. Let’s remove the package:


sudo apt-get remove postfix

All fine and good, until we take a look at dpkg again:


$ dpkg -l | grep postfix
rc postfix 2.2.10-1ubuntu0.1 A high-performance mail transport agent

Hmm. Instead of removing it from the list, we see this peculiar rc status. What the heck does that mean?

The answer lies in the dpkg listing itself.


$ dpkg -l | head -3
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)

There are three columns here, though y ou usually don’t see the third.

  • Desired: what state we wanted the package to be in. (Unknown/Install/Remove/Purge/Hold)
  • Status: what state the package is in now. (Not/Installed/Config-files/Unpacked/Failed-config/Half-installed)
  • Err: special errors. (none/Hold/Reinst-required/X=both-problems)

So, if you take the first letter of each potential state for each of those, you get your status code for dpkg. Let’s look at the some of these status codes again:

ii: Desired: (I)nstall; Status: (I)nstalled; Err: none.

rc: Desired: (R)emove; Status: (C)onfig-files; Err: none.

pi: Desired: (P)urge; Status: (I)nstalled; Err: none.

Mystery solved!

2 Comments »

  1. Kushal Koolwal said,

    December 27, 2008 at 9:42 pm

    Hi, I think this was very useful. I have been pondering over for a while. Although I am not sure how can change the status from “pi” to “ii”?

  2. Techie said,

    December 30, 2008 at 9:32 am

    I’d try running apt-get -f install to see if it fixes it.

Leave a Comment

Bad Behavior has blocked 2090 access attempts in the last 7 days.