Public bug reported:

When using unattended-upgrades with "InstallOnShutdown" on Bionic, the
package installation on various packages hangs until the systemd
ShutdownTimeout (30min) is expired and systemd kills all processes and
powers off/reboots the system.

This leaves packages in an unconfigured, broken state. At least
sometimes this cannot be fixed with a "dpkg --configure -a", but instead
requires the user to manually reinstall the package that caused the
hang.

This appears to be a deadlock, because the hanging commands are always
"systemctl stop ..." or "systemctl restart ...", etc.. If I understand
this correctly, those systemctl commands block because systemd tries to
shutdown the system and tries to satisfy all dependencies for the
shutdown targets before those systemctl commands could get executed,
which creates a deadlock.


Steps to reproduce:

- Install 18.04
- activate "InstallOnShutdown" in /etc/apt/apt.conf.d/50unattended-upgrades
- disable bionic-updates in /etc/apt/sources.list (more on that later)
- execute "unattended-upgrade --download-only"
- reboot the system

-> The upgrade on shutdown hangs when configuring the apport package.
The hanging command is "systemctl stop apport-forward.socket". The
system hangs until it the systemd ShutdownTimeout expires and systemd
forcefully reboots the system.

After the system is rebooted the apport package is in "iHR" state, and
needs to be reinstalled to fix this.


I disabled the bionic-updates pocket in sources.list, because in the
default configuration unattended-updates does not use bionic-updates,
and seems to have skipped installation of apport from bionic-security
(supposedly because an already newer version of apport was in bionic-
updates). If my understanding of why apport initially did not get
installed is correct, then this would be another problem, because it
would mean that unattended-upgrades potentially does not install all
available security updates when bionic-updates is enabled in
sources.list (which is the default).


The problem can also be reproduced without disabling bionic-updates in 
sources.list, but instead enabling bionic-updates in 
/etc/apt/apt.conf.d/50unattended-upgrades. Then, in my case, the upgrade did 
hang when installing the package snapd (the hanging command was "systemctl stop 
snapd.autoimport.service snapd.core-fixup.service snapd.service 
snapd.snap-repair.service snapd.snap-repair.service snapd.socket 
snapd.system-shutdown.service"). This leads to the same problems as described 
above.

** Affects: unattended-upgrades (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: bionic

** Tags added: bionic

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1778219

Title:
  unattended-upgrades hangs on shutdown, leaves system in a broken state

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/unattended-upgrades/+bug/1778219/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to