Short answer

On Ubuntu 26.04 and 24.04 automatic security updates are already on: unattended-upgrades is installed and /etc/apt/apt.conf.d/20auto-upgrades turns it on. The apt-daily-upgrade timer installs security fixes once a day around 6:00 server time. Check it with systemctl list-timers apt-daily-upgrade.timer and read what it did with sudo tail /var/log/unattended-upgrades/unattended-upgrades.log.

Tested on Ubuntu 26.04 and 24.04, two separate runs. On 24.04? 2 sections differ, each step marked “On Ubuntu 24.04” right under it: Step 2: See what it will install, Step 5: Add regular updates and an automatic reboot (optional). Everything that differed

Before you start

  • An Ubuntu 26.04 or 24.04 server and a user with sudo (create one).
  • Nothing to install: this was tested on a fresh server from Ubuntu’s cloud image, which is what most providers give you.

Step 1: Check that it is on

The package is installed:

Server
$ dpkg-query -W -f='${Package} ${Version} ${db:Status-Status}\n' unattended-upgradesunattended-upgrades 2.12ubuntu9 installed
Output hidden (1 line)

This file turns it on. Update-Package-Lists "1" fetches the package lists every day, and Unattended-Upgrade "1" installs from them every day. Many guides tell you to run sudo dpkg-reconfigure unattended-upgrades to write this file; on both releases it is already there:

Server
$ cat /etc/apt/apt.conf.d/20auto-upgradesAPT::Periodic::Update-Package-Lists "1";APT::Periodic::Unattended-Upgrade "1";
Output hidden (2 lines)

Two systemd timers do the work. apt-daily downloads the lists, apt-daily-upgrade installs the updates. NEXT is when each runs next:

Server
$ systemctl list-timers apt-daily.timer apt-daily-upgrade.timer --no-pagerNEXT                        LEFT LAST PASSED UNIT                    ACTIVATESThu 2026-11-19 06:57:30 UTC   8h -         - apt-daily-upgrade.timer apt-daily-upgrade.serviceThu 2026-11-19 07:05:22 UTC   8h -         - apt-daily.timer         apt-daily.service 2 timers listed.Pass --all to see loaded but inactive timers, too.
Output hidden (6 lines)

The install timer fires at 6:00 plus a random delay of up to an hour, so servers do not all hit the mirrors at once. Persistent=true means a run missed while the server was off happens at the next boot:

Server
$ systemctl cat apt-daily-upgrade.timer --no-pager# /usr/lib/systemd/system/apt-daily-upgrade.timer[Unit]Description=Daily apt upgrade and clean activitiesAfter=apt-daily.timer [Timer]OnCalendar=*-*-* 6:00RandomizedDelaySec=60mPersistent=true [Install]WantedBy=timers.target
Output hidden (12 lines)

6:00 is in the server’s time zone, which on a cloud server is UTC:

Server
$ timedatectl show -p TimezoneTimezone=Etc/UTC
Output hidden (1 line)

Step 2: See what it will install

It takes packages only from these origins: the release itself, -security, and the two Ubuntu Pro security origins (they do nothing unless Pro is attached):

Server
$ apt-config dump Unattended-Upgrade::Allowed-OriginsUnattended-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";
Output hidden (5 lines)

On a new server, security updates are already waiting:

Server
$ sudo apt update[… 3 lines not shown …]Hit:4 http://archive.ubuntu.com/ubuntu resolute-backports InRelease23 packages can be upgraded. Run 'apt list --upgradable' to see them.
Output hidden (3 lines)
Server
$ apt list --upgradable 2>/dev/null | grep -c security16
Output hidden (1 line)

Is a newer kernel waiting? On the 26.04 test server none was, so this printed nothing:

Server
$ apt list --upgradable 2>/dev/null | grep linux-image

A dry run lists what the next run will install, and installs nothing. Note libc6: it needs a reboot, as Step 4 shows:

Server
$ sudo unattended-upgrade --dry-run -v 2>&1 | grep "Packages that will be upgraded"Packages that will be upgraded: cloud-init cloud-init-base libc-bin libc-dev-bin libc-gconv-modules-extra libc6 libc6-dev libgstreamer1.0-0 libperl5.40 locales needrestart perl perl-base perl-modules-5.40 python3-pyasn1 sos
Output hidden (1 line)
On Ubuntu 24.04

On 24.04 a newer kernel was waiting, and it is published in noble-security as well as noble-updates, so the security run installs it:

Server
$ apt list --upgradable 2>/dev/null | grep linux-imagelinux-image-virtual/noble-updates,noble-security 6.8.0-149.149 amd64 [upgradable from: 6.8.0-147.147]
Output hidden (1 line)

The dry run lists it (linux-image-virtual) with the other security fixes:

Server
$ sudo unattended-upgrade --dry-run -v 2>&1 | grep "Packages that will be upgraded"Packages that will be upgraded: apt apt-utils bind9-dnsutils bind9-host bind9-libs ca-certificates distro-info-data git git-man libapt-pkg6.0t64 libbrotli1 libc-bin libc-dev-bin libc-devtools libc6 libc6-dev libgstreamer1.0-0 liblzma5 libmspack0t64 libnss3 libpcre2-8-0 libperl5.38t64 linux-headers-generic linux-headers-virtual linux-image-virtual linux-libc-dev linux-tools-common linux-virtual locales needrestart perl perl-base perl-modules-5.38 python3-jwt python3-pyasn1 python3-twisted sosreport xz-utils zlib1g
Output hidden (1 line)

Whether a kernel comes with the security updates depends on the day: on our 2026-11-11 run the newer 24.04 kernel was in noble-updates only, and the default run left it alone. Step 5 adds -updates, so you get it either way.

Step 3: Pick the time (optional)

Installing updates restarts services, so you may want it at night instead. Do not edit the timer file in /lib/systemd/system: an apt update replaces it. Make a drop-in that overrides it (sudo mkdir -p /etc/systemd/system/apt-daily-upgrade.timer.d, then sudo nano /etc/systemd/system/apt-daily-upgrade.timer.d/override.conf):

/etc/systemd/system/apt-daily-upgrade.timer.d/override.conf
[Timer]OnCalendar=OnCalendar=*-*-* 03:00RandomizedDelaySec=15m

The empty OnCalendar= clears the 6:00 time; without it the timer would run at both times. Load it:

Server
$ sudo systemctl daemon-reload
Server
$ systemctl list-timers apt-daily-upgrade.timer --no-pagerNEXT                            LEFT LAST PASSED UNIT                    ACTIVATESThu 2026-11-19 03:04:54 UTC 4h 34min -         - apt-daily-upgrade.timer apt-daily-upgrade.service 1 timers listed.Pass --all to see loaded but inactive timers, too.
Output hidden (5 lines)

The next run is now between 03:00 and 03:15 UTC. It stays so after a reboot (checked in Step 5).

Step 4: Check that it ran

The next day, ask the journal. In the test the timer fired on its own and its run finished:

Server
$ sudo journalctl -u apt-daily-upgrade.service --no-pager | tail -n 3Nov 18 22:32:44 web-server systemd[1]: apt-daily-upgrade.service: Deactivated successfully.Nov 18 22:32:44 web-server systemd[1]: Finished apt-daily-upgrade.service - Daily apt upgrade and clean activities.Nov 18 22:32:44 web-server systemd[1]: apt-daily-upgrade.service: Consumed 34.757s CPU time over 40.488s wall clock time, 443.9M memory peak.
Output hidden (3 lines)

unattended-upgrades keeps its own log, with the packages it installed. Read it with sudo:

Server
$ sudo tail -n 4 /var/log/unattended-upgrades/unattended-upgrades.log2026-11-18 22:32:04,452 INFO Initial whitelist (not strict):2026-11-18 22:32:10,427 INFO Packages that will be upgraded: cloud-init cloud-init-base libc-bin libc-dev-bin libc-gconv-modules-extra libc6 libc6-dev libgstreamer1.0-0 libperl5.40 locales needrestart perl perl-base perl-modules-5.40 python3-pyasn1 sos2026-11-18 22:32:10,427 INFO Writing dpkg log to /var/log/unattended-upgrades/unattended-upgrades-dpkg.log2026-11-18 22:32:43,833 INFO All upgrades installed
Output hidden (4 lines)

Without sudo you cannot even list that folder:

Server
$ ls /var/log/unattended-upgrades/ls: cannot open directory '/var/log/unattended-upgrades/': Permission denied
Output hidden (1 line)

No security updates are left:

Server
$ apt list --upgradable 2>/dev/null | grep -c security0
Output hidden (1 line)

When an update needs a reboot, it creates /var/run/reboot-required. On both test servers the security run left it there (26.04: the new libc6; 24.04: libc6 and the new kernel). By default nothing reboots, so the server keeps running the old code until you reboot it, or until Step 5 does:

Server
$ ls /var/run/reboot-required/var/run/reboot-required
Output hidden (1 line)

Step 5: Add regular updates and an automatic reboot (optional)

To get the kernel and other fixes from -updates as well, and let the server reboot itself at night when an update needs it, add your own file. Do not edit 50unattended-upgrades: if a package update changes it, apt stops to ask which version to keep. Create /etc/apt/apt.conf.d/52unattended-upgrades-local (sudo nano /etc/apt/apt.conf.d/52unattended-upgrades-local):

/etc/apt/apt.conf.d/52unattended-upgrades-local
Unattended-Upgrade::Allowed-Origins {        "${distro_id}:${distro_codename}-updates";};Unattended-Upgrade::Automatic-Reboot "true";Unattended-Upgrade::Automatic-Reboot-Time "02:00";

The list in your file is ADDED to the default one, so -security stays:

Server
$ apt-config dump Unattended-Upgrade::Allowed-OriginsUnattended-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";Unattended-Upgrade::Allowed-Origins:: "${distro_id}:${distro_codename}-updates";
Output hidden (6 lines)

To see it at once instead of waiting for the night, run it by hand. Use sudo unattended-upgrade -v, not systemctl start: the timer’s service runs once a day only (see below). This time it installs what was waiting in -updates, finds /var/run/reboot-required and schedules the reboot:

Server
$ sudo unattended-upgrade -v 2>&1 | grep -E "^(Packages that will be upgraded|All upgrades installed|Found /var/run/reboot-required|Shutdown msg)"Packages that will be upgraded: distro-info fwupd libfwupd3 python3-distro-info python3-software-properties snapd software-properties-commonAll upgrades installedFound /var/run/reboot-required, rebootingShutdown msg: b"Reboot scheduled for Thu 2026-11-19 02:00:00 UTC, use 'shutdown -c' to cancel."
Output hidden (4 lines)

Why it needs a reboot (the C library every program uses):

Server
$ cat /var/run/reboot-required.pkgslibc6
Output hidden (1 line)

The reboot waiting for 02:00. sudo shutdown -c cancels it:

Server
$ shutdown --showReboot scheduled for Thu 2026-11-19 02:00:00 UTC, use 'shutdown -c' to cancel.
Output hidden (1 line)

In the test the server was rebooted straight away, which is what 02:00 does. After it, the flag is gone:

Server
$ sudo reboot
Server
$ ls /var/run/reboot-requiredls: cannot access '/var/run/reboot-required': No such file or directory
Output hidden (1 line)
On Ubuntu 24.04

On 24.04 the new kernel needed the reboot too:

Server
$ cat /var/run/reboot-required.pkgslibc6linux-image-6.8.0-149-genericlinux-base
Output hidden (3 lines)

Before the reboot the server still ran the old kernel:

Server
$ uname -r6.8.0-147-generic
Output hidden (1 line)

After it, the new one:

Server
$ uname -r6.8.0-149-generic
Output hidden (1 line)

The 03:00 time from Step 3 survived the reboot:

Server
$ systemctl list-timers apt-daily-upgrade.timer --no-pagerNEXT                           LEFT LAST                        PASSED UNIT                    ACTIVATESThu 2026-11-19 03:05:45 U… 4h 31min Wed 2026-11-18 22:32:03 UTC      - apt-daily-upgrade.timer apt-daily-upgrade.service 1 timers listed.Pass --all to see loaded but inactive timers, too.
Output hidden (5 lines)

What these steps change on the server

Both runs recorded the server before the first step and after the last, and audited it with Lynis both times (see the Tested on box below). Your own changes are two new files in /etc: the timer override and 52unattended-upgrades-local. Everything else is the updates themselves: 16 packages upgraded on 26.04; on 24.04, 48 upgraded and the new kernel’s packages added. No service or listening port changed. Lynis’s score rose from 60 to 65 on 26.04 and from 62 to 67 on 24.04, because its finding PKGS-7392, “Found one or more vulnerable packages”, was gone.

Ubuntu 26.04 vs 24.04: what changed

WhatUbuntu 26.04Ubuntu 24.04
SystemUbuntu 26.04.1 LTS7.0.0-43-genericUbuntu 24.04.5 LTS6.8.0-149-generic
unattended-upgrades2.12ubuntu92.9.1+nmu4ubuntu1
apt3.2.1ubuntu0.12.8.4ubuntu0.1
linux-image-virtual7.0.0-43.436.8.0-149.149
Updates waiting on a new server (apt update)16 (11 security)48 (36 security)
Newer kernel waitingnone6.8.0-149, in noble-updates and noble-security
What the default security run left needing a rebootlibc6libc6, the new kernel, linux-base
Memory peak of the timer’s run (journal)414M1.0G
Lynis hardening index before → after60 → 6562 → 67
ProofRun log, 33 checks passedRun log, 34 checks passed

If you start it and nothing happens

sudo systemctl start apt-daily-upgrade.service runs the same job as the timer, and the job installs once per calendar day. A second start on the same day does nothing and writes nothing to the log:

Server
$ sudo systemctl start apt-daily-upgrade.service

It looks at the date of this file. Today’s date means it already ran today:

Server
$ ls -l --time-style=+%F /var/lib/apt/periodic/upgrade-stamp-rw-r--r-- 1 root root 0 2026-11-18 /var/lib/apt/periodic/upgrade-stamp
Output hidden (1 line)

To install now anyway, run sudo unattended-upgrade -v, as in Step 5.

Undo: turn automatic updates off

Set Unattended-Upgrade to "0" in /etc/apt/apt.conf.d/20auto-upgrades (sudo nano /etc/apt/apt.conf.d/20auto-upgrades):

/etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "1";APT::Periodic::Unattended-Upgrade "0";
Server
$ apt-config dump APT::Periodic::Unattended-UpgradeAPT::Periodic::Unattended-Upgrade "0";
Output hidden (1 line)

The timer still fires every day, but installs nothing. To also undo the other steps, delete /etc/apt/apt.conf.d/52unattended-upgrades-local and the apt-daily-upgrade.timer.d folder, then run sudo systemctl daemon-reload.