I have unattended-upgrade
set up on my Ubuntu systems. Occasionally I will log in remotely to one of them and I'll see a message informing me that I need to reboot the system (in order to complete an upgrade). Is there a way to determine the specific package (or set of packages) which is triggering this notice?
Short version:
Explanation:
Looks like there is an easy way to automatically extract the requested information.
Inside
.deb
files there are control files for installation, includingpostinst
(run after installation).For example, in
linux-image-2.6.35-25-generic_2.6.35-25.44_amd64.deb
,postinst
includesand
The shell script
/usr/share/update-notifier/notify-reboot-required
updates/var/run/reboot-required
and/var/run/reboot-required.pkgs
.The latter file contains a list of packages requesting a reboot.
Reboot is recommended by the
unattended-upgrades
when it sees that a/var/run/reboot-required
exists. The file is created bypostinst
(post-installation) scripts in some packages, it looks something like this:If you want to see which packages triggered this, you can have a look at the contents of the
/var/run/reboot-required.pkgs
file.For more info also see this thread.
Based on Olli's earlier answer, I came up with a method to find all currently installed packages on your system that requires a reboot.
Wait for the download to complete, on my system it was around 900 MB so it might take a while depending on your connection. Then:
The output may look something like this:
Of course, this method is not foolproof. There might be packages that notifies about the required reboot through other means than 'notify-reboot-required', and while this shows which currently installed packages require or doesn't require a reboot, it is not certain the same will hold true for later versions of the same package.
I don't really know if there are other packages that require rebooting, but kernel updates always do. I'd say almost every time I've been "asked" to reboot, the kernel had been updated.