After update, two packages left half-configured: post-installation script returned error exit status 10

Asked by Porcelain Mouse

I did a fresh install, so the first update was large. Afterword, however, two packages were left broken. Re-configuring both results in the same exit code (10). I tried running the post-install script for rsyslog manually and it was 'ucf' that caused the error, but I can't figure out why or how to fix it. I also tried forcibly removing rsyslog, since it is required by ubuntu-minimal, and then reinstalling, but that didn't work; the package is still half-configured.

I tried manually running the post-install script for grub-pc, but it calls /usr/share/deb/conf/frontend on itself and I haven't followed it through.

I think this problem is bigger than it seems. How do I tackle it?

Below is a log of the PackageManagerTroubleshootingProcedure, if that's helpful.

pmouse@leeenux:~$ sudo fuser -vvv /var/lib/dpkg/lockpmouse@leeenux:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_Release=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04.2 LTS"
pmouse@leeenux:~$ uname -a
Linux leeenux 2.6.32-29-generic #58-Ubuntu SMP Fri Feb 11 19:00:09 UTC 2011 i686 GNU/Linux
pmouse@leeenux:~$ sudo rm /var/lib/apt/lists/lock
pmouse@leeenux:~$ sudo cp -arf /var/lib/dpkg /var/lib/dpkg.bacup
pmouse@leeenux:~$ diff /var/lib/dpkg/status-old /var/lib/dpkg/status
pmouse@leeenux:~$ sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
pmouse@leeenux:~$ sudo cp /var/lib/dpkg/available-old /var/lib/dpkg/available
pmouse@leeenux:~$ sudo rm -rf /var/lib/dpkg/updates/*
pmouse@leeenux:~$ sudo rm -rf /var/lib/apt/lists
pmouse@leeenux:~$ sudo rm /var/cache/apt/*.bin
pmouse@leeenux:~$ sudo mkdir /var/lib/apt/lists
pmouse@leeenux:~$ sudo mkdir /var/lib/apt/lists/partial
pmouse@leeenux:~$ LANG=C; sudo apt-get clean
pmouse@leeenux:~$ LANG=C; sudo apt-get autoclean
Reading package lists... Done
Building dependency tree
Reading state information... Done
pmouse@leeenux:~$ LANG=C; sudo apt-get --purge autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Setting up rsyslog (4.2.0-2ubuntu8.1) ...
dpkg: error processing rsyslog (--configure):
 subprocess installed post-installation script returned error exit status 10
Setting up grub-pc (1.98-1ubuntu10) ...
dpkg: error processing grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 10
Errors were encountered while processing:
 rsyslog
 grub-pc
E: Sub-process /usr/bin/dpkg returned an error code (1)
pmouse@leeenux:~$ LANG=C; sudo apt-get update -o APT::Cache-limit=25165824
Get:1 http://security.ubuntu.com lucid-security Release.gpg [198B]
Get:2 http://archive.ubuntu.com lucid Release.gpg [189B]
Get:3 http://archive.ubuntu.com lucid-updates Release.gpg [198B]
Get:4 http://ppa.launchpad.net lucid Release.gpg [307B]
Get:5 http://security.ubuntu.com lucid-security Release [44.7kB]
Get:6 http://archive.ubuntu.com lucid Release [57.2kB]
Get:7 http://ppa.launchpad.net lucid Release [57.3kB]
Get:8 http://archive.ubuntu.com lucid-updates Release [44.7kB]
Get:9 http://security.ubuntu.com lucid-security/main Packages [150kB]
Get:10 http://ppa.launchpad.net lucid/main Packages [633B]
Get:11 http://archive.ubuntu.com lucid/main Packages [1386kB]
Get:12 http://archive.ubuntu.com lucid-updates/main Packages [454kB]
Fetched 2195kB in 10s (207kB/s)
Reading package lists... Done
pmouse@leeenux:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=10.04
DISTRIB_CODENAME=lucid
DISTRIB_DESCRIPTION="Ubuntu 10.04.2 LTS"
pmouse@leeenux:~$ sudo dpkg --clear-avail
pmouse@leeenux:~$ sudo dpkg --configure -a
Setting up grub-pc (1.98-1ubuntu10) ...
dpkg: error processing grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 10
Setting up rsyslog (4.2.0-2ubuntu8.1) ...
dpkg: error processing rsyslog (--configure):
 subprocess installed post-installation script returned error exit status 10
Errors were encountered while processing:
 grub-pc
 rsyslog
pmouse@leeenux:~$ LANG=C; sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Setting up rsyslog (4.2.0-2ubuntu8.1) ...
dpkg: error processing rsyslog (--configure):
 subprocess installed post-installation script returned error exit status 10
Setting up grub-pc (1.98-1ubuntu10) ...
dpkg: error processing grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 10
Errors were encountered while processing:
 rsyslog
 grub-pc
E: Sub-process /usr/bin/dpkg returned an error code (1)
pmouse@leeenux:~$ LANG=C; sudo apt-get --fix-missing install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Setting up rsyslog (4.2.0-2ubuntu8.1) ...
dpkg: error processing rsyslog (--configure):
 subprocess installed post-installation script returned error exit status 10
Setting up grub-pc (1.98-1ubuntu10) ...
dpkg: error processing grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 10
Errors were encountered while processing:
 rsyslog
 grub-pc
E: Sub-process /usr/bin/dpkg returned an error code (1)
pmouse@leeenux:~$ LANG=C; sudo apt-get update -o APT::Cache-limit=25165824 && sudo apt-get dist-upgrade
Hit http://security.ubuntu.com lucid-security Release.gpg
Hit http://archive.ubuntu.com lucid Release.gpg
Hit http://archive.ubuntu.com lucid-updates Release.gpg
Hit http://ppa.launchpad.net lucid Release.gpg
Hit http://security.ubuntu.com lucid-security Release
Hit http://archive.ubuntu.com lucid Release
Hit http://ppa.launchpad.net lucid Release
Hit http://security.ubuntu.com lucid-security/main Packages
Hit http://ppa.launchpad.net lucid/main Packages
Hit http://archive.ubuntu.com lucid-updates Release
Hit http://archive.ubuntu.com lucid/main Packages
Hit http://archive.ubuntu.com lucid-updates/main Packages
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? y
Setting up rsyslog (4.2.0-2ubuntu8.1) ...
dpkg: error processing rsyslog (--configure):
 subprocess installed post-installation script returned error exit status 10
Setting up grub-pc (1.98-1ubuntu10) ...
dpkg: error processing grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 10
Errors were encountered while processing:
 rsyslog
 grub-pc
E: Sub-process /usr/bin/dpkg returned an error code (1)

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu apt Edit question
Assignee:
No assignee Edit question
Solved by:
Porcelain Mouse
Solved:
Last query:
Last reply:
Revision history for this message
actionparsnip (andrew-woodhead666) said :
#1

Try:

sudo apt-get clean; sudo apt-get --reinstall install rsyslog grub-pc

Does it help

Revision history for this message
Porcelain Mouse (pmouse) said :
#2

No. I've tried a number of things that all seem to amount to the same thing, which is what you are suggesting. They a all result in the same condition.

I don't know why these packages failed to configure, but whatever it is, it is not transient and cannot be overcome by re-configuring.

I'll post the log of your suggested actions in just a sec...

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

Was the output any different?

Revision history for this message
Porcelain Mouse (pmouse) said :
#4

pmouse@leeenux:~$ sudo apt-get --reinstall install rsyslog grub-pc
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? Y
Setting up rsyslog (4.2.0-2ubuntu8.1) ...
dpkg: error processing rsyslog (--configure):
 subprocess installed post-installation script returned error exit status 10
Setting up grub-pc (1.98-1ubuntu10) ...
dpkg: error processing grub-pc (--configure):
 subprocess installed post-installation script returned error exit status 10
Errors were encountered while processing:
 rsyslog
 grub-pc
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
mycae (mycae) said :
#5

Hello Mouse,

You can modify the post-installation script for rsyslog and grub-pc... but I would want to know *why* these are failing; that is a bit disconcerting. Whilst you can bypass it by inserting a forced "exit 0" at the beginning of the script, this may leave your computer in a partially configured state -- never a good look for a bootloader.

The postinst scripts are located in

/var/lib/dpkg/info/BLAH.postinst

i.e.

/var/lib/dpkg/info/rsyslog.postinst

and
/var/lib/dpkg/info/grub-pc.postinst

you might be able to insert "echo 'here I am!'" statements into the script at strategic points to determine where, and indeed why the script is failing.

Revision history for this message
Porcelain Mouse (pmouse) said :
#6

Well, the final error is always the same, whether I uninstall and install or just re-configure rsyslog. I didn't try uninstalling grub-pc. During the uninstall process, however, dpkg complains bitterly about a large number of other packages for which the "list of files is missing." But, no other packages are listed as broken (dpgk --audit).

During the upgrade, I was prompted at least 30 times to choose whether to keep the old version of /etc/ files or replace them with new ones from the updated packages. I think this is unusual, but not necessary indicative of anything specifically wrong, AFAIK. I choose to install the new versions, but once I clicked on the close button for that dialog box and I assume that translated into "keep," although I don't remember which package. I may have been grub-pc because the file /etc/grub.d/10_linux.dpkg-dist exists. Isn't that the dpkg version of .rpm-new?

Many thanks for you help and interest. Please let me know if I can provide any more useful information.

Revision history for this message
Porcelain Mouse (pmouse) said :
#7

Hi mycae,

I agree completely. I probably wouldn't have bothered reporting these if they weren't core programs.

I have tried tracing the post-install scripts, but that is a dead end, for me. The failures occur in called programs, not the scripts. As I mentioned in my original post, one script calls 'ucf' which bombs and the other execs itself through some PERL frontend script. It's getting hard to follow. I even tried to debug 'ucf', but it wasn't obvious why it bombed.

pmouse@leeenux:~$ sudo ucf -d --three-way /usr/share/rsyslog/50-default.conf /etc/rsyslog.d/50-default.conf
The new start file is `/usr/share/rsyslog/50-default.conf\'
The destination is `/etc/rsyslog.d/50-default.conf\' (`\/etc\/rsyslog\.d\/50\-default\.conf\')
The history is kept under \'/usr/share/rsyslog\'
The file may be cached at \'/var/lib/ucf/cache/:etc:rsyslog.d:50-default.conf\'
The destination file exists, and has md5sum:
18155f1d4d889ddb7258119539b9436a /etc/rsyslog.d/50-default.conf
The old md5sum exists, and is:
f3526a82bb5de842472d4917b70f01f1
The new file exists, and has md5sum:
f3526a82bb5de842472d4917b70f01f1 /usr/share/rsyslog/50-default.conf
Historical md5sums are not available

Does anyone know what ucf does? Why might it be failing? Exit code 10 might mean something, but not to me. There are a number of posts that match the description post-install exists with status 10, but they don't seem relevant...

hmm. Okay, this might be something. Someone says that "reinstalling" ucf helped. I wonder if there is a problem with the reset of the debconf stuff. How do I find out?

I tried to purge ucf, and got a very short list of dependencies, which include rsyslog and grub-pc. I think this promising.

Revision history for this message
mycae (mycae) said :
#8

According to the man page, ucf is the utility that dpkg uses to determine what to d with old configuration files when you have a new package with replacement config files.

You could export UCF_FORCE_CONFNEW, UCF_FORCE_CONFOLD to override the behaviour of ucf.

But this raises a question -- what happened to your ucf database -- this is stored in /var/lib/ucf/ as hashfile[0-9].*

You also mention that there is a complaint about the list of installef files missing -- has something trashed your /var/lib?

Untangling this might take a while; it might be faster just to nuke your / and reinstall, particularly if you have a seperate /home/

Revision history for this message
Porcelain Mouse (pmouse) said :
#9

Awesome. I force purged ucf, using dpkg --purge --force-depends, then reinstalled it with aptitude. Aptitude installed ucf, but then reconfgured rsyslog and grub-pc, automatically, and this time, it worked.

I don't know what happened, but /var/lib/ucf/ has a bunch of stuff in it. As far as I can tell, there's not an obvious problem with these files. dpkg database is there, too. I'll see how it goes from here. Many thanks for your help, all.

If anyone knows how to rebuild the "list of files" part of the package database, I'd be interested.

Revision history for this message
mycae (mycae) said :
#10

If it is your status file, there is a method to do it, but it is a bit flaky....
http://ubuntuforums.org/showthread.php?p=4903403

Revision history for this message
John Pitz (crustacean) said :
#11

Hello,
   A while ago I tried installing some mono-doc packages and for some reason the install failed. Now whenever I try to install or remove any packages I receive an error message that the install failed. If I look at the details I notice that Ubuntu is still trying to configure these packages every time I try to install or remove software. Is there any good way of forcing these packages to be removed so that Ubuntu no longer tries to configure then and I quit getting all these errors when I try to install other software? I would like to remove them entirely as I no longer need them (Was trying to get a vb app written for windows to work but have since given up- be nice if mono for Ubuntu could be safely upgraded without the threat of breaking the os! ). If anyone could tell me how to remove the problem packages completely I would appreciate it.

By the way, I did try removing them using the software center but that does not seem to work.