hal can't upgrade in chroot: polkit-auth call in postinst fails

Bug #210748 reported by laga
54
This bug affects 1 person
Affects Status Importance Assigned to Milestone
hal (Ubuntu)
Fix Released
Undecided
Martin Pitt
Declined for Hardy by Martin Pitt

Bug Description

Binary package hint: hal

Hello,

I'm running a modified LTSP chroot where I installed the 'hal' package. When running apt-get dist-upgrade, upgrading will fail because of a call to /usr/bin/polkit-auth around line 44:

 # Allow hal to query the PolicyKit database to enforce privileges
    if ! /usr/bin/polkit-auth --user haldaemon --explicit | grep -q 'org.freedesktop.policykit.read'; then
        /usr/bin/polkit-auth --user haldaemon --grant 'org.freedesktop.policykit.read'
    fi

This is the resulting error message:

> polkit-auth: This operation requires the system message bus and ConsoleKit to be running

Since I'm inside a chroot environment, the 'system message bus' and consolekit can't be running. Can you make upgrading a bit smoother, please?

Here's the full aptitude log:

root@prometheus:/# LTSP_HANDLE_DAEMONS="false" LC_ALL=C aptitude dist-upgrade

Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done
The following partially installed packages will be configured:
  gnome-power-manager gnome-session hal network-manager network-manager-gnome update-notifier
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B of archives. After unpacking 0B will be used.
Can not write log, openpty() failed (/dev/pts not mounted?)
Setting up hal (0.5.11~rc2-1ubuntu5) ...
polkit-auth: This operation requires the system message bus and ConsoleKit to be running
polkit-auth: AuthorizationAlreadyExists: An authorization for uid 107 for the action org.freedesktop.policykit.read with constraint '' already exists
dpkg: error processing hal (--configure):
 subprocess post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of gnome-power-manager:
 gnome-power-manager depends on hal (>= 0.5.10); however:
  Package hal is not configured yet.
dpkg: error processing gnome-power-manager (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of gnome-session:
 gnome-session depends on gnome-power-manager; however:
  Package gnome-power-manager is not configured yet.
dpkg: error processing gnome-session (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of network-manager:
 network-manager depends on hal (>= 0.5.7.1); however:
  Package hal is not configured yet.
dpkg: error processing network-manager (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of network-manager-gnome:
 network-manager-gnome depends on network-manager (>= 0.6.5); however:
  Package network-manager is not configured yet.
dpkg: error processing network-manager-gnome (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of update-notifier:
 update-notifier depends on hal; however:
  Package hal is not configured yet.
dpkg: error processing update-notifier (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 hal
 gnome-power-manager
 gnome-session
 network-manager
 network-manager-gnome
 update-notifier
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install. Trying to recover:
Setting up hal (0.5.11~rc2-1ubuntu5) ...
polkit-auth: This operation requires the system message bus and ConsoleKit to be running
polkit-auth: AuthorizationAlreadyExists: An authorization for uid 107 for the action org.freedesktop.policykit.read with constraint '' already exists
dpkg: error processing hal (--configure):
 subprocess post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of update-notifier:
 update-notifier depends on hal; however:
  Package hal is not configured yet.
dpkg: error processing update-notifier (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of network-manager:
 network-manager depends on hal (>= 0.5.7.1); however:
  Package hal is not configured yet.
dpkg: error processing network-manager (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of network-manager-gnome:
 network-manager-gnome depends on network-manager (>= 0.6.5); however:
  Package network-manager is not configured yet.
dpkg: error processing network-manager-gnome (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of gnome-power-manager:
 gnome-power-manager depends on hal (>= 0.5.10); however:
  Package hal is not configured yet.
dpkg: error processing gnome-power-manager (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of gnome-session:
 gnome-session depends on gnome-power-manager; however:
  Package gnome-power-manager is not configured yet.
dpkg: error processing gnome-session (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 hal
 update-notifier
 network-manager
 network-manager-gnome
 gnome-power-manager
 gnome-session
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Building tag database... Done

Tags: ume
Revision history for this message
Joshua Swink (yathster) wrote :

Having the same problem with hal 0.5.11~rc2-1ubuntu7. Would appreciate a workaround.

Revision history for this message
Joshua Swink (yathster) wrote :

I edited /var/lib/dpkg/info/hal.postinst and commented out the part that called polkit-auth, then finished the upgrade. I hope this won't interfere with hal's proper operation.

Revision history for this message
Francois Audirac (francois-audirac) wrote :

Have you try this, in you chroot ?
etc/init.d/dbus start

with this in the chroot :
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devpts none /dev/pts

Revision history for this message
KuSh (kush-knowledge) wrote :

Having the same problem, you're solution worked except that proc sys and dev were mounted from outside the chroot :
sudo mount --bind /dev /target/dev
sudo mount -t sysfs sysfs /target/sys
sudo mount -t proc proc /target/proc

Thanks a lot.

Revision history for this message
Mantas Kriaučiūnas (mantas) wrote :

After little IRC talk Martin Pitt fixed this bug in intrepid branch, but it seems forgot to fix in Hardy updates :(

(14:44:48) mantiena: I've found which hal.postinst line couses this message:
(14:44:48) mantiena: if ! /usr/bin/polkit-auth --user haldaemon --explicit | grep -q 'org.freedesktop.policykit.read'; then
(14:44:48) mantiena: /usr/bin/polkit-auth --user haldaemon --grant 'org.freedesktop.policykit.read'
(14:44:48) mantiena: fi
(14:45:27) mantiena: are these lines needed for upgrading hal package ?
(14:46:08) pitti: mantiena: actually only for the first installation
(14:46:30) pitti: so those could be wrapped into
(14:46:35) pitti: if [ -z "$2" ]; then
(14:47:48) mantiena: pitti: so, should I report a bug against hal package ?
(14:48:43) pitti: mantiena: no need to, I just fixed it in trunk: http://bazaar.launchpad.net/~ubuntu-core-dev/hal/ubuntu/revision/235

Changed in hal:
assignee: nobody → pitti
status: New → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote :

Fixed in Intrepid already.

Changed in hal:
status: Fix Committed → Fix Released
Revision history for this message
Sitsofe Wheeler (sitsofe) wrote :

Can this be reopened for hardy given that it is LTS?

Revision history for this message
Sitsofe Wheeler (sitsofe) wrote :

Ah sorry I didn't notice that it had already been declined for hardy.

Revision history for this message
nathhad (nathhad) wrote :

Clean fix for me too. Perform the changes indicated in M. Pitt's bug fix 235 above.

The file can be found here:
/var/lib/dpkg/info/hal.postinst

The changelog here:
http://bazaar.launchpad.net/~ubuntu-core-dev/hal/ubuntu/revision/235

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.