Ubuntu 16.04 server random reboots

My Ubuntu server reboots itself at random times. At first I suspected automatic updates, even though that would be strange on a fresh server install. I did make sure it was disabled.

I can find nothing in dmesg, syslog or kern.log about the cause.

What's really weird is the entries in "last reboot"

reboot   system boot  4.4.0-21-generic Thu Apr 28 17:06   still running
reboot   system boot  4.4.0-21-generic Mon Apr 25 20:32   still running
reboot   system boot  4.4.0-21-generic Mon Apr 25 20:25 - 20:31  (00:05)
reboot   system boot  4.4.0-21-generic Sat Apr 23 20:40 - 20:31 (1+23:51)
reboot   system boot  4.4.0-21-generic Sat Apr 23 19:16 - 20:39  (01:23)

According to this the previous boot is still running?

Uptime says

 23:10:41 up  6:04,  1 user,  load average: 0,00, 0,01, 0,05

so the server did reboot.

Any ideas?


Solution 1:

If so your system is not crashing, it is rebooting to install an update that requires a reboot.

Automatic reboots are controlled in the file /etc/apt/apt.conf.d/50unattended-upgrades. The line that controls it begins Unattended-Upgrade::Automatic-Reboot and take a true or false value. If you don't allow automatic reboots, you should be notified that a reboot is required when you login.

There are other packages besides unattended-upgrades that can trigger a reboot. They should all invoke apt to do the upgrade. Check /var/log/apt/history.log to see if updates are occurring before the reboot.

If the reboots are occurring at roughly the same time, then there may be something in the crontabs that is causing the reboots.

If the system really is crashing, it may be the BIOS which is rebooting the system. You may want to change the power on state setting.

Commands

  1. dmesg - very useful if the system is still up

Files

  1. /var/log/syslog - System wide logger, use tail /var/log/syslog or less /var/log/syslog
  2. /var/log/kern.log - Kernel log, same as above
  3. /var/log/*

Check cat /proc/sys/kernel/panic, if it's value is 1 then server will immediately reboot on panic. Bad drivers/hw/software can cause kernel panic.

If it's not panic check last issue of reboot, maybe overheating is the issue.

last reboot