Ok, here is how I understand the situation.

According to the systemd documentation about [Unit] Before= :

"Given two units with any ordering dependency between them, if one unit
is shut down and the other is started up, the shutdown is ordered before
the start-up. It doesn't matter if the ordering dependency is After= or
Before=."

To me this means that network.service & local-fs.service will be
shutdown _BEFORE_ unattended-upgrades-shutdown runs, hence /var var will
be unmounted when it runs.

My current solution is to turn the unattended-upgrades.service
ExecStart= into an ExecStop= so the unit will run as a shutdown instead
of a start when the system shuts down :

[Unit]
Description=Unattended Upgrades Shutdown
DefaultDependencies=no
Before=shutdown.target reboot.target halt.target network.target local-fs.target
Documentation=man:unattended-upgrade(8)

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStop=/usr/share/unattended-upgrades/unattended-upgrade-shutdown --debug
TimeoutStopSec=900

[Install]
WantedBy=shutdown.target

Preliminary tests seem to run fine but I want to get confirmation on
such a change by someone more expert with systemd that I am.

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

Title:
  unattended-upgrade-shutdown hangs when /var is a separate filesystem

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

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to