Skip to content
Deploy

Server updates

How to turn on automatic security updates on Ubuntu, Debian and AlmaLinux

Ubuntu installs security updates by itself, Debian needs the same package and one dpkg-reconfigure command, and AlmaLinux needs dnf-automatic. The exact files and options from each project's documentation, a reboot policy, and how to check that updates really ran.

RyzenRDP guide cover: automatic security updates on Ubuntu, Debian and AlmaLinux

Key takeaways

  • Ubuntu does it by default. Ubuntu Server ships unattended-upgrades switched on: it installs security updates once a day. The switch is /etc/apt/apt.conf.d/20auto-upgrades.
  • Debian uses the same package: install it and run sudo dpkg-reconfigure unattended-upgrades. AlmaLinux uses dnf-automatic with upgrade_type = security and apply_updates = yes.
  • None of them reboots by default. A new kernel waits for a reboot until you allow one with Automatic-Reboot (apt) or reboot = when-needed (dnf), set for a quiet hour.
  • Check that it ran: sudo unattended-upgrade -v --dry-run and /var/log/unattended-upgrades/ on Ubuntu and Debian, the journal and dnf history on AlmaLinux.
On this page
  1. Short answer
  2. Ubuntu, Debian and AlmaLinux at a glance
  3. Are automatic security updates on by default on Ubuntu?
  4. How do I turn on unattended-upgrades on Ubuntu?
  5. How do I turn on automatic updates on Debian?
  6. How do I turn on automatic updates on AlmaLinux? (dnf-automatic)
  7. Should the server reboot by itself after updates?
  8. How do I check that updates ran?
  9. What should not update automatically?
  10. Have it done: Care for Linux

Short answer

On Ubuntu, automatic security updates come from the unattended-upgrades package. Ubuntu's server documentation says it is installed by default and installs security updates once a day, and it never reboots the server unless you allow it. On Debian you install the same package and switch it on with sudo dpkg-reconfigure unattended-upgrades. On AlmaLinux the equivalent is dnf-automatic: set upgrade_type = security and apply_updates = yes in /etc/dnf/automatic.conf and enable its timer.

Two decisions remain on every distribution: whether the server may reboot by itself, and how you check that the updates really ran. Both are below. The changes need root, which you have over SSH on a RyzenRDP Linux VPS, whether it runs as an Ubuntu VPS, a Debian VPS or an AlmaLinux VPS.

Ubuntu, Debian and AlmaLinux at a glance

Ubuntu Debian AlmaLinux 9
Tool unattended-upgrades unattended-upgrades dnf-automatic
Installed by default Yes on Ubuntu Server, per Ubuntu's docs Usually, per the Debian wiki: check Install the dnf-automatic package
On/off switch /etc/apt/apt.conf.d/20auto-upgrades The same two APT::Periodic settings A systemd timer, plus apply_updates in /etc/dnf/automatic.conf
What it installs by default Security updates, and ESM where available Security updates and updates to the stable release Nothing until apply_updates = yes, then all updates unless upgrade_type = security
Reboots by default No No No
Where to look afterwards /var/log/unattended-upgrades/ /var/log/unattended-upgrades/ and /var/log/dpkg.log The journal and dnf history

Are automatic security updates on by default on Ubuntu?

Yes, on Ubuntu Server. Ubuntu's documentation says unattended-upgrades is installed by default, runs once a day, and has security updates switched on from the moment the system is installed, including Extended Security Maintenance (ESM) updates where available. Ubuntu's security documentation says the same for Ubuntu 18.04 LTS and later.

A provider's image can differ from a standard install, so check instead of assuming. These two commands change nothing:

apt-config dump | grep Periodic
systemctl status apt-daily-upgrade.timer

If the first shows APT::Periodic::Unattended-Upgrade "1"; and the timer is active, automatic updates are on. If the line is missing or shows "0", they are off.

How do I turn on unattended-upgrades on Ubuntu?

  1. Install the package. If it is already there, apt says so and changes nothing.

    sudo apt update
    sudo apt install unattended-upgrades
    
  2. Switch it on. Ubuntu's security documentation uses this command; answer Yes when it asks whether to download and install stable updates automatically.

    sudo dpkg-reconfigure unattended-upgrades
    

    The setting lives in /etc/apt/apt.conf.d/20auto-upgrades, and you can also write it by hand. Each value is a number of days: 1 runs the action daily and 0 turns it off.

    APT::Periodic::Update-Package-Lists "1";
    APT::Periodic::Unattended-Upgrade "1";
    
  3. Check what it installs. The options are in /etc/apt/apt.conf.d/50unattended-upgrades. By default its Allowed-Origins list takes the security pocket and ESM, and leaves -updates, -proposed and -backports commented out:

    Unattended-Upgrade::Allowed-Origins {
        "${distro_id}:${distro_codename}";
        "${distro_id}:${distro_codename}-security";
        "${distro_id}ESMApps:${distro_codename}-apps-security";
        "${distro_id}ESM:${distro_codename}-infra-security";
    //  "${distro_id}:${distro_codename}-updates";
    //  "${distro_id}:${distro_codename}-proposed";
    //  "${distro_id}:${distro_codename}-backports";
    };
    
  4. Put your changes in a file of your own. Ubuntu's security documentation advises against editing 50unattended-upgrades and suggests a higher-numbered file, so a new version of the package does not clash with your edits. The upstream README names it /etc/apt/apt.conf.d/52unattended-upgrades-local. A list in your file is added to the default list, so to take normal bug-fix updates as well, that file needs only:

    Unattended-Upgrade::Allowed-Origins {
        "${distro_id}:${distro_codename}-updates";
    };
    

    Because your lines are added to the defaults, a file of your own can only widen the list. To narrow it, start the file with #clear Unattended-Upgrade::Allowed-Origins; and then list every origin you want, including the security pocket. The unattended-upgrades README shows this for Origins-Pattern, and apt's own manual says #clear is the only way to delete a list.

  5. Test it with a dry run, which changes nothing:

    sudo unattended-upgrade -v --dry-run
    

Packages from a PPA or another third-party repository are not included until you add that repository's origin.

How do I turn on automatic updates on Debian?

Debian uses the same package. The Debian wiki says most Debian versions install it with conservative settings, but it can be missing or switched off, so run:

sudo apt update
sudo apt install unattended-upgrades
sudo dpkg-reconfigure unattended-upgrades

Answer Yes to automatically download and install stable updates. That turns on the same two APT::Periodic settings as on Ubuntu, and apt-config dump | grep Periodic shows them.

Debian's default file uses Origins-Pattern instead of Allowed-Origins. Its active lines match the security archive and the stable release itself, while the -updates and backports lines stay commented out, so you get security updates and updates to the stable release:

Unattended-Upgrade::Origins-Pattern {
        "origin=Debian,codename=${distro_codename},label=Debian";
        "origin=Debian,codename=${distro_codename},label=Debian-Security";
        "origin=Debian,codename=${distro_codename}-security,label=Debian-Security";
};

Because the lines match on the release's codename, unattended-upgrades never moves the server to the next Debian release. Put your own changes in /etc/apt/apt.conf.d/52unattended-upgrades-local, as on Ubuntu; to narrow the list there, start with #clear Unattended-Upgrade::Origins-Pattern;.

To see what would happen without installing anything, use the README's sudo unattended-upgrade --dry-run --debug. The Debian wiki's sudo unattended-upgrade -d is a real run with debug output, so it installs.

The daily runs come from two systemd timers: apt-daily.timer downloads and apt-daily-upgrade.timer installs. To move the install time, override the install timer, clearing the default schedule first. The Debian wiki shows these lines for the download timer; they work the same on the install timer:

sudo systemctl edit apt-daily-upgrade.timer
[Timer]
OnCalendar=
OnCalendar=03:00

The shipped install timer also keeps a random delay of up to 60 minutes (RandomizedDelaySec=60m), so this run starts between 03:00 and 04:00. Add RandomizedDelaySec=0 under [Timer] if it must start at exactly 03:00, as the Debian wiki's example notes. systemctl cat apt-daily-upgrade.timer shows the shipped settings and your override. The same works on Ubuntu, which also uses these two timers.

How do I turn on automatic updates on AlmaLinux? (dnf-automatic)

AlmaLinux, like Red Hat Enterprise Linux, has no unattended-upgrades. Its equivalent is dnf-automatic, which DNF's documentation describes as an alternative to dnf upgrade made to run automatically. The steps below are written for AlmaLinux 9; AlmaLinux 8 and 10 use the same ones, except for the automatic reboot option covered in the reboot section.

  1. Install it:

    sudo dnf install dnf-automatic
    
  2. Edit /etc/dnf/automatic.conf. As shipped, it downloads updates but does not install them (download_updates = yes, apply_updates = no) and looks at all updates (upgrade_type = default). For security updates installed automatically, set in the [commands] section:

    [commands]
    upgrade_type = security
    download_updates = yes
    apply_updates = yes
    

    security means only updates with an issued security advisory. AlmaLinux publishes these as ALSA advisories in its repositories' update metadata, and dnf updateinfo --list shows the advisories for your server.

  3. Enable the timer that follows this file:

    sudo systemctl enable --now dnf-automatic.timer
    

dnf-automatic comes with four timers. Enable one, not several:

Timer What it does
dnf-automatic.timer Does what /etc/dnf/automatic.conf says about downloading and installing
dnf-automatic-notifyonly.timer Only reports available updates, whatever the file says
dnf-automatic-download.timer Downloads updates without installing them
dnf-automatic-install.timer Downloads and installs updates

By DNF's documentation, the timers add a random delay of up to an hour.

Should the server reboot by itself after updates?

Updated libraries and services take effect when the service restarts. Since Ubuntu 24.04 LTS, needrestart restarts affected services automatically by default. A new kernel, though, only runs after a reboot. On Ubuntu and Debian the file /var/run/reboot-required appears when an update needs one; on AlmaLinux, dnf needs-restarting -r tells you. None of the three tools reboots by default, so decide:

Your server Setting What to know
Everything on it starts by itself at boot (a web server, a bot or a game server run by systemd), and a short break at night is fine Automatic reboot at a fixed quiet hour The time is the server's own time zone; timedatectl shows it
Runs long jobs, or an app you start by hand No automatic reboot Check for a pending reboot each week and reboot when it suits you
Has users or players at all hours No automatic reboot, or one fixed weekly time you announce The reboot ends every session on the server

Ubuntu and Debian. Add to 52unattended-upgrades-local:

Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-Time "02:00";

With Automatic-Reboot on, the server reboots without confirmation when /var/run/reboot-required exists after an upgrade. Without a time, it reboots at once. Automatic-Reboot-WithUsers defaults to "true", so the reboot goes ahead even when someone is signed in over SSH. The time is passed to shutdown -r, so if 02:00 has already passed when the run ends, as it has after the default 06:00 run, the reboot waits until 02:00 the next night.

On Ubuntu, Canonical's Livepatch service, part of Ubuntu Pro (free for up to 5 machines for personal use), applies fixes for critical and high severity kernel vulnerabilities without a reboot once you attach the server with sudo pro attach and run sudo pro enable livepatch. It is not switched on by itself, and Canonical says it does not replace rebooting.

AlmaLinux. Add to the [commands] section of /etc/dnf/automatic.conf:

reboot = when-needed

when-needed reboots only when an installed update needs it, when-changed after any change, and the default is never. The default reboot command, shutdown -r +5, gives five minutes' notice. The reboot follows the install run, so move dnf-automatic.timer to a quiet hour with sudo systemctl edit dnf-automatic.timer and the same [Timer] lines as above (dnf-automatic.timer has the same random delay of up to an hour).

The reboot option needs dnf-automatic 4.14.0-8.el9 or later (AlmaLinux 9.3 onward; check with rpm -q dnf-automatic) or AlmaLinux 10. Red Hat added it to RHEL 9 in November 2023 (erratum RHBA-2023:6645). A file you already edited is kept when the package updates (the new one is saved as automatic.conf.rpmnew), so add the line yourself. On AlmaLinux 8, dnf-automatic has no reboot option: reboot by hand when dnf needs-restarting -r exits with code 1.

How do I check that updates ran?

Automatic updates can fail quietly: a full disk, an unreachable repository or a package held back for a prompt shows up only in the logs. Look once after the first night, then make it a weekly habit.

Ubuntu and Debian:

# What would be installed now (changes nothing)
sudo unattended-upgrade -v --dry-run

# What the automatic runs did
sudo tail -n 40 /var/log/unattended-upgrades/unattended-upgrades.log
sudo tail -n 40 /var/log/unattended-upgrades/unattended-upgrades-dpkg.log

# When the next run is due
systemctl status apt-daily-upgrade.timer

# Is a reboot waiting? (no such file = no)
ls /var/run/reboot-required

unattended-upgrades.log records each run, including packages kept back, and unattended-upgrades-dpkg.log holds the installs themselves. /var/log/dpkg.log lists every package change, automatic or not.

AlmaLinux:

systemctl status dnf-automatic.timer
sudo journalctl -u dnf-automatic.service
sudo dnf history
sudo dnf needs-restarting -r

The shipped configuration sends dnf-automatic's report to standard output (emit_via = stdio), which systemd keeps in the journal. dnf history lists every transaction. dnf needs-restarting -r comes from the dnf-plugins-core package and exits with code 1 when a reboot is needed.

Both tools can also send an email report (Unattended-Upgrade::Mail, or emit_via = email), but only if the server has a working mail setup.

What should not update automatically?

  • Software outside the package manager. unattended-upgrades and dnf-automatic only update packages from your configured repositories. Containers, language packages from pip or npm, and apps you installed from an archive need their own update routine.

  • Packages you want to update by hand, for example a database server. On Ubuntu and Debian, list them in 52unattended-upgrades-local as Python regular expressions. Ubuntu's documentation suggests this over turning automatic updates off. A package that depends on a listed one is not upgraded either.

    Unattended-Upgrade::Package-Blacklist {
        "mariadb-server";
    };
    

    On AlmaLinux, add excludepkgs to the [base] section of /etc/dnf/automatic.conf, which overrides dnf.conf for dnf-automatic only:

    [base]
    excludepkgs = mariadb*
    

    Exclude every package of that product: the glob above also matches mariadb-common, mariadb-errmsg and the client library mariadb-connector-c. On AlmaLinux, mariadb-server needs the same version of mariadb-common and mariadb-errmsg, and DNF is set to best=True in /etc/dnf/dnf.conf, so a partial exclude can make dnf-automatic stop the whole run, security updates included. Look for "filtered out by exclude filtering" in journalctl -u dnf-automatic.service.

  • Configuration files you edited. unattended-upgrades holds back any package whose update would ask about a changed configuration file, so read the log for packages it kept back and update those by hand.

  • New releases. Neither tool moves a server to a new release, such as Ubuntu 22.04 to 24.04, Debian 12 to 13 or AlmaLinux 9 to 10. That stays a planned job.

  • Third-party repositories you do not control. Adding one to the allowed origins installs whatever its owner publishes, every day, without you reading it first. On AlmaLinux there is no such list: dnf-automatic updates packages from every enabled repository, third-party ones included. With upgrade_type = security it takes only updates that have a security advisory, so a repository that publishes no advisories gets none. To keep a repository's packages out, exclude them with excludepkgs or disable that repository.

Have it done: Care for Linux

Everything above is free to set up yourself. What none of these tools does is check that SSH and your main service are back after the reboot. If your server runs at RyzenRDP, Care for Linux handles Linux patch management for you for $19 a month:

  • our script installs the updates from every package repository on your server, including a third-party one, in a monthly window you pick, except packages on our hold list and packages you ask us to skip in the Care ticket (for example a database server), and restarts the server when an update needs it;
  • it checks on the server itself that SSH answers, and restarts one service you name once if it has not started;
  • our team reads the result of every window, and you get a monthly report of what was installed and how each check went.

Care keeps to that scope. It includes no backups or snapshots, so keep copies of your data elsewhere; it does not configure, fix or support your own apps; it does not watch the server outside your window; and admin time is not included on Linux. It covers RyzenRDP servers only.

Care works through a named account for our team, with sudo and our SSH key, which you create when Care starts and which is removed when Care ends. We install nothing until you choose your window and agree to the standing consent in the Care ticket.

Care updates once a month, while unattended-upgrades and dnf-automatic install security updates every day. While Care is active, the server's own automatic updates are set to wait for your window, and the setting is put back when Care ends. If you would rather keep daily security updates as well, say so in the Care ticket and we leave your setting as it is. Daily updates then work by their own rules, so a package on our hold list, or one you asked us to skip, can still install outside your window unless you also list it in your own Package-Blacklist or excludepkgs.

Add Care when you deploy a Linux server, or ask for it on a server you already have with a ticket of the type "Billing and accounts". You can cancel it at any time the same way.

FAQ

Is unattended-upgrades installed by default on Ubuntu Server?

Yes. Ubuntu's documentation says unattended-upgrades is installed by default on Ubuntu Server and installs security updates once a day. A provider's image can differ, so check: if apt-config dump | grep Periodic shows APT::Periodic::Unattended-Upgrade "1";, it is on.

Does unattended-upgrades install all updates or only security updates?

On Ubuntu, only security updates by default, plus Extended Security Maintenance (ESM) updates where available: the -updates line in /etc/apt/apt.conf.d/50unattended-upgrades is commented out. On Debian the default also takes updates to the stable release itself. Lines you add in your own file, such as 52unattended-upgrades-local, are allowed on top of the defaults, so they can only widen the list. To narrow it, start that file with #clear Unattended-Upgrade::Allowed-Origins; (on Debian #clear Unattended-Upgrade::Origins-Pattern;) and then list every origin you want, as the unattended-upgrades README shows.

Should my Linux VPS install updates and reboot automatically?

Install security updates automatically on almost every server. Reboot automatically only if everything you run starts by itself at boot and a short break at a fixed quiet hour is acceptable. Otherwise leave automatic reboots off and reboot by hand when /var/run/reboot-required appears (Ubuntu and Debian) or dnf needs-restarting -r says a reboot is needed (AlmaLinux).

Will my server reboot by itself after updates?

Not by default. unattended-upgrades ships with Automatic-Reboot "false" and dnf-automatic with reboot = never. Set Automatic-Reboot "true" with an Automatic-Reboot-Time, or reboot = when-needed, if you want the server to restart itself when an update such as a new kernel needs it.

How do I test unattended-upgrades?

Run sudo unattended-upgrade -v --dry-run. It shows what would be installed now and changes nothing. Add --debug to see why a package is kept back.

Where are the unattended-upgrades logs?

In /var/log/unattended-upgrades/: unattended-upgrades.log records each run and unattended-upgrades-dpkg.log the package installs. /var/log/dpkg.log also lists every package change.

What is the AlmaLinux equivalent of unattended-upgrades?

dnf-automatic. Install it with sudo dnf install dnf-automatic, set upgrade_type = security and apply_updates = yes in the [commands] section of /etc/dnf/automatic.conf, then run sudo systemctl enable --now dnf-automatic.timer.

Can you keep my Linux VPS patched for me?

Yes, on a RyzenRDP server. Care for Linux, $19 a month, handles Linux patch management for you: it installs the updates from your server's package repositories in a monthly window you pick, except packages on our hold list and packages you ask us to skip, checks on the server itself that SSH answers after the reboot, restarts one service you name once if it has not started, and sends a monthly report. It includes no backups or snapshots and no support for your own apps. See Care.

Sources

  1. Ubuntu Server documentation: Automatic updates (installed by default, daily runs, 20auto-upgrades, Allowed-Origins, reboot options, dry run, logs, needrestart on 24.04, block-listing)
  2. Ubuntu security documentation: Security updates (dpkg-reconfigure, drop-in files instead of editing 50unattended-upgrades, third-party repositories, Livepatch)
  3. Debian Wiki: PeriodicUpdates, formerly UnattendedUpgrades (install and check, 52unattended-upgrades-local, manual run, log files, systemd timer override with RandomizedDelaySec; last modified 10 July 2026)
  4. unattended-upgrades on GitHub: README and the Debian default configuration (Origins-Pattern, #clear before a narrower list, Package-Blacklist, configuration-file prompts, Automatic-Reboot, Automatic-Reboot-Time passed to shutdown -r, --dry-run --debug, apt-config dump); apt.conf manual page: apt.conf(5) (#clear erases a list)
  5. APT source: apt-daily-upgrade.timer (OnCalendar=*-*-* 6:00, RandomizedDelaySec=60m); systemd source: shutdown time parsing (an hh:mm time already past today is scheduled for the next day)
  6. Canonical: Livepatch (part of Ubuntu Pro, free for up to 5 machines for personal use, sudo pro attach and sudo pro enable livepatch, not a replacement for rebooting)
  7. DNF documentation: DNF Automatic (timer units, upgrade_type, apply_updates, reboot, random delay, [base]), the shipped automatic.conf (DNF 4.14.0) and the configuration reference (excludepkgs)
  8. DNF plugins documentation: needs-restarting (-r, exit code 1 when a reboot is needed)
  9. AlmaLinux Wiki: Security Errata (ALSA security advisories, updateinfo.xml in the repositories, dnf updateinfo --list)
  10. Red Hat: RHBA-2023:6645, 7 November 2023 (dnf-automatic 4.14.0-8.el9 adds automatic reboot to RHEL 9)
  11. AlmaLinux package sources: dnf for AlmaLinux 8 (dnf 4.7.0 with no reboot option; automatic.conf kept as a changed configuration file), dnf for AlmaLinux 9 (the reboot patch; dnf-strict.conf with best=True installed as /etc/dnf/dnf.conf), dnf for AlmaLinux 10 (dnf 4.20.0) and mariadb for AlmaLinux 9 (mariadb-server requires the same version of mariadb-common and mariadb-errmsg)

All read on 14 November 2026.

Run Windows Server on AMD Ryzen or AMD EPYC

Full Administrator access, Remote Desktop ready, set up instantly. Plans from $14.99/mo.