It doesn't relate to "/usr/share/unattended-upgrades/unattended-upgrade-shutdown" file at all. When you "fix" it - it just fails because of the invalid python syntax. And shutdown just works.
The real problem is systemd dependencies. Here is the log of the shutdown process:
Unattended upgrades should be started before filesystem unmount, but it starts after unmount:
[ OK ] Unmounted /home.
[ OK ] Stopped File System Check on /dev/mapper/VG-home.
[ OK ] Unmounted /var.
[ OK ] Stopped File System Check on /dev/mapper/VG-var.
[ OK ] Unmounted /boot.
[ OK ] Stopped File System Check on /dev/mapper/VG-boot.
[ OK ] Removed slice system-systemd\x2dfsck.slice.
[ OK ] Stopped Login to default iSCSI targets.
Stopping iSCSI initiator daemon (iscsid)...
[ OK ] Stopped iSCSI initiator daemon (iscsid).
[ OK ] Stopped target Network is Online.
[ OK ] Stopped target Network.
[ OK ] Stopped Initial cloud-init job (metadata service crawler).
Stopping Raise network interfaces...
[ OK ] Stopped Raise network interfaces.
[ OK ] Stopped target Local File Systems.
Unmounting /run/user/1000...
Starting Unattended Upgrades Shutdown...
[ OK ] Stopped Apply Kernel Variables.
[ OK ] Stopped target Network (Pre).
[ OK ] Stopped Initial cloud-init job (pre-networking).
[ OK ] Stopped Load Kernel Modules.
[ OK ] Unmounted /run/user/1000.
[ OK ] Reached target Unmount All Filesystems.
[ OK ] Stopped target Local File Systems (Pre).
[ OK ] Stopped Create Static Device Nodes in /dev.
Stopping Monitoring of LVM2 mirrors... dmeventd or progress polling...
[ OK ] Stopped Remount Root and Kernel File Systems.
[ OK ] Stopped Monitoring of LVM2 mirrors,...ng dmeventd or progress polling.
Stopping LVM2 metadata daemon...
[ OK ] Stopped LVM2 metadata daemon.
And it is reproducible with LVM only. Have to spend some time on investigation.
It doesn't relate to "/usr/share/ unattended- upgrades/ unattended- upgrade- shutdown" file at all. When you "fix" it - it just fails because of the invalid python syntax. And shutdown just works.
The real problem is systemd dependencies. Here is the log of the shutdown process:
Unattended upgrades should be started before filesystem unmount, but it starts after unmount:
[ OK ] Unmounted /home. VG-home. VG-boot. systemd\ x2dfsck. slice.
[ OK ] Stopped File System Check on /dev/mapper/
[ OK ] Unmounted /var.
[ OK ] Stopped File System Check on /dev/mapper/VG-var.
[ OK ] Unmounted /boot.
[ OK ] Stopped File System Check on /dev/mapper/
[ OK ] Removed slice system-
[ OK ] Stopped Login to default iSCSI targets.
Stopping iSCSI initiator daemon (iscsid)...
[ OK ] Stopped iSCSI initiator daemon (iscsid).
[ OK ] Stopped target Network is Online.
[ OK ] Stopped target Network.
[ OK ] Stopped Initial cloud-init job (metadata service crawler).
Stopping Raise network interfaces...
[ OK ] Stopped Raise network interfaces.
[ OK ] Stopped target Local File Systems.
Unmounting /run/user/1000...
Starting Unattended Upgrades Shutdown...
[ OK ] Stopped Apply Kernel Variables.
[ OK ] Stopped target Network (Pre).
[ OK ] Stopped Initial cloud-init job (pre-networking).
[ OK ] Stopped Load Kernel Modules.
[ OK ] Unmounted /run/user/1000.
[ OK ] Reached target Unmount All Filesystems.
[ OK ] Stopped target Local File Systems (Pre).
[ OK ] Stopped Create Static Device Nodes in /dev.
Stopping Monitoring of LVM2 mirrors... dmeventd or progress polling...
[ OK ] Stopped Remount Root and Kernel File Systems.
[ OK ] Stopped Monitoring of LVM2 mirrors,...ng dmeventd or progress polling.
Stopping LVM2 metadata daemon...
[ OK ] Stopped LVM2 metadata daemon.
And it is reproducible with LVM only. Have to spend some time on investigation.