Sub topic 5
Seeing What Is Pending Before You Change Anything
Before you begin
This chapter assumes you can use a Linux shell with sudo, understand packages and repositories, and read basic systemd status output. The examples use Debian or Ubuntu with apt, and RHEL-family systems such as RHEL, Rocky Linux, AlmaLinux, or Fedora Server with dnf.
Reviewing updates is a separate step from installing them. First, refresh repository metadata. Metadata is the local list of package versions and update information. Refreshing it does not install or remove packages. After the refresh, inspect the proposed changes and decide whether they fit your maintenance window.
flowchart TD
A[Refresh repository metadata] --> B[Display pending updates]
B --> C[Inspect package names and versions]
C --> D[Check maintenance window and dependencies]
D --> E[Choose whether to apply updates]caption: Review updates before installation alt: A flowchart showing metadata refresh followed by reviewing updates and deciding whether to install them.
List pending updates with apt
On Debian and Ubuntu, refresh the package index and list packages that have newer repository versions:
sudo apt update
apt list --upgradableapt update contacts the configured repositories and downloads current metadata. It does not upgrade the server. apt list --upgradable then compares installed versions with the versions described by that metadata.
The output can include package names, installed versions, repository versions, and repository components. A long list does not automatically mean every package should be updated immediately. Look for packages that affect:
- Network access, SSH, storage, or authentication.
- Running application services.
- The kernel or other core system libraries.
- Packages held back by dependency changes.
For a more detailed simulation of a normal upgrade, use:
apt upgrade --simulateThe simulation shows the intended actions without changing installed packages. Review the number of packages to install, upgrade, or remove. A normal apt upgrade avoids changes that require removing packages or installing new dependencies. A later chapter covers broader upgrade choices.
List pending updates with dnf
On RHEL-family systems, use dnf check-update:
dnf check-update
echo "exit code: $?"The command lists available updates. Its exit status has a special meaning:
| Exit status | Meaning |
|---|---|
| 0 | No updates are available |
| 100 | Updates are available |
| 1 or another error | The check failed |
The status is useful in scripts, but a status of 100 is not a failure in the usual sense. It means that the check found work to review.
You can inspect one package in more detail without installing it:
dnf info nginxTo see the transaction that a future upgrade would perform, use a download-only or transaction preview method supported by your installed DNF version. At minimum, read the dnf upgrade summary carefully before confirming it. Pay attention to packages being removed, newly installed dependencies, and changes to enabled repositories.
A repeatable review
Use this sequence on each server:
- Refresh metadata.
- Save or copy the pending package list.
- Identify updates that affect critical services.
- Check available disk space and the planned outage window.
- Compare the proposed changes with your change record.
- Apply updates only after the review is complete.
Exercise
On a Debian server, which command refreshes package metadata without installing updates, and which command lists packages that can be upgraded?
Show answer
sudo apt update refreshes the metadata, and apt list --upgradable lists the available package upgrades.