Security fixes can pile up between maintenance sessions on Ubuntu Server 26.04 LTS, where unattended upgrades can install them on a schedule.

A dry run showing the allowed Ubuntu origins and no pending unattended upgrades

APT refreshes its package lists and checks for unattended upgrades on separate timers. Ubuntu's standard origin policy allows its release and security pockets. The regular -updates pocket remains available for manual upgrades.

Expanded Security Maintenance (ESM) extends security coverage for packages on eligible Ubuntu Pro systems. Ubuntu includes both ESM security pockets in its default policy.

Steps to enable automatic security updates on Ubuntu:

Use an SSH session or the server console on Ubuntu 26.04 LTS with an account that can use sudo. Start with unattended-upgrades installed, its default origins in place, APT's periodic upgrades turned off, and the standard apt-daily.timer package-list timer enabled at boot and active now. The apt-daily-upgrade.timer upgrade timer must report disabled with systemctl is-enabled and inactive with systemctl is-active.

  1. Inspect the effective APT policy before turning on scheduled upgrades.
    $ apt-config dump | grep -Ei '^(APT::Periodic::|Unattended-Upgrade::(Allowed-Origins|Origins-Pattern|Automatic-Reboot))'
    ##### snipped #####
    Unattended-Upgrade::Allowed-Origins "";
    Unattended-Upgrade::Allowed-Origins:: "${distro_id}:${distro_codename}";
    Unattended-Upgrade::Allowed-Origins:: "${distro_id}:${distro_codename}-security";
    Unattended-Upgrade::Allowed-Origins:: "${distro_id}ESMApps:${distro_codename}-apps-security";
    Unattended-Upgrade::Allowed-Origins:: "${distro_id}ESM:${distro_codename}-infra-security";

    The empty Allowed-Origins line heads the list. Each child is an origin:archive pair. The final dry run substitutes Ubuntu for ${distro_id} and resolute for ${distro_codename}, then prints the pairs as o=origin,a=archive.

    Stop before editing if the four allowed origins differ from those shown, if any origin patterns are configured, if Unattended-Upgrade::Automatic-Reboot is enabled, or if you see APT::Periodic::Enable "0".

  2. Confirm that apt-daily-upgrade.timer is disabled at boot.
    $ systemctl is-enabled apt-daily-upgrade.timer
    disabled

    Stop before editing if the result differs from disabled. A masked timer cannot be enabled.

  3. Confirm that apt-daily-upgrade.timer is inactive now.
    $ systemctl is-active apt-daily-upgrade.timer
    inactive

    Stop before editing if the result differs from inactive.

  4. Refresh the APT package lists for the dry run.
    $ sudo apt update
    Hit:1 http://security.ubuntu.com/ubuntu resolute-security InRelease
    ##### snipped #####

    APT returns to the shell prompt when the refresh finishes. Stop before editing if the refresh fails or the output has no successful Hit or Get line for resolute-security InRelease.

  5. Open a new /etc/apt/apt.conf.d/90automatic-security-updates file in Nano.
    $ sudo nano /etc/apt/apt.conf.d/90automatic-security-updates

    APT reads this file after /etc/apt/apt.conf.d/20auto-upgrades, so the new intervals override the earlier settings. If Nano opens an existing file, stop and review it before editing.

  6. Enter the daily package-list and unattended-upgrade intervals in the empty file.
    APT::Periodic::Update-Package-Lists "1";
    APT::Periodic::Unattended-Upgrade "1";

    Each 1 sets a one-day interval. The package-list refresh gives the upgrade job current information about available fixes.

    Once the file is saved, a scheduled upgrade can install packages and restart affected services. On a server where service interruptions matter, make the change during a maintenance window. To restore the previous APT settings, remove only /etc/apt/apt.conf.d/90automatic-security-updates.

  7. Save the new APT configuration file with Ctrl+O, followed by Enter to confirm the filename.
  8. Exit Nano with Ctrl+X to return to the shell.
  9. Confirm that APT reads both intervals as "1".
    $ apt-config dump | grep -E '^APT::Periodic::(Update-Package-Lists|Unattended-Upgrade) '

    If APT reports a syntax error, check the quoted values and trailing semicolons. If either interval differs from "1", check for a later configuration file that overrides the new settings.

  10. Enable the APT upgrade timer now and at boot.
    $ sudo systemctl enable --now apt-daily-upgrade.timer

    The persistent timer can catch up on a missed run soon after you start it. To return the timer to disabled and inactive, run sudo systemctl disable --now apt-daily-upgrade.timer.

  11. Check the next scheduled unattended-upgrade run.
    $ systemctl list-timers apt-daily-upgrade.timer --full --no-pager

    The NEXT column should show a future run for apt-daily-upgrade.timer. If no timer is listed or NEXT is blank, check the timer before relying on automatic installation.

  12. Verify the allowed origins after the unattended-upgrade dry run finishes without errors.
    $ sudo unattended-upgrade --dry-run --verbose
    Starting unattended upgrades script
    Allowed origins are: o=Ubuntu,a=resolute, o=Ubuntu,a=resolute-security, o=UbuntuESMApps,a=resolute-apps-security, o=UbuntuESM,a=resolute-infra-security
    ##### snipped #####
    No packages found that can be upgraded unattended and no pending auto-removals
    ##### snipped #####

    The simulation makes no package changes. The Allowed origins are line should contain exactly the four entries shown: the Ubuntu release (resolute) and security (resolute-security) pockets and both ESM security pockets (resolute-apps-security and resolute-infra-security). It should exclude resolute-updates, resolute-proposed, resolute-backports, and third-party origins. If no eligible packages are pending, the no-packages message above is a successful result. If APT is locked by a scheduled job, wait for it to finish before rerunning the simulation.

    The origin entries set the upgrade policy. Ubuntu Pro entitlement and enabled ESM repositories determine whether the system receives ESM packages.

Share this guide