Rocky Linux 10 Tutorial / Diagnose package errors and undo a verified DNF transaction
Package errors in Rocky Linux 10 must be resolved after distinguishing between issues with names, repositories, metadata, dependencies, and installation files. DNF history is used to investigate what has changed and to revert specific package operations, but it is not a backup that restores user data or the entire server to a previous state.
Collect the error messages and current status first
When an error occurs, record the command initially executed before repeating it or adding forced options, the full error message, the exit status, and the current installation status. If the SSH connection was disconnected midway, the actual package installation may have been completed, so check the saved state first.
cat /etc/rocky-release
dnf --version
rpm -q tree
dnf repolist --enabled
sudo dnf history list
sudo dnf check
DNF (Dandified YUM) is a tool for managing packages and dependencies in repositories, while RPM (RPM Package Manager) is a fundamental tool for managing information and files of installed packages. The recorded source lab environment was Rocky Linux 10.2, DNF 4.20.0, and RPM 4.19.1.1. The default repository was used on a dedicated virtual machine (VM), and tree was not installed at the start. dnf check checks for consistency issues such as the dependencies of installed packages, and the fact that there is no output does not mean that all services or user data were inspected.
| Representative clues | Issues to distinguish first |
|---|---|
| No match for argument | Whether the name, version, and architecture are correct, and whether the required repository provides them |
| Metadata, mirror, or name resolution errors | Network, DNS, time, proxy, cache, and repository status |
| Nothing provides, conflicting requests | Required dependencies, currently installed versions, repository combinations |
| Signature key or certificate errors | Accurate source and official key·system time·certificate verification |
| Missing executable files or documents | Installation status·package ownership relations·actual file differences |
If it is a lock error, first check whether another DNF·RPM operation or automatic update is running and wait for it to finish. Do not make deleting lock files·RPM database arbitrarily or forcibly terminating normal operations the first solution.
Separate name errors and repository·dependency issues
In the source lab, a deliberate query used a non-existent practice package name to reproduce the following error. --assumeno is not approved for installation.
sudo dnf --assumeno install lf-course-missing-package-20261112
No match for argument: lf-course-missing-package-20261112
Error: Unable to find a match: lf-course-missing-package-20261112
At this point, the exit status was 1. Check the actual package name and source according to the error.
dnf search tree
dnf info tree
dnf provides /usr/bin/tree
dnf repoquery --requires --resolve tree
sudo dnf --assumeno install tree
In the same environment, tree was confirmed as a candidate for 2.1.0-8.el10.x86_64 in BaseOS, and there was one installation plan. This comparison is a test to distinguish between incorrectly used names and normal candidates. If the required package exists only in an additional repository, use the repository guide to check its role, enabled status and supported combinations. Simply correcting the name does not resolve all dependency conflicts.
For nothing provides, identify the missing library or capability and the package requiring it. Check the OS major release, repository compatibility and conflicting candidates. Do not bypass dependencies with RPM’s --nodeps, disable signature verification or apply DNF’s --allowerasing indiscriminately. Review every proposed removal and the services affected before approving a solution.
Apply cache clearing according to the cause you have identified.
If the list is old or it cannot be queried due to cache limits, first recheck the metadata from the current repository.
sudo dnf --refresh info tree
In the package search exercise , the query failed due to a lack of cache for the list of files required by dnf -C provides, but when -C was excluded and a normal query was performed, the necessary information was obtained. Failure to query using only the cache and the absence of the package in the repository are different issues.
Refer to the DNF official command , where clean expire-cache expires cached metadata for revalidation, clean metadata has its metadata removed so it can be downloaded again later, and clean all clears multiple caches together. Therefore, if you clear the entire cache every time, you may only increase downloads without resolving the cause.
If metadata corruption is detected and cleanup is necessary, select the required range like a re-query of sudo dnf clean metadata and a normal repository. For the practice in this article, the normal cache was not intentionally deleted, nor were the repository or certificate verifications weakened.
Find missing files with RPM and restore them through reinstallation.
Querying the owner and verifying the installation files are different tasks. rpm -qf finds the owning package, while rpm -V compares the attributes recorded in the installation database with the current files. The meaning can also be confirmed in RPM official command reference , and the steps below were tested on RPM 4.19.1.1 on this VM.
The following reproduction is only performed on a dedicated VM without work data. Files are not deliberately moved on servers already using tree. First, review the installation plan, install tree, and record the actual installation transaction ID.
sudo dnf --assumeno install tree
sudo dnf install tree
sudo dnf history info last
rpm -qf /usr/share/doc/tree/README
rpm -V tree
The installation ID on this VM for this session was 6, and one tree was installed. IDs differ on other computers. The reproduction below moves only one README document belonging to this package instead of executable files or service settings. If it is not the expected version, document, or new backup location, stop before making changes.
sudo bash <<'BASH'
set -eu
test "$(rpm -qf /usr/share/doc/tree/README)" = tree-2.1.0-8.el10.x86_64
test -f /usr/share/doc/tree/README
test ! -e /root/lf-course-12-before
mkdir -m 700 /root/lf-course-12-before
mv -- /usr/share/doc/tree/README /root/lf-course-12-before/tree-README
BASH
rpm -V tree
printf 'verify exit=%s\n' "$?"
If your version is different or a backup folder already exists, the above condition checks are not removed to force a pass. Verify the file path and practice preparation status again. On this VM, the following results and exit status 1 were confirmed.
missing d /usr/share/doc/tree/README
missing means that there is no registered file, and d indicates a document file. rpm -V only reports the issue and does not restore the content of this document. Check whether the actual changes or omissions were intended, and then read the reinstallation plan.
sudo dnf --assumeno reinstall tree
sudo dnf reinstall tree
sudo cmp /root/lf-course-12-before/tree-README /usr/share/doc/tree/README
rpm -V tree
printf 'verify exit=%s\n' "$?"
This practice reinstalled the same version tree of BaseOS. The recovered documents were identical to the backup, cmp ended without any differences, and RPM verification also returned 0 without output. To reinstall, you must obtain the RPM of the exact version currently installed from the source. Configuration files may be handled separately according to the package replacement policy, so commands that always overwrite the operational settings with the originals are not generalized.
If reinstallation fails and the document is still missing, you can copy the backup /root/lf-course-12-before/tree-README made in this practice to the original path /usr/share/doc/tree/README while preserving attributes and verify again. Even in this case, first check whether the target is truly missing to avoid overwriting other changes. Since the actual recovery in this instance was successful, the path to re-copy the backup was not executed.
Read the history columns and detailed records together.
sudo dnf history list tree
sudo dnf history info last
This installation was recorded with ID 6, and the reinstallation was recorded with ID 7. The Action(s) for the reinstallation was R and Altered was 2, but the Reinstall and Reinstalled in the detailed list were replacement actions of the same tree package. Interpreting Altered 2 as meaning that two different programs were installed leads to an incorrect conclusion.
| Items to Check | Content to Interpret |
|---|---|
| ID · Command line · Time | Which command was executed when, and whether it matches the change currently under investigation |
| Action(s) | Types of actions performed such as install, upgrade, removal, reinstallation |
| Altered · Additional Symbol | Number of change actions and additional status hints. Compare with the detailed package list |
| Return-Code · Packages Altered | Resulting status and the actual changed packages · version · source |
| Scriptlet output | Guidance or warnings left by package scripts executed during installation or removal |
The * column for Altered may indicate incomplete transactions, # indicates tasks that ended in a non-zero state, and E may indicate successful completion but with warnings or error outputs. In actual past EPEL setup installation histories, the E mark was also visible, but the detailed Return-Code was Success and the script guidance could be checked. Do not conclude overall installation failure or compromise based on just one symbol.
Database status indicators like < and > also provide clues for comparing previous and subsequent actions and the full history. Do not just look at the list filtered by package name; if necessary, check the entire sudo dnf history list and detailed records for the relevant ID. Do not assume failed commands are recorded in history in the same way as successful transactions; original error outputs should also be retained.
Undo one verified installation transaction
This exercise rolls back the installation of a single tree that was performed on a VM that did not initially have tree. Also, create one user note to check if it remains separate from the package task. If a file with the same name exists, do not overwrite it; use a different new practice path.
test ! -e ~/history-lab-note.txt && printf 'keep my notes\n' > ~/history-lab-note.txt
cat ~/history-lab-note.txt
sudo dnf history list tree
In the list, find the standalone tree installation transaction for this lab. Use its actual ID, not the source lab’s example value of 6.
read -r -p 'Verified tree installation ID: ' TXID
if [[ "$TXID" =~ ^[1-9][0-9]*$ ]]; then
sudo dnf history info "$TXID"
sudo dnf --assumeno history undo "$TXID"
else
printf 'Enter a positive numeric transaction ID. Stop and check the history.\n' >&2
unset TXID
fi
Check whether the detailed record shows the intended installation and only the tree to be removed in the rollback plan. It is not approved if other programs or configuration packages are included, or if it was a tree already in use at startup. The rollback plan for ID 6 of this VM was Remove 1 Package and tree, and it was applied after review.
sudo dnf history undo "${TXID:?Read and verify a positive numeric transaction ID first}"
rpm -q tree
cat ~/history-lab-note.txt
sudo dnf history info last
sudo dnf check
In the actual result, the tree returned to the uninstalled state, and the rollback operation of ID 8 remained as Success. The user note keep my notes remained unchanged. That is, the reverse operation of the installation was performed, but user-created files were not reverted to the past. After checking, only the notes personally created were organized as rm -- ~/history-lab-note.txt.
The recorded source test undid only the verified single-package tree installation. Previous EPEL settings, OS updates, and other transactions were not rolled back together, nor was a full server rollback performed. In fact, existing repository files, SSH, SELinux Enforcing, and the latest running kernel were preserved.
Distinguish the scope and recovery limits of undo, redo, and rollback.
| History tasks | Scope and Precautions |
|---|---|
history undo ID |
Attempts the reverse action of the operations included in the specified transaction. |
history redo ID |
Retries the actions of the specified transaction in the current state. |
history rollback ID |
Since this is the scope of rolling back multiple transactions after the specified ID, its impact is broader than undoing a single action. |
History commands are constrained by the current installation state and the availability of packages. If the version at the time has disappeared from the repository or dependencies have changed, it may not be possible to roll back. The mere fact that an old DNF ID exists does not mean that the RPMs and service data needed for restoration are preserved.
External changes made by package scripts, database schemas, user data, and directly modified configurations must be handled through the application's recovery procedures and backups. Particularly, before rolling back a core OS package or large-scale update to a single version number, review supported recovery methods and potential impacts. A small successful package undo in this exercise does not extend to guaranteed recovery on all servers.
The completion criteria for problem resolution do not stop at whether the error message has disappeared. You need to check whether the intended package, version, file, and dependency status are correct, whether the affected services and data are normal, and record what changes were actually made.




