A program you left running is gone, or your SSH session was closed: the first thing to check is whether the server restarted. Linux keeps the log of every run of the server, and the end of a run shows whether it was a normal restart, and often who asked for it. This guide shows how to read it and how to tell a planned restart from a crash, a power cut or a forced restart from outside.

The examples use Ubuntu 26.04 LTS. Run the commands as root, or put sudo in front of them.


1. When Did the Server Start Last

uptime -s
2026-12-02 02:47:54

uptime without -s shows how long the server has been running since then.

2. The List of Runs

journalctl --list-boots
IDX BOOT ID                          FIRST ENTRY                 LAST ENTRY
 -3 6eec18fd81c44a8cb7946ef6981a00cb Sat 2026-11-28 14:44:20 UTC Wed 2026-12-02 02:37:25 UTC
 -2 6afbd770e3d5415bbd45eea79d58c09b Wed 2026-12-02 02:39:45 UTC Wed 2026-12-02 02:42:00 UTC
 -1 700513a361e546dd84983ab857eb61cb Wed 2026-12-02 02:44:20 UTC Wed 2026-12-02 02:45:23 UTC
  0 54ab0568f8db49d6a118b7d4a05294fb Wed 2026-12-02 02:47:54 UTC Wed 2026-12-02 02:48:47 UTC

Each line is one run of the server, from its first log line to its last. 0 is the current run, -1 the one before it, and so on. The gap between LAST ENTRY of one line and FIRST ENTRY of the next is the time the server was down. Two to three minutes are a normal restart of a dedicated server, which checks its hardware before it starts.

In the next steps, put the number of the run you want to look at after -b.

3. How a Run Ended

Look at the last line of the run:

journalctl -b -2 -n 1
Dec 02 02:42:00 server01 systemd-journald[849]: Journal stopped

Journal stopped means that Linux shut down in order: it stopped the programs, saved everything to the disks and then restarted or switched off. Step 4 shows who asked for it.

Any other last line means that the run ended without a shutdown. Step 5 is about that.

4. Who or What Asked for the Restart

journalctl -b -2 -g "System is (rebooting|powering down)|nologin"
Dec 02 02:40:56 server01 systemd-logind[1642]: Creating /run/nologin, blocking further logins...
Dec 02 02:41:56 server01 systemd-logind[1642]: System is rebooting (Kernel update).
  • System is rebooting: a person or a program ran reboot, shutdown -r or systemctl reboot. Text in brackets is the note that was given to shutdown.
  • System is powering down: the server was switched off with poweroff or shutdown, and somebody started it again later.
  • Creating /run/nologin: the restart was planned in advance with shutdown and a time. From that moment, users other than root could no longer log in.
  • -- No entries --: nobody asked. The run ended without a shutdown (step 5).

To see who was logged in shortly before, show the last login of that run:

journalctl -b -2 -u ssh -g Accepted -n 1
Dec 02 02:41:48 server01 sshd-session[2725]: Accepted publickey for root from 203.0.113.25 port 50000 ssh2: ED25519 SHA256:fs91ds0KPGDbQZJrgaKlFqqxV9ToFsCviTpAJD8Oxyz

More about these lines: Who Logged In to Your Linux Server? Check Logins and Failed Attempts.

Ubuntu does not restart by itself after updates unless you turned that on. This prints the setting, or nothing when it is off:

apt-config dump | grep Automatic-Reboot

See Automatic Security Updates on Ubuntu and Debian.

💡 Leave a note for later

When you restart the server, say why. The note is written into the log, as in the example above. This restarts the server in one minute; shutdown -c cancels it:

shutdown -r +1 "Kernel update"

5. A Stop Without a Shutdown

When a run ended without a shutdown, its log simply breaks off. The last lines are ordinary messages of whatever the server was doing at that moment:

journalctl -b -1 -n 3
Dec 02 02:45:18 server01 sshd-session[2300]: pam_unix(sshd:session): session opened for user root(uid=0) by root(uid=0)
Dec 02 02:45:18 server01 systemd-logind[1659]: New session '7' of user 'root' with class 'user' and type 'tty'.
Dec 02 02:45:18 server01 systemd[1]: Started session-7.scope - Session 7 of User root.

The run after it notes at its start that the log was not closed properly. The line ends with corrupted or uncleanly shut down, renaming and replacing:

journalctl -b 0 -g "uncleanly shut down"
Dec 02 02:48:03 server01 systemd-journald[848]: File /var/log/journal/4c1f0e6a9d2b47c8a35f7e1b2d9c6a04/system.journal corrupted or uncleanly shut down, renaming and replacing.

The time of the last line before the break is the moment the server stopped, to within a few minutes. There are three usual causes:

  • The server was restarted or switched off from outside Linux: with the Restart or Stop button of your service in the Client Area, or with the power controls of the remote management. These switch the power and do not shut Linux down first, see How to Reboot Your Dedicated Server. Check first whether it was you.
  • The kernel crashed. Ubuntu 26.04 saves a crash report: ls /var/crash then shows a folder named after the date and time of the crash.
  • The power was interrupted, or the server stopped because of a hardware fault. The hardware keeps its own list of events: Check Temperatures, Fans and Hardware Events of Your Server.

Errors of the kernel in the run that broke off, for example of a disk or the memory, are shown by:

journalctl -b -1 -k -p err

Compare with a run that ended normally, for example journalctl -b -2 -k -p err. Lines that appear at the start of every run, such as Firmware Bug, are not the cause.

6. What to Do

What you foundWhat to do
The server restarts after updates at a bad timeChoose the time of the automatic restart, or switch it off and restart on a day you choose: Automatic Security Updates on Ubuntu and Debian.
A restart by a user, and it was not youCheck who logged in and change the passwords: Who Logged In to Your Linux Server? Check Logins and Failed Attempts.
Your programs are not running after a restartMake them start with the server: Keep a Program Running on Linux.
One stop without a shutdown, and the server worksNothing, if you used the buttons in the Client Area at that time. Otherwise note the time and watch whether it happens again.
Stops without a shutdown that repeat, or a crash reportOpen a support ticket with the list from step 2 and the last lines from step 5, so that we can check the hardware.

Good to Know

Was this answer helpful? 0 Users Found This Useful (0 Votes)