-
-
Save Aldaviva/9db64e47324f467a7c9b7e468a454c76 to your computer and use it in GitHub Desktop.
-
Install plugin
sudo apt install unattended-upgrades
-
Edit package behavior
Create a new configuration override file and set its contents to the following, changing values to your liking.
sudo $EDITOR /etc/apt/apt.conf.d/51unattended-upgrades-local
Unattended-Upgrade::Origins-Pattern { "origin=*"; }; Unattended-Upgrade::Automatic-Reboot "false";
This will upgrade all packages, regardless of which repository they come from. It won't reboot after installing upgrades.
See Debian Reference § 2.7.3: Automatic download and upgrade of packages, /etc/apt/apt.conf.d/50unattended-upgrades
and /usr/share/doc/unattended-upgrades/README.md.gz
for documentation, defaults, and examples.
- Install plugin
sudo dnf install dnf5-plugin-automatic
- Edit plugin behavior
sudo cp /usr/share/dnf5/dnf5-plugins/automatic.conf /etc/dnf/automatic.conf sudo $EDITOR /etc/dnf/automatic.conf
commands.apply_updates
can be set toyes
to actually install the updates instead of only downloading them - Edit timer
For example, to make DNF install updates at exactly 1:05 AM every day, you can set the file contents to
sudo systemctl edit dnf5-automatic.timer
more systemd timer examples[Timer] # Empty string disables the default 6-7 AM update OnCalendar= OnCalendar=*-*-* 1:05 RandomizedDelaySec=0
- Enable timer
sudo systemctl enable --now dnf5-automatic.timer
- Verify timer status
systemctl status dnf5-automatic.timer systemctl list-timers --all dnf5-automatic
I just updated the Fedora Autoupdates docs which i found extremely confusing before - give them a whirl and see if it works for you now https://docs.fedoraproject.org/en-US/quick-docs/autoupdates/. I think you have a few steps in the Fedora version that're unnecessary (simpler to just create your own file vs. editing the timers and copying?). I based this off some suggestions I got on a completely unrelated thread on Reddit (of all places haha).
Your debian instructions are super useful - thank you!
Thank you @nikodunk. Yes, some of the steps I have are optional and only necessary if you want to fine-tune certain aspects of the updates. Otherwise, please correct me if I've missed your point.
- Editing the timer allows you to optionally customize when the updates happen, otherwise they run at 6-7AM each day. In my case, my computer broadcasts video of a birdfeeder when the sun is shining, so the CPU is very loaded with video encoding. I want to run updates at night when there is less of an impact to frame rates and fan noise, rather than at 6-7AM when the sun is sometimes up. This is, of course, personal preference based on each user's needs.
- Copying the plugin config is not strictly necessary, you could always start with an empty file. However, I found copying more helpful because it shows you all possible properties without having to dig around on disk to find the original file each time, as well as the default values of all properties and their documentation comments. You could always trim that file down if you don't need those lines, though.
Overall I found this particular section of the Fedora documentation lacking because it was never updated for the new dnf5-automatic
plugin that was introduced with DNF5 in Fedora 41, which is configured differently enough from the older DNF4 variant dnf-automatic
that the documentation covers. I have used both plugins, and had to re-learn how to configure the new one based on looking at the configuration and timer files on disk.
Interesting! Yes if you need it to reboot at a specific time, and prefer to have your files pre-populated with configs then that totally makes sense. I prefer an empty config file and to build up.
I'm pretty sure the config format didn't change between dnf5-automatic and dnf-automatic, though? Can't find any reference to them changing online. Edit: wait I see what you mean! The config format hasn't changed, but the pre-configured automatic timers have been removed from dnf5-automatic plugin!! https://dnf5.readthedocs.io/en/latest/changes_from_dnf4.7.html#changes-to-individual-commands. I'll update the Fedora docs to reflect this.
Thanks @lightonflux, that issue did affect my system. I applied an override and updated the instructions. My goodness systemd is a hellhole.