Ubuntu — Enable Unattended Upgrades
unattended-upgrades automatically installs security updates in the background. It is pre-installed on Ubuntu but not always fully enabled. This guide covers enabling it, the key configuration knobs, and how to verify it is working.
Pre-requisites
- Ubuntu 20.04 or later
sudoaccess
1. Install (if missing)
On most Ubuntu installations this is already present. Skip if dpkg -l unattended-upgrades shows it installed.
2. Enable
Select Yes. This writes /etc/apt/apt.conf.d/20auto-upgrades with the correct defaults:
The value is the interval in days. "1" = daily.
3. Configure
The main config file is /etc/apt/apt.conf.d/50unattended-upgrades. Edit it with:
Update sources
By default only security updates are applied. To also include standard updates, uncomment:
Automatic reboot
If an update requires a reboot (e.g. kernel updates), this controls what happens:
Unattended-Upgrade::Automatic-Reboot "true";
Unattended-Upgrade::Automatic-Reboot-Time "02:00";
Unattended-Upgrade::Automatic-Reboot-WithUsers "false";
Reboot on servers
Automatic-Reboot "true" on a production server means it will reboot at 02:00 after kernel updates — with no warning. Keep "false" unless you accept that.
Package blacklist
Block specific packages from automatic updates (useful for databases, custom kernels):
Use $ to match exact names: "libc6$" matches libc6 but not libc6-dev.
Email notifications
Requires a working mail client (msmtp, postfix, etc.):
MailReport options: "always" | "only-on-error" | "on-change"
4. Verify
Dry run — shows what would be upgraded without applying anything:
Check the log after the next scheduled run:
A successful run looks like:
2026-05-24 02:17:01,123 INFO Starting unattended upgrades script
2026-05-24 02:17:04,456 INFO Packages that will be upgraded: ...
2026-05-24 02:17:30,789 INFO All upgrades installed
If the log shows "No packages found that can be upgraded" — your system is up to date, which is the correct outcome.
Key Files
| File | Purpose |
|---|---|
/etc/apt/apt.conf.d/20auto-upgrades |
Enable/disable + frequency |
/etc/apt/apt.conf.d/50unattended-upgrades |
Behaviour config (reboot, email, blacklist) |
/var/log/unattended-upgrades/ |
Run logs |