Linux reboot command: reboot, schedule and verify a server restart
Run sudo reboot. On systemd distributions such as Ubuntu, Debian, RHEL, AlmaLinux and Rocky Linux, it does the same clean reboot as sudo systemctl reboot and sudo shutdown -r now.
To reboot later, use sudo shutdown -r 02:00 or sudo shutdown -r +10, and cancel with sudo shutdown -c. Afterwards, prove the server really restarted: the boot ID in /proc/sys/kernel/random/boot_id must be different.
Which Linux reboot command should I use?
For a normal reboot, any of the first three commands below works. The rest are for scheduling, cancelling and emergencies.
| Command | What it does |
|---|---|
sudo reboot | Clean reboot now: stops services, unmounts filesystems, restarts, and warns logged-in users |
sudo systemctl reboot | The same clean reboot (reboot is a shortcut for it) |
sudo shutdown -r now | The same clean reboot, in the classic syntax |
sudo shutdown -r +10 "message" | Reboots in 10 minutes and sends the message to logged-in users |
sudo shutdown -r 02:00 | Reboots at the next 02:00 in the server's time zone |
sudo shutdown -r | Reboots in 1 minute, not now. No time means +1 |
sudo shutdown --show | Shows a pending reboot or shutdown (systemd 250 and later) |
sudo shutdown -c | Cancels a pending reboot or shutdown |
sudo reboot -f | Forced reboot that skips the clean shutdown. Emergencies only (see below) |
Is systemctl reboot different from reboot?
Not on a systemd distribution. reboot, shutdown, halt and poweroff are compatibility commands that systemd provides. On Ubuntu 24.04 they're links to systemctl itself:
$ ls -l /usr/sbin/reboot /usr/sbin/shutdown /usr/sbin/poweroff /usr/sbin/halt
lrwxrwxrwx 1 root root 16 Oct 12 07:36 /usr/sbin/halt -> ../bin/systemctl
lrwxrwxrwx 1 root root 16 Oct 12 07:36 /usr/sbin/poweroff -> ../bin/systemctl
lrwxrwxrwx 1 root root 16 Oct 12 07:36 /usr/sbin/reboot -> ../bin/systemctl
lrwxrwxrwx 1 root root 16 Oct 12 07:36 /usr/sbin/shutdown -> ../bin/systemctl
Debian 12 and AlmaLinux 9 are the same. systemctl reboot asks systemd to start reboot.target: services stop in order, filesystems are unmounted, and the machine restarts. Two details matter for scripts:
- It returns right away. The command only queues the reboot. A script that reconnects too quickly can still reach the old system while it's shutting down. That's why the boot ID check later on this page matters.
- Inhibitor locks can hold it back. Programs take these locks to protect work in progress, and
systemd-inhibit --listshows them. A “block” lock can stop a reboot you start from a terminal. A “delay” lock only postpones it: 5 seconds by default, raised to 30 seconds by unattended-upgrades on Ubuntu and Debian, which holds this lock:
$ systemd-inhibit --list --no-pager | grep -E '^WHO|shutdown'
WHO UID USER PID COMM WHAT WHY MODE
Unattended Upgrades Shutdown 0 root 932 unattended-upgr shutdown Stop ongoing upgrades or perform upgrades before shutdown delay
systemctl soft-reboot isn't a kernel reboot. It restarts only user space and leaves the kernel running, so a kernel update doesn't take effect. Use a full reboot after kernel updates.
How do I reboot a Linux server over SSH?
sudo reboot # from a shell on the server
ssh web-01 'sudo systemctl reboot' # from your own machine
Your SSH session drops as the server goes down. Wait a minute or two, then reconnect. Before you run it on a busy server:
- Run
whoto see who else is logged in, and warn them withshutdown -r +5 "message"instead of rebooting at once. - Check that a reboot is actually needed (see “How do I know if a reboot is required?” below).
- Make sure the server will come back by itself, and that you can reach its console if it doesn't (see “How do I avoid locking myself out?” below).
If you get Call to Reboot failed: Interactive authentication required, you ran the command as a normal user without sudo. systemd's policy allows that only from an active local session.
How do I schedule a reboot for later?
With shutdown: a time today, or minutes from now
We ran these on a Debian 12 test server at 16:57 UTC:
$ sudo shutdown -r +10 "Kernel update, back in 5 minutes"
Reboot scheduled for Sat 2026-11-14 17:07:51 UTC, use 'shutdown -c' to cancel.
$ sudo shutdown --show
Reboot scheduled for Sat 2026-11-14 17:07:51 UTC, use 'shutdown -c' to cancel.
$ sudo shutdown -c
$ sudo shutdown --show
No scheduled shutdown.
$ sudo shutdown -r 02:00
Reboot scheduled for Sun 2026-11-15 02:00:00 UTC, use 'shutdown -c' to cancel.
Three things to know:
- The time is the server's local time. This server runs on UTC. Check yours with
timedatectl | grep 'Time zone'. - A time that has passed means tomorrow. At 16:57,
02:00was scheduled for the next morning. - Logins stop 5 minutes before. systemd creates
/run/nologin5 minutes before the reboot, and from then on only root can log in. If your admins log in as a normal user and then usesudo, they're locked out for those 5 minutes. Withshutdown -r +4, the file appeared at once:
$ cat /run/nologin
System is going down. Unprivileged users are not permitted to log in anymore. For technical details, see pam_nologin(8).
shutdown -c removed the file again.
With systemd-run: a specific date
shutdown only takes a clock time or a number of minutes. For a reboot on a given date, create a one-off timer. Check the time first with systemd-analyze calendar:
$ systemd-analyze calendar "2026-11-16 02:00"
Original form: 2026-11-16 02:00
Normalized form: 2026-11-16 02:00:00
Next elapse: Mon 2026-11-16 02:00:00 UTC
From now: 1 day 9h left
$ sudo systemd-run --unit=planned-reboot --on-calendar="2026-11-16 02:00" /usr/bin/systemctl reboot
Running timer as unit: planned-reboot.timer
Will run service as unit: planned-reboot.service
$ systemctl list-timers planned-reboot.timer --no-pager
NEXT LEFT LAST PASSED UNIT ACTIVATES
Mon 2026-11-16 02:00:00 UTC 1 day 9h left - - planned-reboot.timer planned-reboot.service
1 timers listed.
Pass --all to see loaded but inactive timers, too.
$ sudo systemctl stop planned-reboot.timer # cancels it
The timer is transient: systemd keeps it under /run/systemd/transient/, which is cleared at boot, so it can't fire twice. shutdown --show doesn't list it; use systemctl list-timers.
With systemctl reboot --when (systemd 254 and later)
Newer systemd versions accept a date directly: sudo systemctl reboot --when="2026-11-16 02:00", with --when=show to see it and --when=cancel to cancel it. Ubuntu 24.04 has systemd 255, so it's available there. Check your version with systemctl --version. Debian 12 and AlmaLinux 9 have systemd 252, and there it fails:
$ sudo systemctl reboot --when="2026-11-16 02:00"
systemctl: unrecognized option '--when=2026-11-16 02:00'
How do I know if a reboot is required?
- Ubuntu and Debian:
/var/run/reboot-requiredexists, and/var/run/reboot-required.pkgsnames the packages that asked for it. On Debian, the hook that writes it ships withunattended-upgrades. - RHEL, AlmaLinux and Rocky Linux:
sudo dnf needs-restarting -rexits with 1 when a reboot is needed and 0 when it isn't. - Any distribution: compare
uname -rwith the newest installed kernel. Our guide to checking the kernel version has a short script for it.
$ cat /var/run/reboot-required.pkgs 2>/dev/null || echo "no reboot needed"
no reboot needed
Kernel updates are the most common reason. Our guide to updating the kernel on Ubuntu covers the update itself and the reboot that has to follow.
How do I check the server came back after a reboot?
When SSH answers again, check that the machine really restarted. These commands are all read-only. The output is from the Debian 12 test server right after the reboot:
$ uptime -s
2026-11-14 16:58:24
$ who -b
system boot 2026-11-14 16:58
$ last -x -w reboot shutdown | head -n 4
reboot system boot 6.1.0-54-amd64 Sat Nov 14 16:58 still running
shutdown system down 6.1.0-54-amd64 Sat Nov 14 16:58 - 16:58 (00:00)
reboot system boot 6.1.0-54-amd64 Sat Nov 14 16:54 - 16:58 (00:03)
shutdown system down 6.1.0-31-amd64 Sat Nov 14 16:54 - 16:54 (00:00)
$ cat /proc/sys/kernel/random/boot_id
66666666-7777-4888-9999-aaaaaaaaaaaa
| Check | What it tells you | Watch out for |
|---|---|---|
uptime -s | When the current boot started | Depends on the clock being right |
who -b | Time of the last boot, to the minute | Same as above |
last -x reboot shutdown | Every boot and clean shutdown, with the kernel each boot ran | A boot whose end time shows crash had no clean shutdown. Debian 13 replaced last with wtmpdb |
journalctl --list-boots | Each boot with its boot ID and first and last log time | Needs a journal kept on disk (/var/log/journal). Our AlmaLinux test server has no /var/log/journal, so after its reboot it listed only the new boot |
/proc/sys/kernel/random/boot_id | A random ID the kernel creates once per boot | Nothing: if it changed, the machine booted again |
Why automation should check the boot ID
The boot ID is the cleanest proof. The kernel generates it the first time it's read after boot and never changes it until the next boot. Unlike a timestamp, it doesn't depend on the clock, and you don't need to guess how long a reboot takes. Read it before, reboot, read it again, and require a different value. This script does exactly that for one server:
#!/bin/sh
# Reboot one server and prove it came back. Usage: sh reboot-verify.sh web-01
host="$1"
before=$(ssh -o BatchMode=yes "$host" cat /proc/sys/kernel/random/boot_id) || exit 1
ssh -o BatchMode=yes "$host" 'sudo systemctl reboot'
sleep 30
after=""
for i in $(seq 1 40); do
after=$(ssh -o BatchMode=yes -o ConnectTimeout=5 "$host" cat /proc/sys/kernel/random/boot_id 2>/dev/null)
[ -n "$after" ] && [ "$after" != "$before" ] && break
sleep 15
done
if [ -n "$after" ] && [ "$after" != "$before" ]; then
echo "rebooted: boot ID $before -> $after"
ssh -o BatchMode=yes "$host" 'uname -r; systemctl is-system-running --wait'
else
echo "NOT CONFIRMED: $host is unreachable or its boot ID did not change" >&2
exit 1
fi
It needs SSH keys and passwordless sudo for the reboot (or run it as root and drop sudo). It reboots at once, without checking who is logged in or giving them notice, so run it in a maintenance window, not from cron on a single server or a database host. It waits up to about 14 minutes. Here is a real run against our Debian 12 test server, which took 47 seconds:
$ sh reboot-verify.sh web-01
rebooted: boot ID 11111111-2222-4333-8444-555555555555 -> 66666666-7777-4888-9999-aaaaaaaaaaaa
6.1.0-54-amd64
degraded
On our AlmaLinux test server, the same script took 46 seconds and printed the new kernel, 5.14.0-687.66.2.el9_8.x86_64, which confirms the reboot also picked up the kernel update. While the old system goes down, ssh may print Connection to web-01 closed by remote host. That's expected.
The last line matters. systemctl is-system-running --wait waits until boot has finished and prints running when every unit started. degraded means the server is up but something failed. On both test servers it was an rc.local startup unit that came with the hosting provider's image:
$ systemctl --failed --no-pager
UNIT LOAD ACTIVE SUB DESCRIPTION
● rc-local.service loaded failed failed /etc/rc.local Compatibility
Treat degraded as a reason to look before you call the reboot done. journalctl -b -u <unit> shows that unit's log for the current boot; see our journalctl guide.
How do I avoid locking myself out?
A reboot that doesn't come back is much harder to fix from a distance. Check these before you reboot:
- Console access. Make sure you can open the provider's web console, serial console or IPMI, and that some account can log in there with a password. SSH keys don't help at a console login prompt.
- SSH starts at boot. On Ubuntu 22.10 and later, SSH is started by a socket unit by default, so a
disabledssh.service is normal there. The socket must be enabled. Debian 12 usesssh.service, and the RHEL family usessshd.service.
$ systemctl is-enabled ssh.socket ssh.service # Ubuntu 24.04
enabled
disabled
- Your services start at boot. A service you started by hand but never enabled stays down after the reboot. Check with
systemctl is-enabled nginx(or your service), and fix it withsudo systemctl enable nginx. Our guide to listing services with systemctl shows how to see them all. /etc/fstabis valid. A bad entry can stop the boot before SSH starts.sudo findmnt --verifychecks it without mounting anything; errors need fixing, warnings are worth reading:
$ sudo findmnt --verify
/
[W] recommended root FS passno is 1 (current is 0)
0 parse errors, 0 errors, 1 warning
- Firewall rules are saved. Rules you added by hand and never saved are gone after a reboot. If the saved rules don't allow SSH, you're locked out.
Why is reboot -f dangerous?
reboot -f doesn't ask systemd to shut anything down. Its manual page warns that in most cases filesystems aren't unmounted properly first, and compares it to systemctl reboot -ff. Databases and any writes still in memory can be lost or left corrupted.
Escalate one step at a time. Use sudo systemctl reboot first. If a stuck service blocks it, sudo systemctl reboot -f skips the orderly service shutdown but still kills all processes and unmounts or remounts filesystems read-only. Keep reboot -f or systemctl reboot -ff for when systemd itself no longer responds.
How we checked this: On 14 Nov 2026 (UTC): a Debian 12.15 test server (systemd 252), where we scheduled, showed and cancelled reboots with shutdown, created and stopped a systemd-run reboot timer, and rebooted with the verify script below; an AlmaLinux test server (systemd 252), rebooted with the same script after an upgrade from 9.6 to 9.8; and an Ubuntu 24.04.5 LTS production server (systemd 255), read-only commands only. systemctl reboot --when (systemd 254 and later) and reboot -f were not run; their behavior comes from the systemd 255 manual pages on manpages.ubuntu.com. Boot IDs in the output are replaced with fake values. Anything we didn't run ourselves comes from the official documentation listed under Sources.
Reboots with an approval step
By default, HostCrust holds a reboot until an approver signs off (your org's policy decides), then checks that the server reports a new boot ID. Every step is kept in a receipt you can export. Free for up to 3 servers.
Check which CVEs are really open on your server
HostCrust Patch Proof compares every installed package with your distribution's own security data. It counts fixes your distro backported and checks the kernel that is actually running, not just the one on disk. Read-only, no root, free.
FAQ
Is sudo reboot the same as restart?
Yes. Linux calls it a reboot, but it's the same as a restart: services stop, filesystems are unmounted, and the machine starts again. sudo reboot, sudo systemctl reboot and sudo shutdown -r now all do it.
How do I shut down a Linux server instead of rebooting it?
Run sudo poweroff, sudo systemctl poweroff or sudo shutdown now. On systemd, shutdown without -r powers off by default. Be careful with halt: it stops the system but leaves the power on. On a remote server, make sure you can power it back on from the provider's panel first.
What does “Call to Reboot failed: Interactive authentication required” mean?
You ran reboot or systemctl reboot as a normal user without sudo. systemd's default policy lets a user reboot without a password only from an active local session. Over SSH it asks for admin authentication, and a non-interactive session can't answer. Run sudo reboot instead.
Does shutdown -r 02:00 use UTC or local time?
The server's local time zone. Check it with timedatectl | grep 'Time zone'. Many servers run on UTC, so 02:00 may not be 2 a.m. where you are. If 02:00 has already passed today, the reboot is scheduled for 02:00 tomorrow.
How do I reboot only when a reboot is required?
On Ubuntu and Debian: [ -f /var/run/reboot-required ] && sudo systemctl reboot. On RHEL, AlmaLinux and Rocky Linux, dnf needs-restarting -r exits with 1 when a reboot is needed, so use sudo dnf needs-restarting -r >/dev/null; [ $? -eq 1 ] && sudo systemctl reboot. Testing for exactly 1 means an error in the check itself doesn't trigger a reboot. These lines reboot at once, whoever is logged in, so don't put them in cron on a single server or a database host; run them in a maintenance window. Also compare uname -r with grubby --default-kernel, because on systems with only kernel-core installed, needs-restarting can miss a new kernel.
Sources
- reboot(8), poweroff and halt manual page, Ubuntu 24.04 (systemd 255)
- shutdown(8) manual page, Ubuntu 24.04 (systemd 255)
- systemctl(1) manual page, Ubuntu 24.04: reboot, --force, --when, --check-inhibitors, is-enabled
- systemd-run(1) manual page, Ubuntu 24.04: --on-calendar
- Linux kernel documentation: /proc/sys/kernel/random/boot_id
- systemd v255 source: how shutdown parses hh:mm (local time, next day if passed)
- systemd v255 source: the polkit policy for logind reboot
- pam_nologin(8) manual page, Ubuntu 24.04
- last(1) manual page, Ubuntu 24.04
- Ubuntu 22.10 release notes: OpenSSH uses systemd socket activation
- systemd-soft-reboot.service(8): the kernel keeps running
- DNF needs-restarting plugin (-r, --reboothint)
- Debian 13 release notes: last, lastb and lastlog have been replaced