The offending process is /usr/lib/accountsservice/accounts-daemon.

I believe this can be worked around in log-output.  However, there are
multiple problems with accountsservice.postinst.  Here's the fragment in
question:

get_pid() {
    [ -n "$1" ] || return 0
    [ -S /var/run/dbus/system_bus_socket ] || return 0

    dbus-send --system --dest=org.freedesktop.DBus --print-reply \
              /org/freedesktop/DBus 
org.freedesktop.DBus.GetConnectionUnixProcessID \
              string:$1 2>/dev/null | awk '/uint32/ {print $2}'
}

if [ "$1" = "configure" ]; then
   # stop accounts-daemon
   pid=$(get_pid org.freedesktop.Accounts)
   kill $pid 2>/dev/null || true

   # restart daemon if it was running before
   [ -z "$pid" ] || /usr/lib/accountsservice/accounts-daemon & >/dev/null || 
true # will trigger through D-Bus activation
fi

I can see the following problems with this:

 1) There is no check that the process ID acquired via dbus-send is in
the same filesystem root.  If it is in a different root,
accountsservice.postinst should leave well alone because the running
executable is not the one that was just modified by unpacking the new
version of accountsservice.  The effect of this bug is that upgrading a
chroot kills the running accounts-daemon in the host system.

 2) "& >/dev/null" is rather mangled shell syntax.  Syntactically, &
separates commands, and redirections are part of a command.  The way
this is written, the redirection is in fact part of a no-op command of
its own, and is equivalent to opening and closing /dev/null without
writing anything to it.  Here's a demonstration of why this doesn't do
what the author thought it did:

      $ echo hello & >x
      [1] 11962
      hello
      $
      [1]+  Done                    echo hello
      $ cat x
      $

    In any case, it should redirect stderr as well as stdout to
/dev/null.  Correct syntax would be:

      [ -z "$pid" ] || /usr/lib/accountsservice/accounts-daemon
>/dev/null 2>&1 & || true # will trigger through D-Bus activation

 3) I'm less sure about this part, but given that it falls back to
expecting accounts-daemon to be started by D-Bus activation, is there
any reason to bother starting it from the postinst at all?  It seems
that perhaps you could simplify this by just deleting that code and
relying entirely on D-Bus activation.


** Also affects: accountsservice (Ubuntu)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to accountsservice in Ubuntu.
https://bugs.launchpad.net/bugs/1021293

Title:
  Ubuntu 12.04 install stalls when doing apt-get upgrade

Status in “accountsservice” package in Ubuntu:
  New
Status in “ubiquity” package in Ubuntu:
  In Progress
Status in “accountsservice” source package in Precise:
  New
Status in “ubiquity” source package in Precise:
  Triaged

Bug description:
  Ubuntu 12.04 release image, this contains Ubiquity 2.10.16, grub-pc
  1.99-21ubuntu3 and initramfs-tools 0.99ubuntu13. The updates install
  grub-pc 1.99-21ubuntu3.1.

  At some point between June 28th and July 3rd, the apt-get upgrade
  process on Precise installations started stalling. We've noticed it
  stops when updating the initrds for new kernels:

  Jul  4 20:43:22 ubuntu in-target: Setting up unity-2d-spread 
(5.12.0-0ubuntu1.1) ...
  Jul  4 20:43:22 ubuntu in-target: Setting up unity-2d (5.12.0-0ubuntu1.1) ...
  Jul  4 20:43:22 ubuntu in-target: Processing triggers for libc-bin ...
  Jul  4 20:43:23 ubuntu in-target: ldconfig deferred processing now taking 
place
  Jul  4 20:43:23 ubuntu in-target: Processing triggers for resolvconf ...
  Jul  4 20:43:23 ubuntu in-target: debconf (developer): frontend started
  Jul  4 20:43:23 ubuntu in-target: debconf: unable to initialize frontend: 
Passthrough
  Jul  4 20:43:23 ubuntu in-target: debconf: (Failed to open fd 3: Bad file 
descriptor at (eval 24) line 3)
  Jul  4 20:43:23 ubuntu in-target: debconf: falling back to frontend: 
Noninteractive
  Jul  4 20:43:23 ubuntu in-target: debconf (developer): frontend running, 
package name is resolvconf
  Jul  4 20:43:23 ubuntu in-target: debconf (developer): starting 
/var/lib/dpkg/info/resolvconf.config configure resolvconf-enable-updates
  Jul  4 20:43:23 ubuntu in-target: debconf (developer): <-- INPUT low 
resolvconf/linkify-resolvconf
  Jul  4 20:43:23 ubuntu in-target: Use of uninitialized value in numeric ge 
(>=) at /usr/share/perl5/Debconf/Priority.pm line 24, <GEN3> line 1.
  Jul  4 20:43:23 ubuntu in-target: debconf (developer): --> 30 question skipped
  Jul  4 20:43:23 ubuntu in-target: debconf (developer): <-- GO 
  Jul  4 20:43:23 ubuntu in-target: debconf (developer): --> 0 ok
  Jul  4 20:43:23 ubuntu in-target: debconf (developer): <-- GET 
resolvconf/linkify-resolvconf
  Jul  4 20:43:23 ubuntu in-target: debconf (developer): --> 0 false
  Jul  4 20:43:23 ubuntu in-target: debconf (developer): <-- INPUT medium 
resolvconf/downup-interfaces
  Jul  4 20:43:23 ubuntu in-target: Use of uninitialized value in numeric ge 
(>=) at /usr/share/perl5/Debconf/Priority.pm line 24, <GEN3> line 4.
  Jul  4 20:43:23 ubuntu in-target: debconf (developer): --> 30 question skipped
  Jul  4 20:43:23 ubuntu in-target: debconf (developer): <-- GO 
  Jul  4 20:43:23 ubuntu in-target: debconf (developer): --> 0 ok
  Jul  4 20:43:23 ubuntu in-target: debconf (developer): starting 
/var/lib/dpkg/info/resolvconf.postinst triggered resolvconf-enable-updates
  Jul  4 20:43:23 ubuntu in-target: debconf (developer): <-- STOP
  Jul  4 20:43:23 ubuntu in-target: invoke-rc.d: policy-rc.d denied execution 
of start.
  Jul  4 20:43:23 ubuntu in-target: Processing triggers for initramfs-tools ...
  Jul  4 20:43:24 ubuntu in-target: update-initramfs: Generating 
/boot/initrd.img-3.5.0-3-generic
  Jul  4 21:17:01 ubuntu CRON[989]: (root) CMD (   cd / && run-parts --report 
/etc/cron.hourly)

  After the last update-initramfs line it stalls forever (notice the
  timestamp for that command and the following CRON one).

  Steps to reproduce (on any machine, this doesn't seem to be hardware-
  specific):

  - Create a nice Ubuntu 12.04 USB stick using USB disk creator (do NOT simply 
dd the hybrid image onto the USB stick, as you will need to write files to it 
later).
  - Put the attached preseed in the USB stick's preseeds directory, name it 
ubuntu.seed (overwriting the existing file there).
  - Edit syslinux/txt.cfg, go to the second "append" line containing kernel 
parameters for the "install ubuntu" menu option (line 9 in the file), and right 
after "only-ubiquity", add a space and "automatic-ubiquity".
  - Boot a test system with this USB stick
  - Select the "install ubuntu" option

  Expected result:
  - System installs ubuntu completely, prompts to reboot and boots into a 
complete installation

  Actual result:
  - System will stall forever
  - Log shows as seen above.

  The main addition to the preseed is the late_command:

  ubiquity ubiquity/success_command string \
  for i in /dev /dev/pts /dev/shm /sys /sys/kernel/security /proc /cdrom; do 
mount --bind $i /      target/$i; done; \
    sed -i -e "/^GRUB_CMDLINE_LINUX_DEFAULT/s/\"$/ initcall_debug\"/" 
/target/etc/default/grub;     chroot /target update-grub; \
    echo "echo 0 > /sys/module/kernel/parameters/initcall_debug" > 
/target/etc/initramfs-tools/conf.d/initcall; chroot /target update-initramfs 
-u; \
    for i in /dev/pts /dev/shm /dev /sys/kernel/security /sys /proc /cdrom; do 
umount $i; done; \
    in-target apt-get update; \
    in-target apt-get upgrade -y --force-yes; \
    true

  Note this late_command basically just apt-get updates and upgrades.
  The first few lines are apparently needed if some of the later updates
  include a kernel update; without the mounts, the implicit update-grub
  in /target will fail.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/accountsservice/+bug/1021293/+subscriptions

-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : desktop-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to