How To Check Whether A Reboot Is Required After Updates in Ubuntu

How To Check Whether A Reboot Is Required After Updates in Ubuntu

Wouldn't it be cool to know whether a reboot is needed after installing updates on your Ubuntu Server without having to log in again to check the Message of the Day (MOTD) to see?

You can find out by checking for the presense of a particular file.

If the file /var/run/reboot-required is present, you should reboot your server to make new settings since a previous update take effect. You could run ls /var/run | grep reboot to see if the file is listed in the output.

Reboot-not-needed

To see which updates require reboot, look in /var/run/reboot-required.dpkgs. You could run sudo cat /var/run/reboot-required.dpkgs and read the output to understand which recently installed packages require rebooting to take effect.Blog-what-packages-require-reboot

Blog-pkg-that-needs-rebooting

/* Adding copy button to code snippet in Ghost https://forum.ghost.org/t/how-do-i-add-a-copy-button-to-a-code-snippet/34586 */