RU-FI-OOOOOH!

Sohail Mirza, standing in for Peter.

dpkg problems relating to ‘cups’ in Ubuntu

with 2 comments

Firefox 3.0.5, Mozilla’s latest security fix for the venerable browser has recently been released.  Tonight it was pushed out to Ubuntu 8.10 users, and so I promptly updated my Ubuntu installation.  Noticing that there were other updates as well, I applied them all.

Unfortunately, dpkg wasn’t able to complete the update of all selected packages.  I wanted to review the problem, so from the command-line I brought up aptitude via:

sudo aptitude

Aptitude was nice enough to let me know that I needed to run the following command to correct the problem:

sudo dpkg --configure -a

… unfortunately it didn’t work:

$ sudo dpkg --configure -a
dpkg: ../../src/packages.c:221: process_queue: Assertion `dependtry <= 4' failed.
Aborted

I decided to go back into aptitude to see if any packages would be selected there for installation due to a failure to install previously.  Sure enough, when I pressed ‘g’ to process all actions, it attempted to install cups, cups-bsd, and cups-client, but failed:

dpkg: error processing cups (--configure):
package cups is not ready for configuration
cannot configure (current status `triggers-awaited')
dpkg: error processing cups-client (--configure):
package cups-client is not ready for configuration
cannot configure (current status `triggers-awaited')
dpkg: ../../src/packages.c:221: process_queue: Assertion `dependtry <= 4' failed.
E: Sub-process /usr/bin/dpkg exited unexpectedly
A package failed to install.  Trying to recover:
dpkg: ../../src/packages.c:221: process_queue: Assertion `dependtry <= 4' failed.
Aborted

These were the packages that had failed to install successfully earlier.

What could I do to get around this?  Aptitude wasn’t able to handle it for me, and nor could dpkg process the configuration of these packages.  After some futzing around, I even tried downgrading the packages in aptitude, but the same dpkg errors came up:

Preconfiguring packages ...
Selecting previously deselected package cups.
(Reading database ... 148514 files and directories currently installed.)
Preparing to replace cups 1.3.9-2ubuntu4 (using .../cups_1.3.9-2_amd64.deb) ...
* Stopping Common Unix Printing System: cupsd [ OK ]
Unpacking replacement cups ...
Selecting previously deselected package cups-bsd.
Preparing to replace cups-bsd 1.3.9-2ubuntu4 (using .../cups-bsd_1.3.9-2_amd64.deb) ...
Unpacking replacement cups-bsd ...
Selecting previously deselected package cups-client.
Preparing to replace cups-client 1.3.9-2ubuntu4 (using .../cups-client_1.3.9-2_amd64.deb) ...
Unpacking replacement cups-client ...
Processing triggers for doc-base ...
Processing 1 changed doc-base file(s)...
Registering documents with scrollkeeper...
Processing triggers for man-db ...
Processing triggers for ufw ...
ERROR: Couldn't stat '/etc/default/ufw'
dpkg: subprocess post-installation script returned error exit status 1
E: Sub-process /usr/bin/dpkg returned an error code (2)
A package failed to install. Trying to recover:
Setting up cups-client (1.3.9-2) ...

Setting up ufw (0.23.2) ...

Setting up cups (1.3.9-2) ...

Installing new version of config file /etc/apparmor.d/usr.sbin.cupsd ...
Reloading AppArmor profiles : done.
* Starting Common Unix Printing System: cupsd [ OK ]

dpkg: ../../src/packages.c:221: process_queue: Assertion `dependtry <= 4' failed.
Aborted
Press return to continue.

But wait, what’s that error?

Processing triggers for ufw ...
ERROR: Couldn't stat '/etc/default/ufw'
dpkg: subprocess post-installation script returned error exit status 1
E: Sub-process /usr/bin/dpkg returned an error code (2)

A-hah!  It looked like the cups installation needed to process some triggers for the package ufw, and this failed.  ufw is Uncomplicated FireWall package for Ubuntu, but it’s a package I’m not using.

So, maybe if I were to uninstall ufw, the cups packages would successfully install?

sudo aptitude purge ufw

If you want to keep the ufw configuration files, you can try this instead:

sudo aptitude remove ufw

Removing ufw may display some cups errors, but ufw should still successfully uninstall.

At this point, the resolution that aptitude first suggested worked as well:

sudo dpkg --configure -a

And now to install the latest version of cups instead of the downgraded versions I attempted to install.

Preconfiguring packages ...
(Reading database ... 148481 files and directories currently installed.)
Preparing to replace cups 1.3.9-2 (using .../cups_1.3.9-2ubuntu4_amd64.deb) ...
* Stopping Common Unix Printing System: cupsd                                                                                                                                                                                        [ OK ]
Unpacking replacement cups ...
Preparing to replace cups-bsd 1.3.9-2 (using .../cups-bsd_1.3.9-2ubuntu4_amd64.deb) ...
Unpacking replacement cups-bsd ...
Preparing to replace cups-client 1.3.9-2 (using .../cups-client_1.3.9-2ubuntu4_amd64.deb) ...
Unpacking replacement cups-client ...
Processing triggers for doc-base ...
Processing 1 changed doc-base file(s)...
Registering documents with scrollkeeper...
Processing triggers for man-db ...
Setting up cups (1.3.9-2ubuntu4) ...
Installing new version of config file /etc/apparmor.d/usr.sbin.cupsd ...
Reloading AppArmor profiles : done.
* Starting Common Unix Printing System: cupsd                                                                                                                                                                                        [ OK ]

Setting up cups-client (1.3.9-2ubuntu4) ...

Setting up cups-bsd (1.3.9-2ubuntu4) ...

Press return to continue.

Presto! It worked!

At this point I reinstalled ufw and all was as it should be.

Along the way I was also able to find a cool way of listing packages on one’s system that are not completely installed.  From a command line terminal, you can enter the following:

sudo dpkg -l | grep -v ^ii

The first portion of this command, sudo dpkg -l, will list all the packages on your system. The second portion, grep -v ^ii, says, ‘search through that list of packages for any line that does not start with “ii“‘. The letters “ii” at the beginning of a line of the package listing indicates the package is successfully installed.

Quite an eventful application of system updates! I love Ubuntu for its simplicity, and the fact that upgrades and installations are usually hassle-free. But, even when there’s a problem, the power inherent in Linux allows you to quickly and effectively resolve the issue.

NB: Sorry about the poor formatting of this post, WordPress is simply not co-operating.

About these ads

Written by Sohail Mirza

December 18, 2008 at 1:10 am

Posted in Software, Ubuntu

Tagged with , , , , ,

2 Responses

Subscribe to comments with RSS.

  1. Thanks for linking to my post, I’m glad you found it useful.

    techxplorer

    December 18, 2008 at 2:25 am

  2. shoot amazing stuff dude.

    limewire

    April 30, 2010 at 7:42 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: