0

I just installed some updated on my Ubuntu server. Some of them were kernel and Linux Headers, so I suspected that a reboot was required, but I wanted to know for sure. So, on foot of a recommendation from this site, I installed checkrestart.

$ checkrestart
ERROR: This program must be run as root in order to obtain information
about all open file descriptors in the system.

$ sudo !!
sudo checkrestart
Found 0 processes using old versions of upgraded files

Hmm. No restart necessary? That seems odd.

$ exit
logout
Connection to example.net closed.

$ ssh trig@example.net && alert
trig@example.net's password: 
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-92-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.


*** System restart required ***

Oh. So a restart is required? Why didn’t you say so?

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"

How can I know whether a restart is required after installing updates?

TRiG
  • 1,181
  • 3
  • 13
  • 30

1 Answers1

2

Because this is not what checkrestart does.

What it essentially does is to check if any processes keep file handles open to old/overwritten libraries etc. and the kernel will be not a part of that list because it isn't a file that processes keep a handle for.

The update process should create a file named /var/run/reboot-required if indeed a reboot is required (see https://askubuntu.com/questions/164/how-can-i-tell-from-the-command-line-whether-the-machine-requires-a-reboot)

Sven
  • 98,649
  • 14
  • 180
  • 226
  • So where does the `*** System restart required ***` message on login come from? *Something* is monitoring whether a reboot is required. And, on Desktop Ubuntu, it notifies you visibly. How can I grab that info in the shell? – TRiG Aug 29 '17 at 13:46
  • @TRiG: See my edit. – Sven Aug 29 '17 at 13:48