Skip to main content

Ubuntu System Restart Required: 5 Safe Reboot Checks

Ubuntu power and restart graphic on a purple background

Ubuntu system restart required means an installed update has requested a reboot before all of its changes can take effect. The notification often follows a kernel or low-level package update. It is a maintenance signal, not proof that the server is broken.

The useful question is what still needs to restart and when you can do it without interrupting users. This guide shows how to check the reboot marker, inspect affected packages, distinguish service restarts from a full reboot, and verify the machine afterward. Commands assume a conventional Ubuntu installation; containers, minimal images and managed systems may behave differently.

1. Check whether Ubuntu has requested a reboot

if [ -f /run/reboot-required ]; then
    printf '%s\n' 'System restart required'
else
    printf '%s\n' 'No reboot-required marker is present'
fi

/var/run/reboot-required is the familiar alternative path; on normal Ubuntu systems, /var/run points to /run. Checking the marker does not need root access. Its absence means no marker is present, rather than a guarantee that every application is using updated code.

If a package list is available, inspect it as well:

if [ -r /run/reboot-required.pkgs ]; then
    sort -u /run/reboot-required.pkgs
fi

This lists packages that registered a reboot request. Do not delete either file to make the warning disappear: removing a notification does not load a new kernel or restart old processes.

2. Check the running kernel and pending service restarts

uname -r
cat /etc/os-release
uptime -s
systemctl --failed

uname -r reports the kernel running now. A newer kernel package can be installed on disk while the previous kernel continues running. Keep that distinction in mind when comparing package versions with the booted system.

If needrestart is installed, request its list-only mode:

sudo needrestart -r l

This reports restart needs without automatically restarting services in that invocation. If the command is missing, install the Ubuntu package through your normal change process. A service restart may be enough for some library updates; it cannot replace a reboot needed to load a different kernel.

APT hooks can still restart services during package upgrades. Ubuntu changed its needrestart integration in 24.04, so check the installed release and configuration before assuming an unattended update cannot interrupt a service.

3. Find the update that triggered the request

sudo tail -n 80 /var/log/apt/history.log
sudo tail -n 80 /var/log/unattended-upgrades/unattended-upgrades.log

The second file exists only when unattended-upgrades has created it. Look for the package names and installation time around the warning. These logs help answer whether a kernel update completed or whether package installation ended with an error. They are a better starting point than rebooting repeatedly.

If an upgrade is still running, let it finish. Do not delete APT lock files or terminate package-management processes just to force the reboot through. Resolve an incomplete update before starting a second update job.

4. Plan a safe Ubuntu server reboot

  • Confirm a recent backup and a recovery or console-access method.
  • Check for active package operations, long-running jobs and connected users.
  • For clustered applications, move traffic and follow the application’s maintenance procedure.
  • Notify affected users and choose the maintenance window.

The following command schedules a reboot in five minutes and broadcasts a message to logged-in users. Run it only when you intend to restart this machine:

sudo shutdown -r +5 "Planned maintenance: system reboot in 5 minutes"

To cancel a pending scheduled shutdown before it occurs:

sudo shutdown -c

The SSH connection will close when the reboot begins. A successful reconnect confirms network access, but it does not by itself prove that the website, database or scheduled jobs recovered.

5. Verify the system after restarting

uname -r
uptime -s
systemctl --failed
journalctl -b -p err --no-pager

Compare the running kernel with the intended kernel, recheck the reboot marker, and verify the application’s health checks, mounts and scheduled tasks. Investigate relevant boot errors instead of assuming every historical log message is a new failure.

If the restart warning returns immediately, inspect recent package activity and the package list again. A new update may have requested another reboot. If Ubuntu fails to boot, use the Ubuntu kernel panic troubleshooting guide rather than repeatedly forcing restarts.

Optional: show a simple reminder in your shell

Ubuntu already supports login notifications through its message-of-the-day system. If you still want a personal Bash reminder, add this block once to your own ~/.bashrc; it does not require a root-only script:

if [ -f /run/reboot-required ]; then
    printf '\n%s\n' 'Reminder: Ubuntu has requested a system restart.'
fi

This runs when that Bash configuration is loaded. It is a convenience for interactive shells, not fleet monitoring. For multiple servers, monitor reboot status centrally and alert on machines that exceed your patching policy.

Frequently asked questions

Does every Ubuntu update require a reboot?

No. Many updates can take effect after the relevant application or service restarts. Kernel and other low-level updates may need a complete system restart. Use the reboot marker and restart diagnostics instead of a blanket rule.

Does Livepatch remove every reboot requirement?

No. Canonical Livepatch applies supported kernel security fixes while the kernel runs, but it does not replace all kernel upgrades, firmware updates or other restart requirements. Follow its status and your maintenance policy.

Should I enable automatic reboots?

That depends on availability requirements. Review Unattended-Upgrade::Automatic-Reboot and the reboot-time options before enabling them. A single personal VM and a production database need different operating procedures.

Official references and related reading

A practical guide for your next challenge. A fresh perspective for everyday life. Discover both through Nandan’s latest articles.

Post Comments

Leave a Reply

Your email address will not be published. Required fields are marked *