Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm using CentOS and Red Hat Enterprise Linux on a few machines without the GUI. How can I check if recently installed updates require a reboot? In Ubuntu, I'm used to checking if /var/run/reboot-required is present.

share|improve this question

4 Answers 4

up vote 5 down vote accepted

You could compare the ouput of uname -a with the list of installed kernel packages

share|improve this answer
Is a different kernel the only reason a linux server would need a reboot? –  Chris_K Mar 16 '10 at 15:57
Normally, when staying within the 'normal' package upgrade processes (up2date, yum etc.), there shouldn't be really many other reasons to reboot the system besides the kernel upgrade –  Dominik Mar 19 '10 at 14:35
I suspect that certain other packages may require a reboot eben iof the kernel does not change (when I installed kexec-tools-2.0.0-258 on centos6.0 there was no memory reserved for the dump) –  nhed Aug 29 '13 at 19:25
BeyondTrust's pbis-open package requests the user to reboot after installation via stdout. –  bshacklett Feb 13 at 19:41

About comparing installed kernels with running one:

LAST_KERNEL=$(rpm -q --last kernel | perl -pe 's/^kernel-(\S+).*/$1/' | head -1)
CURRENT_KERNEL=$(uname -r)


Hope that helps!

share|improve this answer
At first I thought this wasn't working as it continued to tell me to reboot after I had, but then found out that if you are using a DigitalOcean instance, you need to manually change the kernel from their control panel first before rebooting. –  Programster Aug 17 '14 at 12:12

Check whether running kernel is the latest one.

If it's not, check whether system was restarted since kernel install.

If it was not, reboot.

CURRENT_KERNEL="$(rpm -q kernel-$(uname -r))"
test -z "$CURRENT_KERNEL" && exit 0     # Current kernel is a custom kernel

LATEST_KERNEL="$(rpm -q kernel | tail -1)"
test -z "$LATEST_KERNEL" && exit 0      # No kernel package installed

LATEST_KERNEL_INSTALLTIME=$(rpm -q kernel --qf "%{INSTALLTIME}\n" | tail -1)
test -z "$LATEST_KERNEL_INSTALLTIME" && exit 1      # Error reading INSTALLTIME

test "$CURRENT_KERNEL" = "$LATEST_KERNEL" && exit 0 # Latest kernel running, no reboot needed

BOOTTIME="$(sed -n '/^btime /s///p' /proc/stat)"
test -z "$BOOTTIME" && exit 1           # Error reading BOOTTIME

test "$LATEST_KERNEL_INSTALLTIME" -lt "$BOOTTIME" && exit 1 # Latest kernel not running, but system was restarted already
                                        # User switched back to an old kernel?

echo reboot
share|improve this answer
This doesn't work if you have a PAE enabled kernel version. The uname -r comamnd returns the PAE suffix after the .elX part but not the rpm names. –  Yanick Girouard Sep 13 '13 at 15:41

install.log install.log.syslog yum.log you check this place what all got new rpm got install

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.