I have also tried to let the systemd unit file for this service WantedBy the umount.target.
According to the systemd documentation that should make it run before the filesystems
are unmounted, but apparently that doesn't work. systemctl list-dependencies still shows
that the unattended-upgrade.service reverse depends on the shutdown.target.
I have also tried to let the systemd unit file for this service WantedBy the umount.target. upgrade. service reverse depends on the shutdown.target.
According to the systemd documentation that should make it run before the filesystems
are unmounted, but apparently that doesn't work. systemctl list-dependencies still shows
that the unattended-