Sub topic 7
Security-only updates on dnf and on Debian/Ubuntu
Assume you can use a shell with sudo, understand package repositories, and can read systemd status output. Security-only patching installs fixes classified by the distribution as security updates while leaving ordinary bug fixes and feature updates for a later maintenance window.
Why security-only patching is different
Security-only patching reduces the amount of change during an urgent maintenance run. It can lower compatibility risk, but it does not remove risk. A security fix may update a shared library, restart a service, or require a reboot. Security updates can also depend on non-security packages, so the package manager may install supporting dependencies.
The classification comes from repository metadata and advisories. If a repository does not publish reliable security information, the package manager cannot safely select security updates by itself.
Security-only updates with dnf
On RHEL-family systems, dnf uses advisory metadata to identify security fixes. First list the available security advisories:
dnf updateinfo list --securityReview the advisory IDs, severity, affected packages, and whether the update applies to the installed system. Then install only updates marked as security fixes:
sudo dnf upgrade --securityYou can inspect the result afterward:
dnf updateinfo list --securityAn empty result generally means that no applicable security advisories remain. Do not treat an empty result as proof that every installed package is current. Ordinary bug-fix and feature updates may still be pending.
Some environments use yum as a compatibility command, but modern RHEL-family systems normally use dnf. The exact advisory data depends on enabled repositories and on the vendor's subscription or mirror configuration.
Security updates with apt
apt does not provide a universal apt upgrade --security switch that works like dnf upgrade --security. Debian and Ubuntu normally separate security updates through repository configuration and through unattended-upgrades.
Inspect the configured repositories and available versions before changing anything:
grep -R --no-filename -E '^[[:space:]]*deb ' \
/etc/apt/sources.list /etc/apt/sources.list.d/ 2>/dev/null
apt-cache policyThe security repository is commonly identified by a security suite, pocket, or origin. The exact name differs between Debian and Ubuntu releases. unattended-upgrades selects repositories through origin patterns, usually stored under /etc/apt/apt.conf.d/.
Install the tool and perform a dry run:
sudo apt install unattended-upgrades
sudo unattended-upgrade --dry-run --debugThe dry run reports which packages would be installed without changing the system. After reviewing the output, run:
sudo unattended-upgradeOn Debian and Ubuntu, security updates are often enabled for automatic installation while regular updates remain available for a separate review. Verify the origin patterns before relying on that behavior. A dry run is especially useful after changing repository files or upgrading to a new distribution release.
Restart decisions
After either tool completes, check for a reboot requirement and for services that need restarting. On Debian and Ubuntu:
if [ -f /var/run/reboot-required ]; then
echo "Reboot required"
cat /var/run/reboot-required.pkgs 2>/dev/null
fiOn RHEL-family systems:
sudo dnf needs-restarting -r
echo "exit code: $?"Plan a reboot when the kernel, core libraries, or another package reports that running processes use old code. If no reboot is needed, still verify important services and review package-manager logs.
| System family | Security selection | Main limitation |
|---|---|---|
| RHEL-family | `dnf upgrade --security` | Requires advisory metadata |
| Debian/Ubuntu | `unattended-upgrade` origin patterns | No universal apt security-only switch |
Exercise
Why should an administrator run unattended-upgrade --dry-run before installing Debian or Ubuntu security updates?
Show answer
It shows which packages the configured security origins would install, allowing the administrator to verify the selection and detect repository configuration mistakes before changing the system.