SSD Nodes Learn Hosting plans →
How to do am Matt ConnorBy Matt Connor · Updated 2026-11-11

dnf-automatic Security Updates for Rocky and AlmaLinux

Set up dnf-automatic for security-only updates on Rocky Linux 9 and AlmaLinux 9, configure the systemd timer and email alerts, and choose a safe reboot policy.

Wetín dnf-automatic dey do for Rocky Linux and AlmaLinux

dnf-automatic na how you fit get unattended security updates for Rocky Linux and AlmaLinux. Na one small program wey systemd timer dey start, and e dey read /etc/dnf/automatic.conf then apply wetin that file allow. Installation na one command. The rest of this guide dey explain settings wey decide whether e go protect the box or quietly do nothing.

If you come from Debian or Ubuntu, na the same work unattended-upgrades dey do for Ubuntu VPS. One difference important pass the others: wetin the word "security" mean to the package manager. For Ubuntu, na separate archive pocket. For the RHEL family, na metadata wey dey attached to published advisories, and that metadata fit miss or become stale. If you point dnf-automatic to repository wey no get advisory data, e no install anything but e go report success.

This guide dey based on Rocky Linux 9 and AlmaLinux 9, wey dey use DNF 4 (DNF na the package manager for the RHEL family), as of October 2026. The 10 releases still ship DNF 4 and the same dnf-automatic package, so most of this guide still apply. The few notes for dem dey their own section near the end. Every command below na one wey you fit run for your own box, and the output wey you suppose expect dey beside am.

Install dnf-automatic and read the config wey e ship

Make automatic updates part of the remaining setup for the first ten minutes for a new VPS, immediately after you get a non-root user and firewall ready. If you never finish the firewall part, firewalld na wetin Rocky and AlmaLinux dey ship with, and some commands fit open SSH, open the port wey your site dey listen on, and make both settings survive reboot.

sudo dnf install -y dnf-automatic
rpm -q dnf dnf-automatic
systemctl is-enabled dnf-automatic.timer

systemctl is-enabled dey print disabled for fresh install, because installing the package no start anything. Na this be the most common reason why server wey "get dnf-automatic" never apply even one update.

DNF version matter for one option. The reboot setting come upstream for DNF 4.15, and Red Hat backport am into RHEL 9 DNF 4.14.0, then release am as dnf-4.14.0-8.el9 for November 2023 through advisory RHBA-2023:6645. Rocky 9 and AlmaLinux 9 rebuild that package, so current box get dnf-4.14.0-8.el9 or later, but box wey nobody touch since 2023 fit no get am.

The config file na /etc/dnf/automatic.conf. The copy wey package ship get the main options with comments, and the lines wey no get comments na the values wey your box dey use. Some later additions, like send_error_messages, no dey written inside am, so man dnf-automatic na the complete list for your build. Read both once before you edit, because together dem show the real settings for your version.

The two switches wey decide wetin go happen

download_updates and apply_updates for the [commands] section dey decide the behaviour. For EL9 (enterprise Linux 9, the shared base of Rocky 9 and AlmaLinux 9), the file wey come with the system set download_updates = yes and apply_updates = no. So, if you enable dnf-automatic without editing am, e go download available updates enter the cache and report dem, but e no go install anything.

  • If both be no: dnf-automatic go report available updates and e no go change anything for the box.
  • download_updates = yes with apply_updates = no: packages go download enter the DNF cache. Installation go quick and e no need network, but nothing don change tonight.
  • If both be yes with upgrade_type = default: every available update go install, whether na security update or not.
  • If both be yes with upgrade_type = security: na only packages wey security advisory name go install.

A reasonable starting point for public-facing VPS fit be:

[commands]
upgrade_type = security
download_updates = yes
apply_updates = yes
random_sleep = 0
network_online_timeout = 60
reboot = never

network_online_timeout na the number of seconds wey the run go wait for working network before e give up. This matter for a box wey just boot. random_sleep na older way to spread load across many machines, and the timer dey handle that work now. Run systemctl cat dnf-automatic.service to see the exact flags wey the service wey come with the system dey pass.

Prove say the file dey do wetin you expect, without waiting reach 06:00:

sudo systemctl start dnf-automatic.service
sudo journalctl -u dnf-automatic.service -n 50 --no-pager

The journal go show wetin the run check and wetin e do. You fit also force one behaviour from the command line. This one go override the file for that run only:

sudo dnf-automatic --downloadupdates --no-installupdates

upgrade_type = security wetin really mean for Rocky and Alma

DNF no dey work out whether update na security update by comparing version numbers. E dey read errata metadata: one file wey dem call updateinfo.xml wey dem publish inside repository, where each advisory list the packages wey go fix am. AlmaLinux dey publish these as ALSA advisories, while Rocky dey publish dem as RLSA. upgrade_type = security dey build filter from this metadata and upgrade only the packages wey match am.

Two things follow from this, and both fit surprise people.

First, if metadata no dey, no update go happen. If repository no get updateinfo.xml, the filter no match anything and the run go end with this line for the journal:

No security updates needed, but 3 updates available

The box no get patch, and nothing report failure. Check am yourself:

dnf updateinfo list --security
dnf check-update

If dnf check-update list packages while dnf updateinfo list --security no print anything at all, either no pending package carry advisory, or repository no get advisory data wey e fit read. Rocky and AlmaLinux both dey publish am, so for these two, empty list usually dey honest. CentOS Stream no dey publish am at all.

Second, security mode no be minimal change. dnf-automatic dey add security filter, then run the normal upgrade path. So package wey advisory name go move to the newest version for repository, and e go carry the dependencies along with am. The smaller step, wey na to move only to the earliest version wey fix the advisory, na dnf upgrade-minimal --security wey you run by hand. dnf-automatic no get setting for am.

Rocky get one more caveat. Rocky dey generate im errata from Red Hat data through im own pipeline, but that pipeline don fall behind. For September 2025, users report say Rocky 9 BaseOS updateinfo.xml no move since December 2024. So --security no get recent advisories, and Rocky staff confirm say na known issue. If you depend on upgrade_type = security, compare the advisory list with recent RLSA announcements from time to time. For machine wey security coverage matter pass change control, upgrade_type = default for schedule wey you choose na the safer setting. Root-store changes deserve their own spot check too. After fix like the October 2026 eMudhra one, check wetin your Rocky or AlmaLinux box actually trust to confirm whether the unattended run deliver am, instead of assuming say e did.

The systemd timer wey really dey run am

sudo systemctl enable --now dnf-automatic.timer
systemctl list-timers dnf-automatic.timer

list-timers suppose print one row with NEXT time wey dey about one day from now. Empty table mean say timer no dey enabled, so nothing go ever run.

The timer wey package ship dey run for *-*-* 6:00 with RandomizedDelaySec=60m and Persistent=true. The random delay dey spread servers across one hour, so every server no go hit the mirror for the same second. Persistent=true mean say if machine dey powered off for 06:00, e go run the missed job shortly after e boot, instead of skipping that day.

Change the schedule with a drop-in. No edit the unit wey package ship, because package upgrade go replace files under /usr/lib/systemd/system.

sudo systemctl edit dnf-automatic.timer
[Timer]
OnCalendar=
OnCalendar=*-*-* 03:30
RandomizedDelaySec=30m

The empty OnCalendar= line na required. OnCalendar dey accumulate, so if you no reset am, you go keep the 06:00 entry and add another one, and the job go run twice every day. Confirm the result with systemctl list-timers dnf-automatic.timer and read the NEXT column. The same drop-in rules apply to anything else wey you schedule. writing systemd service and timer units cover that topic.

Now make we look the trap. The package ship three more timers: dnf-automatic-notifyonly.timer, dnf-automatic-download.timer and dnf-automatic-install.timer. Each one starts the same program with command-line flags, and those flags override download_updates and apply_updates from your config file. If you enable one of dem together with dnf-automatic.timer, the job go run twice with two different behaviours. E go look exactly like your config file dey ignored. Enable one timer and check:

systemctl list-unit-files 'dnf-automatic*'

How you fit know when dem install something?

emit_via for the [emitters] section dey control reporting. Under systemd, stdio emitter dey write to the journal. Na the dependable option be this because e no need anything else wey dem install:

sudo journalctl -u dnf-automatic.service --since -7d --no-pager

motd emitter dey write the report inside /etc/motd and replace the file content. If you dey keep login banner for there, no include this emitter.

email emitter dey open SMTP (simple mail transfer protocol) connection to email_host for email_port. Default values na localhost and 25. Fresh VPS no get anything wey dey listen there, so connection go dey refused and no mail go send. Run ss -lnt | grep ':25' before you rely on am, and set up relay-only Postfix if the output empty. When mail dey work, subject go read Updates applied on 'web01'., and e dey take the name from system_name.

For anything else, command emitter dey hand the report over to your program through standard input:

[emitters]
emit_via = stdio, command
system_name = web01.example.com
send_error_messages = yes

[command]
command_format = /usr/local/bin/notify-ops
stdin_format = {body}

send_error_messages default na no. This mean say failed run no go report anything at all. Turn am on. Patching system wey only dey announce successful runs worse pass no patching system, because the silence go look like say everything dey healthy.

dnf-automatic no dey restart your services

When you install package, e dey replace files for disk. Process wey don already dey run go keep the old code for memory, so patched library no go do anything for daemon wey start last month. This gap between package wey dey installed and code wey dey active na why unattended patching need restart policy, no be install policy only.

sudo dnf install -y dnf-plugins-core
dnf needs-restarting -s
dnf needs-restarting -r

-s dey list systemd services wey their files change after dem start. -r dey answer one question, and e dey print one of two blocks:

Core libraries or services have been updated since boot-up:
  * kernel
Reboot is required to fully utilize these updates.
No core libraries or services have been updated since boot-up.
Reboot should not be necessary.

-r no be deep analysis. E dey check fixed list of packages: kernel, kernel-core, kernel-rt, glibc, linux-firmware, systemd, dbus, dbus-broker, dbus-daemon and microcode_ctl. If dem install any one of dem after last boot, you go get the first answer. Add your own package names for file wey end with .conf under /etc/dnf/plugins/needs-restarting.d/ when another thing for the box also need reboot before e go take effect.

One thing wey scripts need know: dnf needs-restarting -r dey exit with non-zero status both when reboot dey required and when the command itself fail, so exit status alone no fit tell the two apart. Read the output text.

Restarting service na the smaller action, and most times na the correct one. Restart SSH daemon from second SSH session wey don already open, so bad config no go lock you out. New kernel na the case wey only reboot fit solve, because running kernel no fit replace itself in place. If you wan sort updates for one particular morning into these two groups, which updates need reboot and which only need service restart go process the output package by package.

Containers na separate case, because dnf-automatic dey patch packages for host and e no dey touch userland wey dem bake inside image. So box wey dey run Docker Engine for Rocky Linux or AlmaLinux also need pull the images again and recreate the containers before the fix go reach the code wey actually dey serve network traffic.

Box suppose reboot by itself?

[commands]
reboot = when-needed
reboot_command = shutdown -r +5 'Rebooting after applying package updates'

reboot = never na the default. when-changed go reboot after any update wey e apply. when-needed go reboot only when the check behind needs-restarting -r talk say dem replace core package, and na wetin most people wey dey run one server want. Pair am with timer window wey dem choose by themselves. The default reboot_command go give users wey dey logged in five minutes warning through shutdown, and you fit make the time longer.

Settle two things before you enable this. Every service wey you depend on must start by itself during boot. This na the usual problem with a Docker Compose stack wey person start by hand. You also need console or rescue access from your provider, because you no fit fix kernel wey no boot through SSH. If any of these two no dey, keep reboot = never and reboot by yourself after you read the journal.

Rocky, AlmaLinux and CentOS Stream: where dem different

For Rocky 9 and AlmaLinux 9, everything above na the same, including config path and unit names. Both of dem publish errata, so upgrade_type = security get data wey e fit filter on. The stale Rocky errata wey we describe earlier na one of the few places where their everyday behaviour really different. So if you never build the box, consider am together with the compatibility promise and older-CPU support wey separate the two.

CentOS Stream na the exception, and the difference serious. Stream repositories no carry updateinfo.xml, so the security filter no fit ever match, and every run dey report No security updates needed. For Stream, use upgrade_type = default and accept say you dey take every update. Stream also dey ahead of RHEL, so that setting dey move more for Stream box than the same setting for Rocky or AlmaLinux. This difference no be packaging accident. E come from Red Hat's 2020 decision to turn CentOS into rolling preview of RHEL, and na the same decision wey bring Rocky Linux and AlmaLinux into existence.

Rocky 10 and AlmaLinux 10 no move to DNF5. As of October 11, 2026, both of dem ship DNF 4.20 for BaseOS (dnf-4.20.0-22.el10_2 for their rebuilt forms) together with dnf-automatic package of the same version. Rocky's own Rocky Linux 10 guide still installs dnf-automatic and enables dnf-automatic.timer. The package name, timer and /etc/dnf/automatic.conf for this guide therefore still apply. DNF5 optional for there: Rocky documentation talk say users fit selectively install dnf5. Its automatic plugin get different setup, with dnf5-automatic.timer and shipped defaults for /usr/share/dnf5/dnf5-plugins/automatic.conf. So follow DNF5 instructions only for box where you install DNF5 yourself. Confirm wetin your release actually install before you copy package or unit names from guide wey Fedora people write, because Fedora dey use DNF5:

dnf list --available '*automatic*'
systemctl list-unit-files '*automatic*'

Many published guides for this topic still cover Rocky 8 only. The option set don grow since dem write those guides, so check the commented file and the man page for your own box instead of trusting old article.

Failure modes and the strings wey you go see

Nothing ever runs. systemctl list-timers dnf-automatic.timer dey print empty table and systemctl is-enabled dnf-automatic.timer dey print disabled. Dem install the package, but dem never install the timer.

The job runs and installs nothing. The journal get No security updates needed, but 3 updates available. The security filter no match anything, either because nothing pending carry advisory or because the repository no publish advisory data.

A setting looks ignored. DNF logs unknown option for automatic.conf at debug level, then e use the default. So misspelled key no change anything and e no warn anybody. Write apply_update = yes and apply_updates remain at no, so the box go download forever but e no go ever install. After any edit, run sudo systemctl start dnf-automatic.service and read the journal instead of trusting the file.

The job runs twice a day. Two timers dey enabled. systemctl list-unit-files 'dnf-automatic*' go show which ones, and the extra ones dey pass flags wey override your config file.

No mail arrives. The shipped file set emit_via = stdio, so mail no dey send until you add email to that line. After that, either nothing dey listen on port 25 for the email emitter, or send_error_messages still dey no and the only thing worth reporting na error.

A patched service still reports the old version. The file for disk new, but the process for memory old. dnf needs-restarting -s dey name the services wey you need restart.

FAQ

dnf-automatic dey install only security updates for Rocky Linux?

Na only if you set upgrade_type = security inside /etc/dnf/automatic.conf, and only if your repositories publish errata metadata. Rocky Linux and AlmaLinux both publish am, so the filter get advisories wey e fit match. The default wey come with am na upgrade_type = default, wey dey install every available update once apply_updates = yes.

Why dnf-automatic dey report "No security updates needed, but 3 updates available"?

DNF dey decide wetin count as security update by reading updateinfo.xml from the repository. Each advisory for there list the packages wey fix am. When that metadata no dey or e stale, the security filter no match anything while normal updates still dey wait. Na that one produce exactly that line. This one dey expected for CentOS Stream because e no publish errata at all. For Rocky or AlmaLinux, compare dnf updateinfo list --security with dnf check-update and confirm say your metadata current.

dnf-automatic go reboot my server after kernel update?

No, unless you tell am make e do so. The reboot option default na never. Set reboot = when-needed, and one run go reboot only when the check behind dnf needs-restarting -r find say a core package like kernel or glibc don replace since boot. reboot = when-changed go reboot after any update wey e apply. Both dey use reboot_command, wey default na shutdown -r +5 with warning message for logged-in users.

How I fit change the time wey dnf-automatic dey run?

Run sudo systemctl edit dnf-automatic.timer and add one [Timer] section with empty OnCalendar= line, then put your schedule after am, for example OnCalendar=*-*-* 03:30. The empty line dey required because OnCalendar dey accumulate. If you leave am out, the shipped 06:00 run go remain and e go add another one. Verify am with systemctl list-timers dnf-automatic.timer and read the NEXT column.

I still need check server wey dey patch itself?

Yes. dnf-automatic dey install packages and stop there. E no restart daemons, and e no report anything wey you go see unless emit_via name an emitter wey you actually dey read. Set emit_via to stdio at minimum, turn on send_error_messages so e go report failures too, and run dnf needs-restarting -s after patch window to find services wey still dey run old code.

Dis article help you?