Ubuntu and Debian install security updates by themselves once a day. This page shows how to check that it does, how to install all updates by hand, and how to let the server restart automatically when an update needs it. The commands were tested on Ubuntu 26.04 LTS. On a dedicated server freshly installed with Debian 13 we checked that the automatic updates were switched on in the same way. Run the commands as root or with sudo.


Check That It Is Switched On

cat /etc/apt/apt.conf.d/20auto-upgrades

Both lines must end in "1":

APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";

What was installed, and when, is in the log:

tail /var/log/unattended-upgrades/unattended-upgrades.log

Install All Updates Now

The automatic updates install security fixes only. To install everything that is waiting:

apt update
apt upgrade

When a Restart Is Needed

Some updates, such as a new Linux kernel, only take effect after a restart. Ubuntu and Debian then create the file /var/run/reboot-required:

cat /var/run/reboot-required.pkgs

If the file exists, the command lists the packages that need the restart. If it answers No such file or directory, no restart is needed. Restart with reboot at a time that suits you. For a VPS, the Client Area also has Information → Restart (see the VPS Client Area Quick Start Guide); for a dedicated server, see How to Reboot Your Dedicated Server.

Restart Automatically

If you prefer the server to restart by itself when an update needs it, create a small settings file. Here the restart happens at 04:00 server time, and only when an update asked for it:

printf 'Unattended-Upgrade::Automatic-Reboot "true";\nUnattended-Upgrade::Automatic-Reboot-Time "04:00";\n' > /etc/apt/apt.conf.d/52-auto-reboot

Check that the system reads it:

apt-config dump | grep Automatic-Reboot

The time is the server's own time zone, which is UTC after a standard installation. See How to Update the Time on Your Linux Server to change it.

To test the settings without installing anything:

unattended-upgrade --dry-run --debug

To stop the automatic restarts again, delete the file: rm /etc/apt/apt.conf.d/52-auto-reboot.

💡 Programs that must keep running

Make sure your own programs start again after a restart: Keep a Program Running on Linux.


Related Guides

View all Ubuntu and Debian guides

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