e2f53ee46aeb3b2e6cc95448de1bfb11a473a9d6
Unattended Updates for Ubuntu 24.04 Server
Automated configuration for unattended upgrades on Ubuntu 24.04 Server.
Security patches, apt updates and weekly maintenance — fully automatic.
Set it once → it updates itself.
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.
Languages
Shell
100%