A server rebooted unexpectedly overnight. How do you find out why?
IntermediateTroubleshootingBoot, time, cron and kernel
Answer
Likely causes → Kernel panic, OOM-induced watchdog, hardware fault, power loss, a scheduled automatic update reboot, or someone ran reboot.
Diagnose →
last -x | grep -E 'reboot|shutdown' | head
journalctl --list-boots
journalctl -b -1 -e # end of the previous boot
journalctl -b -1 | grep -Ei 'panic|watchdog|oom|reboot|shutdown'
ls /var/crash/ 2>/dev/null
Check the cloud provider's events and hardware logs (ipmitool sel list).
Fix → Depends on the cause found: clean shutdown messages point to a person or automation; an abrupt end of logs points to panic, power or hardware.
Prevent → Persistent journal, kdump, and monitoring of hardware events.
More on Boot, time, cron and kernel
After a reboot the server drops to `You are in emergency mode. After logging in, type "journalctl -xb" to view system logs`.IntermediateBoot stops at `dracut-initqueue: Warning: dracut-initqueue timeout - starting timeout scripts` and then a `dracut:/#` shell.AdvancedA server shows a `grub>` prompt instead of booting.AdvancedThe kernel panics at boot: `Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)`.AdvancedBoot hangs for 90 seconds with `A start job is running for dev-disk-by\x2duuid-...device (1min 30s)`.IntermediateLogs from different servers are out of order and `timedatectl` shows `System clock synchronized: no` and `NTP service: inactive`.Beginner