Error installing software with apt and software center: /etc/passwd locked by /usr/share/system-config-printer/

Bug #693442 reported by John Aylsworth on 2010-12-22
This bug affects 1 person
Affects Status Importance Assigned to Milestone
system-config-printer (Ubuntu)

Bug Description

Binary package hint: apt

I'm using Ubuntu 10.10. I tried installing Code::Blocks from the Ubuntu Software Center and got a message "Package operation failed" even though Code::Blocks seems to have installed perfectly. I've had the same problem while installing other applications and have ignored it without any repercussions that I can tell. Below is the output when attempting the same installation from the terminal. The error is identical to the one I got from the software center.

~$ sudo apt-get install libcodeblocks0

Reading package lists... Done
Building dependency tree
Reading state information... Done
libcodeblocks0 is already the newest version.
The following packages were automatically installed and are no longer required:
  python-utidylib python-gtkmozembed libtidy-0.99-0 python-feedparser
  python-rsvg python-evolution libgdiplus libboost-python1.42.0
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.
1 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 hal (0.5.14-0ubuntu6) ...
useradd: cannot lock /etc/passwd; try again later.
adduser: `/usr/sbin/useradd -d /var/run/hald -g haldaemon -s /bin/false -u 116 haldaemon' returned error code 1. Exiting.
dpkg: error processing hal (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

So I tried to see what has locked /etc/passwd and found the culprit is

greeenguru@Veronica:~$ lsof /etc/passwd
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME 1982 greeenguru 10r REG 8,1 1698 2886356 /etc/passwd

And I found which has locked /etc/passwd:

greeenguru@Veronica:~$ ps -Af | grep
1000 1982 1598 0 Dec20 ? 00:00:02 /usr/bin/python /usr/share/system-config-printer/

It seems that /usr/share/system-config-printer/ is locking /etc/passwd, but I don't know how to solve this problem or even what does. I found one solution on the forums:
but the solution is to run this:

sudo rm -f /etc/gshadow.lock /etc/shadow.lock /etc/passwd.lock

and I don't fully understand what the repercussions of that might be.

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: apt 0.8.3ubuntu7
ProcVersionSignature: Ubuntu 2.6.35-23.41-generic
Uname: Linux 2.6.35-23-generic i686
NonfreeKernelModules: nvidia wl
Architecture: i386
Date: Thu Dec 23 01:24:59 2010
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release i386 (20101007)
SourcePackage: apt

John Aylsworth (john-aylsworth) wrote :
David Kalnischkies (donkult) wrote :

I guess the applet is provided by system-config-printer, so lets reassign it to them, as there is nothing apt can do about.

P.S.: The packages are not completely installed - some are dangling half-installed on your system as you can see in the end of the APT output. More information about the states can be seen with: dpkg --audit

affects: apt (Ubuntu) → system-config-printer (Ubuntu)
John Aylsworth (john-aylsworth) wrote :

This problem still occurred whenever I used apt to install new software (via Terminal, Synaptic, and Software Center). Every package gave me the same error. I got impatient and ran this:

sudo rm -f /etc/gshadow.lock /etc/shadow.lock /etc/passwd.lock

I no longer get any errors upon installing new packages. Completely solved my problem, even after several reboots. I'd still like to understand why that was necessary though.

gf (gf-interlinks) wrote :

Hello John,
Thank you for submitting this bug and reporting a problem with system-config-printer. You made this bug report in 2010 and Ubuntu has been updated since then.

Could you confirm that this is no longer a problem and that we can close the bug report?
If it is still a problem, are you still interested in finding a solution to this bug?
If you are, could you let us know, and in the current version, run the following (only once):
apport-collect BUGNUMBER
and upload the updated logs and and any other logs that are relevant for this particular issue.

Thank you again for helping make Ubuntu better.
[Ubuntu Bug Squad volunteer triager]

Changed in system-config-printer (Ubuntu):
status: New → Incomplete
Launchpad Janitor (janitor) wrote :

[Expired for system-config-printer (Ubuntu) because there has been no activity for 60 days.]

Changed in system-config-printer (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers