<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Frank Durieux</title>
    <description>The latest articles on DEV Community by Frank Durieux (@kyvian).</description>
    <link>https://dev.to/kyvian</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4187988%2F4c2d49f6-9cdf-4b10-baa5-24f8ba1fab7f.png</url>
      <title>DEV Community: Frank Durieux</title>
      <link>https://dev.to/kyvian</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kyvian"/>
    <language>en</language>
    <item>
      <title>How to install only security updates on Ubuntu and Debian with apt</title>
      <dc:creator>Frank Durieux</dc:creator>
      <pubDate>Fri, 27 Nov 2026 09:17:12 +0000</pubDate>
      <link>https://dev.to/kyvian/how-to-install-only-security-updates-on-ubuntu-and-debian-with-apt-2g07</link>
      <guid>https://dev.to/kyvian/how-to-install-only-security-updates-on-ubuntu-and-debian-with-apt-2g07</guid>
      <description>&lt;p&gt;On a production server you often want security fixes in right away and everything else at the next maintenance window. apt has no option for that, so you have to rely on where each package comes from. Here is how to list pending security updates, simulate them and apply only those, with real output from Ubuntu 24.04 and Debian 12 and 13.&lt;/p&gt;

&lt;h2&gt;
  
  
  The short answer
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Goal&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;List pending security updates&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;apt list --upgradable&lt;/code&gt;, keeping the lines that contain &lt;code&gt;-security&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Simulate without installing anything&lt;/td&gt;
&lt;td&gt;&lt;code&gt;apt-get -s upgrade&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Apply only those&lt;/td&gt;
&lt;td&gt;the same filter, piped to &lt;code&gt;apt-get install --only-upgrade&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Do it on a schedule&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;unattended-upgrade&lt;/code&gt; (default configuration)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;apt upgrade --security&lt;/code&gt; does not exist: apt 2.8 replies "Command line option --security is not understood in combination with the other options". Everything depends on which repository the new version comes from.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you list pending security updates?
&lt;/h2&gt;

&lt;p&gt;Refresh the index first, then ask for the upgradable packages. After the name, each line shows the repositories offering the new version (real output from Ubuntu 24.04):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ sudo apt update
$ apt list --upgradable
Listing... Done
libaudit-common/noble-updates 1:3.1.2-2.1ubuntu0.1 all &lt;span class="o"&gt;[&lt;/span&gt;upgradable from: 1:3.1.2-2.1build1.1&lt;span class="o"&gt;]&lt;/span&gt;
libaudit1/noble-updates 1:3.1.2-2.1ubuntu0.1 amd64 &lt;span class="o"&gt;[&lt;/span&gt;upgradable from: 1:3.1.2-2.1build1.1&lt;span class="o"&gt;]&lt;/span&gt;
libssl3t64/noble-updates,noble-security 3.0.13-0ubuntu3.16 amd64 &lt;span class="o"&gt;[&lt;/span&gt;upgradable from: 3.0.13-0ubuntu3.15&lt;span class="o"&gt;]&lt;/span&gt;
perl-base/noble-updates,noble-security 5.38.2-3.2ubuntu0.6 amd64 &lt;span class="o"&gt;[&lt;/span&gt;upgradable from: 5.38.2-3.2ubuntu0.4&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Packages whose origin contains &lt;code&gt;-security&lt;/code&gt; are security fixes. Ubuntu publishes them to &lt;code&gt;noble-security&lt;/code&gt; and copies them to &lt;code&gt;noble-updates&lt;/code&gt;, hence both names. &lt;code&gt;libaudit1&lt;/code&gt;, only in &lt;code&gt;noble-updates&lt;/code&gt;, is a regular update. To keep only the security ones:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ apt list --upgradable 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null &lt;span class="o"&gt;|&lt;/span&gt; grep -- -security
libssl3t64/noble-updates,noble-security 3.0.13-0ubuntu3.16 amd64 &lt;span class="o"&gt;[&lt;/span&gt;upgradable from: 3.0.13-0ubuntu3.15&lt;span class="o"&gt;]&lt;/span&gt;
perl-base/noble-updates,noble-security 5.38.2-3.2ubuntu0.6 amd64 &lt;span class="o"&gt;[&lt;/span&gt;upgradable from: 5.38.2-3.2ubuntu0.4&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;2&amp;gt;/dev/null&lt;/code&gt; hides the "WARNING: apt does not have a stable CLI interface" message, which doesn't matter for a read like this one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changes on Debian (bookworm-security, trixie-security)?
&lt;/h2&gt;

&lt;p&gt;Debian ships security fixes from a separate repository, &lt;code&gt;deb.debian.org/debian-security&lt;/code&gt;, suite &lt;code&gt;bookworm-security&lt;/code&gt; or &lt;code&gt;trixie-security&lt;/code&gt;. But &lt;code&gt;apt list&lt;/code&gt; prints the &lt;em&gt;archive name&lt;/em&gt;, not the codename:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Debian 12 (bookworm)&lt;/span&gt;
$ apt list --upgradable 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null
libpcre2-8-0/oldstable-security 10.42-1+deb12u2 amd64 &lt;span class="o"&gt;[&lt;/span&gt;upgradable from: 10.42-1+deb12u1&lt;span class="o"&gt;]&lt;/span&gt;
perl-base/oldstable-security 5.36.0-7+deb12u4 amd64 &lt;span class="o"&gt;[&lt;/span&gt;upgradable from: 5.36.0-7+deb12u3&lt;span class="o"&gt;]&lt;/span&gt;
tzdata/oldstable-security 2026c-0+deb12u1 all &lt;span class="o"&gt;[&lt;/span&gt;upgradable from: 2026b-0+deb12u1&lt;span class="o"&gt;]&lt;/span&gt;

&lt;span class="c"&gt;# Debian 13 (trixie)&lt;/span&gt;
liblzma5/stable-security 5.8.1-1+deb13u2 amd64 &lt;span class="o"&gt;[&lt;/span&gt;upgradable from: 5.8.1-1+deb13u1&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Debian 12 is now "oldstable", so its fixes show up as &lt;code&gt;oldstable-security&lt;/code&gt;. The &lt;code&gt;-security&lt;/code&gt; filter works on both distributions, but don't look for &lt;code&gt;bookworm-security&lt;/code&gt; in this output.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you simulate the upgrade first?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;apt-get -s&lt;/code&gt; (or &lt;code&gt;--simulate&lt;/code&gt;) computes the transaction without touching anything, and doesn't need root. &lt;code&gt;Inst&lt;/code&gt; lines show the current version in brackets, then the new one and its origin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ apt-get -s upgrade &lt;span class="o"&gt;|&lt;/span&gt; grep ^Inst
Inst perl-base &lt;span class="o"&gt;[&lt;/span&gt;5.38.2-3.2ubuntu0.4&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;5.38.2-3.2ubuntu0.6 Ubuntu:24.04/noble-updates, Ubuntu:24.04/noble-security &lt;span class="o"&gt;[&lt;/span&gt;amd64&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
Inst libaudit-common &lt;span class="o"&gt;[&lt;/span&gt;1:3.1.2-2.1build1.1&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;1:3.1.2-2.1ubuntu0.1 Ubuntu:24.04/noble-updates &lt;span class="o"&gt;[&lt;/span&gt;all&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
Inst libaudit1 &lt;span class="o"&gt;[&lt;/span&gt;1:3.1.2-2.1build1.1&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;1:3.1.2-2.1ubuntu0.1 Ubuntu:24.04/noble-updates &lt;span class="o"&gt;[&lt;/span&gt;amd64&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
Inst libssl3t64 &lt;span class="o"&gt;[&lt;/span&gt;3.0.13-0ubuntu3.15&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;3.0.13-0ubuntu3.16 Ubuntu:24.04/noble-updates, Ubuntu:24.04/noble-security &lt;span class="o"&gt;[&lt;/span&gt;amd64&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the moment to spot a sensitive package: kernel, OpenSSL, database, web server.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you install only the security updates?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Method 1: filter the list and pass the names to apt
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apt list --upgradable 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null &lt;span class="o"&gt;|&lt;/span&gt; grep -- -security &lt;span class="o"&gt;|&lt;/span&gt; cut -d/ -f1 \
  &lt;span class="o"&gt;|&lt;/span&gt; xargs -r sudo apt-get install -y --only-upgrade
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--only-upgrade&lt;/code&gt; skips any listed package that isn't installed: apt then replies "Skipping curl, it is not installed and only upgrades are requested". A new version can still pull in a dependency it requires, so check the simulation first. Afterwards, only the regular updates are left:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ apt list --upgradable 2&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/dev/null
Listing... Done
libaudit-common/noble-updates 1:3.1.2-2.1ubuntu0.1 all &lt;span class="o"&gt;[&lt;/span&gt;upgradable from: 1:3.1.2-2.1build1.1&lt;span class="o"&gt;]&lt;/span&gt;
libaudit1/noble-updates 1:3.1.2-2.1ubuntu0.1 amd64 &lt;span class="o"&gt;[&lt;/span&gt;upgradable from: 1:3.1.2-2.1build1.1&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Method 2: run apt with the security repository only
&lt;/h3&gt;

&lt;p&gt;Give apt a source list that only contains the &lt;code&gt;-security&lt;/code&gt; repository. Every candidate version then comes from it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Ubuntu 24.04, and Debian when /etc/apt/sources.list.d/debian.sources exists: deb822 format&lt;/span&gt;
sudo mkdir -p /etc/apt/security-only
awk -v &lt;span class="nv"&gt;RS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; -v &lt;span class="nv"&gt;ORS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'\n\n'&lt;/span&gt; &lt;span class="s1"&gt;'/-security/'&lt;/span&gt; /etc/apt/sources.list.d/ubuntu.sources \
  &lt;span class="o"&gt;|&lt;/span&gt; sudo tee /etc/apt/security-only/security.sources
&lt;span class="c"&gt;# (on Debian: /etc/apt/sources.list.d/debian.sources)&lt;/span&gt;

sudo apt-get -s upgrade -o Dir::Etc::SourceList=/dev/null \
  -o Dir::Etc::SourceParts=/etc/apt/security-only
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Inst perl-base &lt;span class="o"&gt;[&lt;/span&gt;5.38.2-3.2ubuntu0.4&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;5.38.2-3.2ubuntu0.6 Ubuntu:24.04/noble-security &lt;span class="o"&gt;[&lt;/span&gt;amd64&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
Inst libssl3t64 &lt;span class="o"&gt;[&lt;/span&gt;3.0.13-0ubuntu3.15&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;3.0.13-0ubuntu3.16 Ubuntu:24.04/noble-security &lt;span class="o"&gt;[&lt;/span&gt;amd64&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On Ubuntu 22.04, and on Debian when sources live in &lt;code&gt;/etc/apt/sources.list&lt;/code&gt; (common on a regular Debian 12 install), in the one-line format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Ubuntu 22.04, and Debian when sources live in /etc/apt/sources.list: one-line format&lt;/span&gt;
grep &lt;span class="s1"&gt;'^deb .*-security'&lt;/span&gt; /etc/apt/sources.list &lt;span class="o"&gt;|&lt;/span&gt; sudo tee /etc/apt/security.list
sudo apt-get -s upgrade -o Dir::Etc::SourceList=/etc/apt/security.list \
  -o Dir::Etc::SourceParts=/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Drop &lt;code&gt;-s&lt;/code&gt; to apply. The catch: if a security fix depends on a version that only exists in &lt;code&gt;-updates&lt;/code&gt;, apt can't see it and holds the package back. Method 1 doesn't have this problem, since all sources stay enabled.&lt;/p&gt;

&lt;h3&gt;
  
  
  Method 3: run unattended-upgrade by hand
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;unattended-upgrades&lt;/code&gt; package already sorts by origin. Run manually, it applies whatever its configuration allows, then exits:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ sudo apt install unattended-upgrades
$ sudo unattended-upgrade --dry-run -v      &lt;span class="c"&gt;# simulate&lt;/span&gt;
$ sudo unattended-upgrade -v                &lt;span class="c"&gt;# apply&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Debian 12, excerpt from "unattended-upgrade --dry-run -v"&lt;/span&gt;
Allowed origins are: &lt;span class="nv"&gt;origin&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Debian,codename=bookworm,label=Debian, &lt;span class="nv"&gt;origin&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Debian,codename=bookworm,label=Debian-Security, &lt;span class="nv"&gt;origin&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Debian,codename=bookworm-security,label=Debian-Security
Option --dry-run given, *not* performing real actions
Packages that will be upgraded: libpcre2-8-0 perl-base tzdata
All upgrades installed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Mind the difference between the two distributions&lt;/strong&gt; — On Ubuntu, the default configuration only allows the security pocket (plus the release pocket, frozen after release, and Ubuntu Pro's ESM repositories): in the example above, &lt;code&gt;libaudit1&lt;/code&gt; stays pending. On Debian, it also allows &lt;code&gt;label=Debian&lt;/code&gt;, meaning point-release updates (12.x). Scheduling, email reports and the limits on a fleet are covered in &lt;a href="https://kyvian.io/en/guides/unattended-upgrades-multiple-servers/" rel="noopener noreferrer"&gt;unattended-upgrades on multiple servers&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What to do after the update
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A new kernel or &lt;code&gt;libc&lt;/code&gt; is only used after a reboot: see &lt;a href="https://kyvian.io/en/guides/check-if-linux-server-needs-reboot/" rel="noopener noreferrer"&gt;how to check if a Linux server needs a reboot&lt;/a&gt; (&lt;code&gt;/var/run/reboot-required&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;A library such as OpenSSL is only picked up by a service when that service restarts. On Ubuntu Server, &lt;code&gt;needrestart&lt;/code&gt; can restart the affected services right away.&lt;/li&gt;
&lt;li&gt;Running Debian next to RHEL? The dnf equivalent is in &lt;a href="https://kyvian.io/en/guides/dnf-security-updates-almalinux-rocky-rhel/" rel="noopener noreferrer"&gt;security updates on AlmaLinux, Rocky and RHEL&lt;/a&gt;, and the zypper one in &lt;a href="https://kyvian.io/en/guides/zypper-security-patches-suse/" rel="noopener noreferrer"&gt;security patches on SUSE&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Doing this across a fleet (disclosure: I build Kyvian)
&lt;/h2&gt;

&lt;p&gt;The Kyvian agent reads the same signal as method 1: it runs &lt;code&gt;apt list --upgradable&lt;/code&gt; every 6 hours (or on demand) and flags any package whose origin contains &lt;code&gt;security&lt;/code&gt;. The "Patch security" button then runs &lt;code&gt;apt-get update&lt;/code&gt; followed by &lt;code&gt;apt-get install --only-upgrade -y&lt;/code&gt; with just those packages. If &lt;code&gt;unattended-upgrades&lt;/code&gt; already holds the apt lock, the command waits (up to 3 minutes per step) instead of failing. Every update is confirmed before it runs; the steps are listed and the exact command can be copied.&lt;/p&gt;

&lt;p&gt;It pays off as the number of servers grows: pending security updates for the whole fleet in one table, with no SSH connection (the agent connects out over HTTPS). Details on &lt;a href="https://kyvian.io/en/patch-management-ubuntu-debian/" rel="noopener noreferrer"&gt;Ubuntu and Debian patch management&lt;/a&gt; and &lt;a href="https://kyvian.io/en/linux-patch-management/" rel="noopener noreferrer"&gt;Linux patch management&lt;/a&gt;. The Discovery plan covers 5 VMs for free, with no time limit and no credit card: &lt;a href="https://kyvian.io/en/free-trial/" rel="noopener noreferrer"&gt;try Kyvian&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://kyvian.io/en/guides/apt-install-only-security-updates/" rel="noopener noreferrer"&gt;kyvian.io&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>ubuntu</category>
      <category>security</category>
      <category>sysadmin</category>
    </item>
    <item>
      <title>How to apply only security updates on AlmaLinux, Rocky Linux and RHEL with dnf</title>
      <dc:creator>Frank Durieux</dc:creator>
      <pubDate>Sun, 18 Oct 2026 09:03:14 +0000</pubDate>
      <link>https://dev.to/kyvian/how-to-apply-only-security-updates-on-almalinux-rocky-linux-and-rhel-with-dnf-fik</link>
      <guid>https://dev.to/kyvian/how-to-apply-only-security-updates-on-almalinux-rocky-linux-and-rhel-with-dnf-fik</guid>
      <description>&lt;p&gt;Unlike apt, dnf can tell security fixes apart natively: each distribution publishes advisories in its repositories (ALSA for AlmaLinux, RLSA for Rocky, RHSA for Red Hat) with a severity and a list of CVEs. Here is how to list them, apply only those or only the most severe, automate them with dnf-automatic and check whether a reboot is needed. Real output from AlmaLinux 9.8.&lt;/p&gt;

&lt;h2&gt;
  
  
  The short answer
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Goal&lt;/th&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;How many security advisories are pending?&lt;/td&gt;
&lt;td&gt;&lt;code&gt;dnf updateinfo&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Which packages, which advisories?&lt;/td&gt;
&lt;td&gt;&lt;code&gt;dnf updateinfo list security&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Simulate&lt;/td&gt;
&lt;td&gt;&lt;code&gt;dnf upgrade --security --assumeno&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Apply&lt;/td&gt;
&lt;td&gt;&lt;code&gt;dnf upgrade --security&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Only the most severe&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;dnf upgrade --sec-severity=Critical&lt;/code&gt; (or &lt;code&gt;Important&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Automate&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;dnf-automatic&lt;/code&gt; with &lt;code&gt;upgrade_type = security&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reboot needed?&lt;/td&gt;
&lt;td&gt;&lt;code&gt;needs-restarting -r&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These commands behave the same on AlmaLinux and Rocky Linux 8, 9 and 10 (dnf 4.7 to 4.20). RHEL ships the same dnf versions. One exception, covered below: dnf-automatic's &lt;code&gt;reboot&lt;/code&gt; option does not exist on version 8.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you list pending security updates?
&lt;/h2&gt;

&lt;p&gt;Start with the summary, which counts advisories by severity:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;dnf updateinfo
Updates Information Summary: available
    12 Security notice&lt;span class="o"&gt;(&lt;/span&gt;s&lt;span class="o"&gt;)&lt;/span&gt;
         7 Important Security notice&lt;span class="o"&gt;(&lt;/span&gt;s&lt;span class="o"&gt;)&lt;/span&gt;
         5 Moderate Security notice&lt;span class="o"&gt;(&lt;/span&gt;s&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;dnf check-update --security&lt;/code&gt; lists the packages involved. Its exit code is &lt;strong&gt;100&lt;/strong&gt; when updates are available, 0 when there are none and 1 on error, which is handy in a monitoring check.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;dnf check-update &lt;span class="nt"&gt;--security&lt;/span&gt;
coreutils-single.x86_64              8.32-41.el9_8.1                      baseos
curl-minimal.x86_64                  7.76.1-40.el9_8.7                    baseos
expat.x86_64                         2.5.0-6.el9_8.5                      baseos
&lt;span class="o"&gt;(&lt;/span&gt;…&lt;span class="o"&gt;)&lt;/span&gt;
openssl.x86_64                       1:3.5.8-1.el9_8                      baseos
openssl-libs.x86_64                  1:3.5.8-1.el9_8                      baseos
pam.x86_64                           1.5.1-28.el9_8.1                     baseos
vim-minimal.x86_64                   2:8.2.2637-26.el9_8.23               baseos
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$?&lt;/span&gt;
100
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;dnf updateinfo list security&lt;/code&gt; (or &lt;code&gt;list --security&lt;/code&gt;) adds the advisory ID and severity for each package. On this server, 14 security lines out of 18 pending updates (excerpt):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;dnf updateinfo list security
ALSA-2026:66403 Moderate/Sec.  coreutils-single-8.32-41.el9_8.1.x86_64
ALSA-2026:69126 Important/Sec. curl-minimal-7.76.1-40.el9_8.7.x86_64
ALSA-2026:72663 Important/Sec. expat-2.5.0-6.el9_8.5.x86_64
ALSA-2026:73512 Moderate/Sec.  gawk-5.1.0-6.el9_8.1.x86_64
ALSA-2026:67165 Important/Sec. openssl-1:3.5.8-1.el9_8.x86_64
ALSA-2026:67165 Important/Sec. openssl-libs-1:3.5.8-1.el9_8.x86_64
ALSA-2026:64815 Moderate/Sec.  pam-1.5.1-28.el9_8.1.x86_64
&lt;span class="o"&gt;(&lt;/span&gt;…&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Rocky Linux 9: same commands, RLSA advisories&lt;/span&gt;
RLSA-2025:23343 Moderate/Sec.  binutils-2.35.2-67.el9_7.1.x86_64
RLSA-2025:0925  Moderate/Sec.  bzip2-libs-1.0.8-10.el9_5.x86_64
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To filter by severity: &lt;code&gt;dnf updateinfo list --sec-severity=Important&lt;/code&gt;. The levels are &lt;code&gt;Critical&lt;/code&gt;, &lt;code&gt;Important&lt;/code&gt;, &lt;code&gt;Moderate&lt;/code&gt; and &lt;code&gt;Low&lt;/code&gt;. To also show each advisory's CVEs: &lt;code&gt;dnf updateinfo list --security --with-cve&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you read an advisory?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;dnf updateinfo info ALSA-2026:67165
&lt;span class="o"&gt;===============================================================================&lt;/span&gt;
  Important: openssl security, bug fix, and enhancement update
&lt;span class="o"&gt;===============================================================================&lt;/span&gt;
  Update ID: ALSA-2026:67165
       Type: security
    Updated: 2026-09-15 08:35:12
       CVEs: CVE-2026-14456
           : CVE-2026-14457
&lt;span class="o"&gt;(&lt;/span&gt;…&lt;span class="o"&gt;)&lt;/span&gt;
Description: OpenSSL is a toolkit that implements the Secure Sockets Layer &lt;span class="o"&gt;(&lt;/span&gt;SSL&lt;span class="o"&gt;)&lt;/span&gt; and Transport Layer Security &lt;span class="o"&gt;(&lt;/span&gt;TLS&lt;span class="o"&gt;)&lt;/span&gt; protocols, &lt;span class="o"&gt;(&lt;/span&gt;…&lt;span class="o"&gt;)&lt;/span&gt;
           : Security Fix&lt;span class="o"&gt;(&lt;/span&gt;es&lt;span class="o"&gt;)&lt;/span&gt;:
           :   &lt;span class="k"&gt;*&lt;/span&gt; openssl: OpenSSL: Denial of Service via unbounded memory growth &lt;span class="k"&gt;in &lt;/span&gt;QUIC server &lt;span class="o"&gt;(&lt;/span&gt;CVE-2026-14456&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each advisory gives its severity, the CVEs it fixes and one line per vulnerability: enough to judge how urgent it is, or to answer "is this server patched for that CVE?".&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you simulate, then apply only security updates?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;--assumeno&lt;/code&gt; resolves the transaction, prints it and answers "no" to the prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf upgrade &lt;span class="nt"&gt;--security&lt;/span&gt; &lt;span class="nt"&gt;--assumeno&lt;/span&gt;
Upgrading:
 coreutils-single        x86_64   8.32-41.el9_8.1             baseos      599 k
 curl-minimal            x86_64   7.76.1-40.el9_8.7           baseos      127 k
&lt;span class="o"&gt;(&lt;/span&gt;…&lt;span class="o"&gt;)&lt;/span&gt;
 openssl-fips-provider   x86_64   1:3.5.8-1.el9_8             baseos      813 k
 openssl-libs            x86_64   1:3.5.8-1.el9_8             baseos      2.3 M
 pam                     x86_64   1.5.1-28.el9_8.1            baseos      543 k
 vim-minimal             x86_64   2:8.2.2637-26.el9_8.23      baseos      675 k
Installing weak dependencies:
 gawk-all-langpacks      x86_64   5.1.0-6.el9_8.1             appstream   206 k

Transaction Summary
&lt;span class="o"&gt;================================================================================&lt;/span&gt;
Install   1 Package
Upgrade  13 Packages

Total download size: 12 M
Operation aborted.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note the "Installing weak dependencies" line: even limited to security, an update can &lt;em&gt;install&lt;/em&gt; a package that wasn't there before (here a weak dependency of &lt;code&gt;gawk&lt;/code&gt;). To prevent it: &lt;code&gt;--setopt=install_weak_deps=False&lt;/code&gt;. Drop &lt;code&gt;--assumeno&lt;/code&gt; to apply. Afterwards, only updates without a security advisory are left:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nt"&gt;-y&lt;/span&gt; upgrade &lt;span class="nt"&gt;--security&lt;/span&gt;
&lt;span class="o"&gt;(&lt;/span&gt;…&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;dnf check-update
gnutls.x86_64                          3.8.10-9.el9_8                     baseos
systemd.x86_64                         252-67.el9_8.6.alma.1              baseos
systemd-libs.x86_64                    252-67.el9_8.6.alma.1              baseos
&lt;span class="o"&gt;(&lt;/span&gt;…&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Can you target a severity, an advisory or a CVE?
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Only "Important" advisories (9 packages instead of 13 here)&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf upgrade &lt;span class="nt"&gt;--sec-severity&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Important

&lt;span class="c"&gt;# One specific advisory (openssl, openssl-libs, openssl-fips-provider)&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf upgrade &lt;span class="nt"&gt;--advisory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ALSA-2026:67165

&lt;span class="c"&gt;# Packages that fix a given CVE&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf upgrade &lt;span class="nt"&gt;--cve&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;CVE-2026-14456

&lt;span class="c"&gt;# The nearest fixed version rather than the latest one&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf upgrade-minimal &lt;span class="nt"&gt;--security&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All four work with &lt;code&gt;--assumeno&lt;/code&gt; so you can check before applying. &lt;code&gt;--advisory&lt;/code&gt; picks exactly the advisory's packages (here, the three OpenSSL packages). &lt;code&gt;upgrade-minimal --security&lt;/code&gt; produces the same transaction as &lt;code&gt;upgrade --security&lt;/code&gt; when the repository only offers one fixed version per package.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you automate it with dnf-automatic?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;dnf-automatic&lt;/code&gt; reads &lt;code&gt;/etc/dnf/automatic.conf&lt;/code&gt;. The setting that matters is &lt;code&gt;upgrade_type&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# /etc/dnf/automatic.conf, [commands] section (excerpt, as shipped on AlmaLinux 9)&lt;/span&gt;
&lt;span class="c"&gt;#  What kind of upgrade to perform:&lt;/span&gt;
&lt;span class="c"&gt;# default                            = all available upgrades&lt;/span&gt;
&lt;span class="c"&gt;# security                           = only the security upgrades&lt;/span&gt;
upgrade_type &lt;span class="o"&gt;=&lt;/span&gt; security          &lt;span class="c"&gt;# shipped as "default"&lt;/span&gt;
random_sleep &lt;span class="o"&gt;=&lt;/span&gt; 0
download_updates &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;yes
&lt;/span&gt;apply_updates &lt;span class="o"&gt;=&lt;/span&gt; no
reboot &lt;span class="o"&gt;=&lt;/span&gt; never
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The package ships four systemd timers. &lt;code&gt;dnf-automatic-install.timer&lt;/code&gt; downloads and installs regardless of &lt;code&gt;apply_updates&lt;/code&gt;; &lt;code&gt;dnf-automatic.timer&lt;/code&gt; follows the configuration file; &lt;code&gt;-download&lt;/code&gt; and &lt;code&gt;-notifyonly&lt;/code&gt; only download or notify. On AlmaLinux 9:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;install &lt;/span&gt;dnf-automatic
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo sed&lt;/span&gt; &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s1"&gt;'s/^upgrade_type = default/upgrade_type = security/'&lt;/span&gt; /etc/dnf/automatic.conf
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;systemctl &lt;span class="nb"&gt;enable&lt;/span&gt; &lt;span class="nt"&gt;--now&lt;/span&gt; dnf-automatic-install.timer
&lt;span class="nv"&gt;$ &lt;/span&gt;systemctl list-timers &lt;span class="s1"&gt;'dnf-automatic*'&lt;/span&gt;
NEXT                        LEFT     LAST PASSED UNIT                        ACTIVATES
Sat 2026-10-10 06:02:08 UTC 22h left -    -      dnf-automatic-install.timer dnf-automatic-install.service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;journalctl &lt;span class="nt"&gt;-u&lt;/span&gt; dnf-automatic-install.service   &lt;span class="c"&gt;# excerpt, different container from the simulation&lt;/span&gt;
srv dnf-automatic[100]: Install   1 Package
srv dnf-automatic[100]: Upgrade  14 Packages
srv dnf-automatic[100]: Updates completed at Fri Oct  9 07:22:29 2026
srv systemd[1]: Finished dnf automatic &lt;span class="nb"&gt;install &lt;/span&gt;updates.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two settings worth knowing. &lt;code&gt;emit_via = stdio&lt;/code&gt; (as shipped) only writes the report to the systemd journal: to get an email, switch to &lt;code&gt;emit_via = email&lt;/code&gt; and fill in the &lt;code&gt;[email]&lt;/code&gt; section, which requires a reachable SMTP server. On versions 9 and 10, &lt;code&gt;reboot&lt;/code&gt; accepts &lt;code&gt;never&lt;/code&gt;, &lt;code&gt;when-changed&lt;/code&gt; or &lt;code&gt;when-needed&lt;/code&gt;: by default (the &lt;code&gt;reboot_command&lt;/code&gt; setting) it runs &lt;code&gt;shutdown -r +5&lt;/code&gt;, five minutes after the updates, with no further confirmation. On version 8, dnf-automatic 4.7 has no such option and silently ignores it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do you need to reboot after security updates?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;needs-restarting -r&lt;/code&gt; compares the install time of critical packages (kernel, glibc, systemd…) with the boot time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;install &lt;/span&gt;yum-utils        &lt;span class="c"&gt;# provides needs-restarting&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;needs-restarting &lt;span class="nt"&gt;-r&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"exit code: &lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
No core libraries or services have been updated since boot-up.
Reboot should not be necessary.
&lt;span class="nb"&gt;exit &lt;/span&gt;code: 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Exit code 1 means a reboot is recommended. The details, and the Debian and SUSE equivalents, are in &lt;a href="https://kyvian.io/en/guides/check-if-linux-server-needs-reboot/" rel="noopener noreferrer"&gt;how to check if a Linux server needs a reboot&lt;/a&gt;. For a mixed fleet, see also &lt;a href="https://kyvian.io/en/guides/apt-install-only-security-updates/" rel="noopener noreferrer"&gt;security updates with apt&lt;/a&gt; and &lt;a href="https://kyvian.io/en/guides/zypper-security-patches-suse/" rel="noopener noreferrer"&gt;security patches with zypper&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Doing this across a fleet (disclosure: I build Kyvian)
&lt;/h2&gt;

&lt;p&gt;The Kyvian agent relies on the same advisories: it reads &lt;code&gt;dnf check-update&lt;/code&gt; for the inventory and &lt;code&gt;dnf updateinfo list security&lt;/code&gt; to flag security fixes, every 6 hours or on demand. The "Patch security" button runs &lt;code&gt;dnf makecache&lt;/code&gt; then &lt;code&gt;dnf update --security -y&lt;/code&gt;, after a confirmation that lists the steps and lets you copy the exact command. Reboot detection uses &lt;code&gt;needs-restarting -r&lt;/code&gt;, so the same condition applies: &lt;code&gt;yum-utils&lt;/code&gt; must be installed.&lt;/p&gt;

&lt;p&gt;No hidden automation: nothing is applied without an action from you, or a maintenance window you scheduled (a reboot, a shutdown, or a command of your choice). The agent connects out over HTTPS, with no SSH port open. Details on &lt;a href="https://kyvian.io/en/patch-management-rhel-almalinux/" rel="noopener noreferrer"&gt;RHEL and AlmaLinux patch management&lt;/a&gt; and &lt;a href="https://kyvian.io/en/linux-patch-management/" rel="noopener noreferrer"&gt;Linux patch management&lt;/a&gt;. The Discovery plan covers 5 VMs for free, with no time limit and no credit card: &lt;a href="https://kyvian.io/en/free-trial/" rel="noopener noreferrer"&gt;try Kyvian&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://kyvian.io/en/guides/dnf-security-updates-almalinux-rocky-rhel/" rel="noopener noreferrer"&gt;kyvian.io&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>security</category>
      <category>sysadmin</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
