2

I'm running unattended upgrade at random times on a computer. I have a cron to reboot at a set time daily. If my reboot cron runs in the middle of an update, will it wait to reboot or will it force a reboot in the middle of an install?

1 Answer 1

6

When you run reboot your init system kindly asks running processes to shut down by sending a SIGTERM signal. If they do not shut down within a reasonable amount of time (if you're on a machine using systemd this time defaults to 90 s) the init system will send a SIGKILL signal.

We certainly don't want to kill a busy unattended-upgrades process as this might result in half-installed packages. Knowing that a full run (e.g. installing many updates published on the same day) might take more than 90 s to complete the unattended-upgrades developers bumped up the timeout. On my Ubuntu 20.04 machine I get:

$ grep TimeoutStopSec /usr/lib/systemd/system/unattended-upgrades.service 
TimeoutStopSec=1800

30 minutes should be sufficient even on older machines. If you don't want to wait that long or if you're still concerned your unattended-upgrades run gets interrupted, consider enabling the following parameter in /etc/apt/apt.conf.d/50unattended-upgrades:

// Split the upgrade into the smallest possible chunks so that
// they can be interrupted with SIGTERM. This makes the upgrade
// a bit slower but it has the benefit that shutdown while a upgrade
// is running is possible (with a small delay)
//Unattended-Upgrade::MinimalSteps "true";

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .