Unattended Updates for Ubuntu 24.04 Server
Enable unattended updates on Ubuntu 24.04 server.
This isn't a demo — it's a deployment.
Security updates happen weekly — automatically and quietly.
Why this installer exists
Servers fail when patches are forgotten. Automated updates remove that risk.
What this installer does
✔ Applies weekly security fixes
✔ Handles system package upgrades
✔ Runs without user sessions
✔ No interaction required
What this installer does NOT do
It won’t stop you from running the script without reading the documentation like there’s no tomorrow.
Skip the README, and whatever happens next is your headache, not a bug report.
1. Prepare the system
sudo apt update -y
2. Download the installer
git clone https://git.x-files.dk/server/auto-update-ubuntu.git
cd auto-update-ubuntu
3. Run the installer
sudo ./auto-update-ubuntu
Automatic Defaults
| Setting | Enabled |
|---|---|
| Security & package upgrades | ✔ |
| Weekly unattended execution | ✔ Sundays @ 04:00 |
| Interactive prompts | ❌ None — unattended mode |
Cron Job Location (Important)
This script does not create a user cron via crontab -e.
Instead, it deploys a root‑level update scheduler here:
/etc/cron.d/updatesystem
Meaning:
✔ runs as root
✔ independent of user accounts
✔ persistent across reboots
✔ zero interactive maintenance needed
Modify schedule:
sudo nano /etc/cron.d/updatesystem
Optional Features (toggle inside script)
| Feature | Default | Enable by uncommenting |
|---|---|---|
| Auto-remove unused packages | ✘ | Remove-Unused-Dependencies = true |
| Auto-reboot if required | ✘ | Automatic-Reboot = true |
| Reboot even with logged-in users | ✘ | Automatic-Reboot-WithUsers = true |
Reference inside script:
# sed -i '/Remove-Unused-Dependencies/ s/^\/\/\s*//' "$config2"
# sed -i '/Automatic-Reboot/ s/^\/\/\s*//' "$config2"
# sed -i '/Automatic-Reboot-WithUsers/ s/^\/\/\s*//' "$config2"
Verify Status
systemctl status unattended-upgrades
journalctl -u unattended-upgrades -f
Logs
/var/log/unattended-upgrades/
/var/log/apt/history.log
Latest upgrade entries:
grep "Packages that were upgraded" /var/log/unattended-upgrades/unattended-upgrades.log
Reboot Check
/var/run/reboot-required
Exists → reboot recommended (optional autoreboot available)
More Information
More guides and documentation can be found on wiki.x-files.dk
License
Licensed under the MIT License.