Find Why a Linux Server Rebooted

Categories: Documentation · Exported: 2026-04-18 00:47

links:


What this is for

This explains:


1. Check when the server rebooted

who -b uptime

Confirms the last boot time.


2. Check reboot history

last -x | head

What to look for:


3. Check logs from the previous boot

journalctl -b -1

If you see:

No persistent journal was found

It means logs were lost at reboot and the cause cannot be proven from inside the server.


4. Key conclusion when logs are missing

If there are:

Then the reboot was not triggered from the operating system.
It was almost certainly caused by infrastructure (hypervisor, power, maintenance).


5. Enable persistent logs (recommended)

This ensures future reboots leave evidence.

Create log storage

mkdir -p /var/log/journal
chown root:systemd-journal /var/log/journal
chmod 2755 /var/log/journal

Configure limits

Edit:
vi /etc/systemd/journald.conf

Set:

Storage=persistent
SystemMaxUse=500M
SystemKeepFree=1G

Apply:
systemctl restart systemd-journald

Check usage:
journalctl --disk-usage


What this gives you

After this:


Summary

If a server reboots:

This setup removes guesswork.