How can I track the cause of random reboots?
A Thinkpad X220 (Core-i5, SandyBridge, Intel GMA) running Precise 64-bit has rebooted hard twice in the last four days. I was doing nothing more than writing an email. No warning. It just went black, and the next thing I saw was the Lenovo boot screen.
Where should I look to find the cause? I fear that this immediate reboot does not leave time for logs to be written...
Thanks!
Solution 1:
Check /proc/sys/kernel/panic
; if its value is 1 then the server will immediately reboot on panic. Buggy drivers can cause a kernel panic.
If it's not a panic check last issue of reboot, maybe overheating is the issue.
last reboot
Solution 2:
Commands
-
dmesg
- May not show items from before last boot, but very useful if the system is still up
Files
-
/var/log/syslog
- System wide logger, usetail /var/log/syslog
orless /var/log/syslog
-
/var/log/kern.log
- Kernel log, same as above /var/log/*
Solution 3:
TL;DR: @insider's answer, along with the comments by @Antonios Hadjigeorgalis led me to find that I had
Unattended-Upgrade::Automatic-Reboot "true"
in
/etc/apt/apt.conf.d/99custom-unattended-upgrades
I was experiencing sudden reboots, mostly soon after turning my laptop on in the morning. I'm running Ubuntu 18.04. Running last reboot
showed that the kernel version was usually newer after the sudden reboots:
reboot system boot 4.15.0-112-gener Wed Jul 22 10:07 still running
reboot system boot 4.15.0-111-gener Wed Jul 22 10:01 - 10:06 (00:04)
...
reboot system boot 4.15.0-111-gener Wed Jul 15 09:49 - 23:43 (13:53)
reboot system boot 4.15.0-109-gener Wed Jul 15 09:45 - 09:48 (00:03)
...
reboot system boot 4.15.0-109-gener Fri Jul 3 09:14 - 17:37 (08:23)
reboot system boot 4.15.0-108-gener Fri Jul 3 09:08 - 09:13 (00:05)
Looking into /etc/apt/apt.conf.d/50unattended-upgrades
, I saw that "Unattended-Upgrade::Automatic-Reboot"
was commented out, and its default is supposedly false. I then ran the following:
grep Reboot /etc/apt/apt.conf.d/*
/etc/apt/apt.conf.d/50unattended-upgrades:Unattended-Upgrade::Automatic-Reboot "false";
/etc/apt/apt.conf.d/50unattended-upgrades://Unattended-Upgrade::Automatic-Reboot-Time "02:00";
/etc/apt/apt.conf.d/99custom-unattended-upgrades:// Reboot automatically if necessary (e.g. on kernel upgrade), should be
/etc/apt/apt.conf.d/99custom-unattended-upgrades:Unattended-Upgrade::Automatic-Reboot "true";
And there was my problem - Unattended-Upgrade::Automatic-Reboot "true";
in /etc/apt/apt.conf.d/99custom-unattended-upgrades
.