Logging into an Ubuntu server or desktop via SSH or local console often presents a MOTD (Message of the Day) banner stating: *** System restart required ***. Even after performing a full system reboot (sudo reboot), logging back into the machine displays the exact same warning. This persistent notification causes administrative confusion, leading system engineers to question whether kernel patches failed to apply or if the server is trapped in an unfinished update cycle.
Resolving this reboot prompt loop requires understanding how Ubuntu tracks reboot requirements, inspecting pending kernel packages, and removing stale reboot-required flag files.
Why Does Ubuntu Show ‘System Restart Required’ Repeatedly?
Ubuntu does not query live kernel memory to display this message; instead, the notification is generated entirely by the presence of a static marker file located at /var/run/reboot-required. The message persists when:
- Unremoved Flag File Following Fast Reboot: The system reboot occurred before package configuration scripts completed unlinking the reboot marker.
- Unattended Upgrades Triggering Instant Re-flags: The
unattended-upgradesservice installed security patches for background daemons immediately following the reboot. - Running an Outdated Kernel: GRUB booted into an older kernel entry because the new kernel package failed to build its initramfs or update GRUB boot entries.
- Shared Libraries Flagged as Requiring Restart: System packages (such as
libc6,dbus, oropenssl) were updated, but the corresponding background daemons were not reloaded.
Step 1: Check What Packages Are Requesting the Reboot
Ubuntu logs which specific package triggered the reboot requirement:
- Open a terminal and inspect the packages listed in the reboot-required directory:
cat /var/run/reboot-required.pkgs - Review the output. Common culprits include:
linux-image-*-generic(New Linux kernel installed)libc6(Core GNU C Library updated)libssl3(OpenSSL cryptography library updated)systemd(Core system and service manager updated)
Step 2: Verify Active Kernel vs Installed Kernel
Confirm whether your running kernel matches the newest installed kernel package:
- Check the currently booted kernel version:
uname -r - List installed kernel images:
dpkg -l | grep linux-image | grep '^ii' - If the version numbers match, the system has already rebooted into the updated kernel cleanly, and the remaining flag file is merely stale. Proceed to Step 4.
- If
uname -rreports an older version than the newest installed image, proceed to Step 3 to fix GRUB boot priority.
Step 3: Update GRUB Bootloader and Initramfs
If GRUB is defaulting to a legacy kernel on boot:
- Rebuild the initramfs for all installed kernels:
sudo update-initramfs -u -k all - Update the GRUB configuration file:
sudo update-grub - Reboot the system:
sudo reboot - Log in again and run
uname -rto verify that the newest kernel is active.
Step 4: Manually Remove the Stale Reboot Flag
If the system is running the latest kernel and services have been restarted, remove the orphaned marker file:
- Delete the reboot-required flag files:
sudo rm -f /var/run/reboot-required sudo rm -f /var/run/reboot-required.pkgs - (Note:
/var/runis a temporary filesystem (tmpfs) that is recreated upon boot; removing these files removes the notification without altering package records.) - Log out and log back in via SSH to confirm that the *** System restart required *** banner is gone.
Step 5: Restart Stale Processes with needrestart
Often a reboot is not necessary if you simply restart the services relying on updated shared libraries:
- Install the
needrestartutility:sudo apt install needrestart - Scan running processes for outdated library mappings:
sudo needrestart - The utility will inspect daemon memory spaces and automatically offer to restart affected services (such as Nginx, Apache, or SSH) without requiring an operating system reboot.