With Fedora 22’s release date quickly approaching, it’s time to familiarize yourself with dnf. It’s especially important since clean installs of Fedora 22 won’t have yum.
Almost all of the command line arguments are the same but automated updates are a little different. If you’re used to yum-updatesd, then you’ll want to look into dnf-automatic.
Installation
Getting the python code and systemd unit files for automated dnf updates is a quick process:
|
1 |
dnf -y install dnf-automatic |
Configuration
There’s only one configuration file to review and most of the defaults are quite sensible. Open up /etc/dnf/automatic.conf with your favorite text editor and review the available options. The only adjustment I made was to change the emit_via option to email as opposed to the stdio.
You may want to change the email_to option if you want to redirect email elsewhere. In my case, I already have an email forward for the root user.
dnf Automation
If you look at the contents of the dnf-automatic package, you’ll find some python code, configuration files, and two important systemd files:
For Fedora 25 and earlier:
|
1 2 3 |
# rpm -ql dnf-automatic | grep systemd /usr/lib/systemd/system/dnf-automatic.service /usr/lib/systemd/system/dnf-automatic.timer |
For Fedora 26 and later:
|
1 2 3 4 5 6 7 |
# rpm -ql dnf-automatic | grep systemd /usr/lib/systemd/system/dnf-automatic-download.service /usr/lib/systemd/system/dnf-automatic-download.timer /usr/lib/systemd/system/dnf-automatic-install.service /usr/lib/systemd/system/dnf-automatic-install.timer /usr/lib/systemd/system/dnf-automatic-notifyonly.service /usr/lib/systemd/system/dnf-automatic-notifyonly.timer |
These systemd files are what makes dnf-automatic run. The service file contains the instructions so that systemd knows what to run. The timer file contains the frequency of the update checks (defaults to one day). We need to enable the timer and then start it.
For Fedora 25 and earlier:
|
1 |
systemctl enable dnf-automatic.timer |
For Fedora 26 and later:
|
1 |
systemctl enable dnf-automatic-install.timer |
Check your work:
|
1 2 3 |
# systemctl list-timers *dnf* NEXT LEFT LAST PASSED UNIT ACTIVATES Tue 2015-05-12 19:57:30 CDT 23h left Mon 2015-05-11 19:57:29 CDT 14min ago dnf-automatic.timer dnf-automatic.service |
The output here shows that the dnf-automatic job last ran at 19:57 on May 11th and it’s set to run at the same time tomorrow, May 12th. Be sure to disable and stop your yum-updatesd service if you still have it running on your system from a previous version of Fedora.
Photo Credit: Outer Rim Emperor via Compfight cc

Is it possible to configure it so it runs update twice on each run? I ask because I find out that when using akmods from rpmfusion, I have to redo the update process after the kernel gets updated so it can pull new kmods. Otherwise (when using NVIDIA driver) on next boot system doesn’t start X, and I have to manually drop to console and do an update and reboot.
Hmm, you might be able to duplicate the timer that comes with dnf-automatic so that it runs at an offset, but that might not always work. Without some additional scripting, I’m not sure how to do that.
Oh well, thanks anyway – it’s a great post.
You’re welcome!
You might be able to adjust the ExecStart command of /usr/lib/systemd/system/dnf-automatic.service to run the command twice in a row. Something like (which I haven’t tested):
ExecStart=/usr/bin/dnf-automatic /etc/dnf/automatic.conf –timer && /usr/bin/dnf-automatic /etc/dnf/automatic.conf –timer
Thanks, this is nice!
Glad it helped!
When I checked the content of /etc/dnf/automatic.conf nothing was there. Would that be because I’m running MATE instead of GNOME 3 or is it supposed to show?
Did you install the dnf-automatic package? That package has the automatic.conf file.
I already fixed it the same day I posted this post.
This a great feature! Do you happen to know if ‘upgrade_type = security’ also works with third party repositories such as rpmfusion and google chrome?
As far as I know, it only works with Fedora repositories.
Thanks!
Is there a way to set the time that dnf-automatic.timer will run? Mine is currently running at 4 PM, which is right when I’m trying to cram in a lot of work before the end of the day.
You’ll probably need to patch the dnf-automatic.timer file and use OnCalandar. The Arch docs are helpful for that:
https://wiki.archlinux.org/index.php/Systemd/Timers
Don’t forget a systemd-reload afterwards.
Thanks for this doc !
Does it behave friendly with manual halt or reboot ? I mean, if rpms are installing, will the system wait before rebooting or shutting down ?
Hello,
Thanks for this page!
In my experience dnf-automatic will now fail in Fedora 26+ as a change has been made where multiple systemd timers now exist for the service. See: https://fedoraproject.org/wiki/AutoUpdates#Changes_as_of_Fedora_26
I’ve now enabled dnf-automatic-install.timer instead.
Good call. I’ll update the post.
(Fedora 27)
You should start the timer too, right? Else, it won’t do anything until you reboot.
# systemctl start dnf-automatic-install.timer
Thanks for keeping this post updated.