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 :
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] Unattended Upgrades Shutdown cies=no shutdown. target reboot.target halt.target network.target local-fs.target man:unattended- upgrade( 8)
Description=
DefaultDependen
Before=
Documentation=
[Service] /usr/share/ unattended- upgrades/ unattended- upgrade- shutdown --debug
Type=oneshot
RemainAfterExit=yes
ExecStop=
TimeoutStopSec=900
[Install] shutdown. target
WantedBy=
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.