I just confirmed that InstallOnShutdown does work, it is triggered by PrepareForShutdown(), not the TERM signal:
balint@yogi:~$ lxc launch ubuntu:cosmic cc-lp-1806463 Creating cc-lp-1806463 Starting cc-lp-1806463 rbalint@yogi:~$ lxc shell cc-lp-1806463 root@cc-lp-1806463:~# apt update ... root@cc-lp-1806463:~# apt install unattended-upgrades ... root@cc-lp-1806463:~# reboot ... # enable InstallOnShutdown: root@cc-lp-1806463:~# vi /etc/apt/apt.conf.d/50unattended-upgrades root@cc-lp-1806463:~# dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Reboot" boolean:false method return time=1543938923.733435 sender=:1.2 -> destination=:1.14 serial=32 reply_serial=2 root@cc-lp-1806463:~# top ... PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 547 root 20 0 257324 86180 49460 S 1.0 0.5 0:02.81 unattended-upgr 567 root 20 0 258132 73168 36236 S 0.0 0.5 0:00.08 unattended-upgr 237 root 20 0 627388 30768 16548 S 0.0 0.2 0:00.34 snapd 233 root 20 0 125852 21016 12980 S 0.0 0.1 0:00.09 unattended-upgr 229 root 20 0 47400 17436 9696 S 0.0 0.1 0:00.09 networkd-dispat 578 root 20 0 18760 11192 2748 D 19.0 0.1 0:00.34 dpkg ... root@cc-lp-1806463:~# Session terminated, terminating shell...logout ...terminated. rbalint@yogi:~$ lxc shell cc-lp-1806463 mesg: ttyname failed: No such device root@cc-lp-1806463:~# cat /var/log/unattended-upgrades/unattended-upgrades unattended-upgrades-dpkg.log unattended-upgrades-shutdown.log unattended-upgrades.log root@cc-lp-1806463:~# cat /var/log/unattended-upgrades/unattended-upgrades-shutdown.log 2018-12-04 15:54:11,587 WARNING - SIGTERM or SIGHUP received, stopping unattended-upgradesonly if it is running 2018-12-04 15:55:23,748 WARNING - Running unattended-upgrades in shutdown mode 2018-12-04 15:55:23,765 WARNING - Unattended-upgrade in progress during shutdown, please don't turn off the computer Progress: 0.0025 % (perl-base,perl-modules-5.26,libperl5.26,perl) 2018-12-04 15:55:26,737 WARNING - Unattended-upgrade in progress during shutdown, please don't turn off the computer Progress: 0.0 % (perl-modules-5.26) 2018-12-04 15:55:29,740 WARNING - Unattended-upgrade in progress during shutdown, please don't turn off the computer Progress: 20.0 % (perl-modules-5.26) 2018-12-04 15:55:32,742 WARNING - Unattended-upgrade in progress during shutdown, please don't turn off the computer Progress: 80.0 % (perl-modules-5.26) 2018-12-04 15:55:35,746 WARNING - Unattended-upgrade in progress during shutdown, please don't turn off the computer Progress: 46.1538 % (perl) 2018-12-04 15:55:38,747 WARNING - Unattended-upgrade in progress during shutdown, please don't turn off the computer Progress: 92.3077 % (perl) 2018-12-04 15:55:41,752 WARNING - Unattended-upgrade in progress during shutdown, please don't turn off the computer Progress: 92.3077 % (perl) 2018-12-04 15:55:41,769 INFO - All upgrades installed For more details please see the /usr/share/doc/unattended-upgrades/NEWS.Debian.gz, the changelog, and LP: #1803137. ** Changed in: unattended-upgrades (Ubuntu) Status: New => Incomplete -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to unattended-upgrades in Ubuntu. https://bugs.launchpad.net/bugs/1806463 Title: Unattended-Upgrade::InstallOnShutdown "true" not working Status in unattended-upgrades package in Ubuntu: Incomplete Bug description: Cosmic, unattended-upgrades 1.5ubuntu3.18.10.0 Trying to get install-on-shutdown working. Added << Unattended- Upgrade::InstallOnShutdown "true"; >> to apt.conf. It appears that the logic for install-on-shutdown is in /usr/share /unattended-upgrades/unattended-upgrade-shutdown. The logic for run- on-shutdown is in UnattendedUpgradesShutdown.try_iter_on_shutdown, which is only called by iter "if not self.stop_signal_received.is_set()". However, since --wait-for-signal is true, it waits for a signal, then the iter says "signal recieved, so skip upgrade": 1. apt.conf: Unattended-Upgrade::InstallOnShutdown "true" (though, unused) 2. unattended-upgrades.service: .../unattended-upgrade-shutdown --wait-for-signal 3. UnattendedUpgradesShutdown.run: signal_handler is installed; wait. 4. UUS.run.signal_handler: stop_signal_received.set(); start_iterations() 5. UUS.start_iterations: scheduler timer to call self.iter 6. UUS.iter: not self.stop_signal_received.is_set() is always False 7. UUS.try_iter_on_shutdown is never called To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/unattended-upgrades/+bug/1806463/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp