Skip to main content
  1. Posts/

Automatic package updates with dnf

·354 words·2 mins·


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:

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:

# rpm -ql dnf-automatic | grep systemd

For Fedora 26 and later:

# rpm -ql dnf-automatic | grep systemd

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:

systemctl enable dnf-automatic.timer

For Fedora 26 and later:

systemctl enable dnf-automatic-install.timer

Check your work:

# 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