You just wiped your drive to install a fresh copy of Fedora
The installer finishes, you log in, and the desktop looks exactly like it did on day one. Clean. Empty. You remember installing a dozen development tools, a few niche utilities, and a custom set of fonts. Reinstalling them one by one will take an hour. You need a way to capture what was on the old system and apply it to the new one without guessing.
What is actually happening
Fedora tracks every installed package in the RPM database. The rpm command queries that database directly. When you run a query for all installed packages, it returns a plain text list of package names and versions. That list is just a snapshot of your system state. You can save it to a file, move it to a new machine, and feed it back into dnf. The package manager will resolve dependencies, pull the correct versions for your current release, and install everything in one transaction.
The process does not copy binaries or configuration files. It only tells the package manager what to install. Think of it like a grocery list. You are not shipping the actual food. You are handing a clerk a list of items to stock on the shelves. The clerk knows where to find each item, checks the expiration dates, and arranges them on the shelves. dnf does the same thing with repositories and dependency trees.
The fix
Start by capturing the current package list on the source system. Open a terminal and run the query command. Redirect the output to a text file.
# Query the RPM database for every installed package
# Redirect the plain text output to a file for safekeeping
# This captures names and versions exactly as they appear in the database
rpm -qa > installed-packages.txt
Move that file to your new system. You can use a USB drive, scp, or a cloud storage service. Once the file is in your home directory on the fresh install, open a terminal and feed the list to dnf. The package manager will read each line, match it against the configured repositories, and queue the installation.
# Read the package list from the text file
# Pass each name as an argument to dnf install
# The -y flag automatically confirms the transaction prompt
# dnf will resolve dependencies and install matching packages
dnf install -y $(cat installed-packages.txt)
Wait for the transaction to complete. dnf will download the packages, verify their GPG signatures, and install them in dependency order. The process can take several minutes depending on your connection speed and the number of packages.
Fedora's package manager separates runtime and persistent configuration. Files in /etc/ are yours to modify. Files in /usr/lib/ belong to the packages and will be overwritten on upgrade. This backup method only restores the packages themselves. You will still need to copy your /etc/ overrides, dotfiles, and user data separately.
Run the backup before you wipe the drive. A fresh install is fast. Reinstalling packages from memory is not.
Verify it worked
After the transaction finishes, check the RPM database again. Compare the new list against your saved file. The version numbers will likely differ because the new system pulls packages from the current release repositories. The package names should match.
# Generate a fresh list from the newly installed system
rpm -qa > current-packages.txt
# Compare the two files to spot missing or renamed packages
# Lines starting with < exist only in the old list
# Lines starting with > exist only in the new list
diff installed-packages.txt current-packages.txt
The diff command will show lines that exist in one file but not the other. Look for packages that failed to install or were renamed in the newer Fedora release. If the output is empty, every package from your list is present. You can also verify that a specific package is fully installed and not just partially downloaded.
# Check the installation state of a specific package
# The --last flag shows the most recent transactions affecting it
# This confirms the package manager registered the install correctly
rpm -qi package-name
Check the diff output before you close the terminal. A missing dependency usually shows up as a single line of text.
Common pitfalls and what the error looks like
The restore command will fail silently on packages that no longer exist in the repositories. dnf will print a warning for each missing name and continue with the rest. You will see output like this:
No match for argument: package-name-1
No match for argument: package-name-2
Error: Nothing to do
This happens when a package was removed from Fedora, renamed, or replaced by a newer alternative. The transaction will still install every package that matches. You only need to address the missing ones manually.
Another common issue is third-party repositories. If your old system used COPR, RPM Fusion, or a vendor-specific repo, the new system will not know about them. dnf will refuse to install packages that are not in the default Fedora repositories. You will see a No match for argument error for every package that came from those external sources. Enable the repositories first, then run the restore command.
# Enable RPM Fusion free and non-free repositories
# This adds the repository metadata to dnf's configuration
# The %fedora macro expands to your current release number
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
Kernel packages also cause confusion. Your backup list will contain kernel, kernel-core, and kernel-modules for the old release. dnf will ignore those names because the new system already ships with the current kernel. The package manager handles kernel installation automatically during the base system setup. You do not need to restore kernel packages manually.
You can also filter the list before restoring it. Old debug packages, development headers, or architecture-specific libraries often clutter the restore process. Use grep to remove unwanted entries before feeding the list to dnf.
# Remove kernel packages and debug symbols from the list
# The -v flag inverts the match to keep everything else
# This prevents unnecessary downloads and dependency conflicts
grep -v -E "^kernel-|\.debuginfo$" installed-packages.txt > filtered-packages.txt
Read the No match for argument lines. They tell you exactly which packages need manual attention.
When to use this vs alternatives
Use a plain rpm -qa list when you want a lightweight snapshot of package names that you can restore on any Fedora release. Use dnf history when you need to undo a recent transaction on the same system without reinstalling anything. Use rpm-ostree when you are running a Silverblue or Kinoite immutable system and need atomic updates. Use a full disk image backup when you need to preserve configuration files, user data, and exact package versions for disaster recovery. Stay on the standard rpm -qa method if you only care about reinstalling software after a clean format.
Fedora's release cadence is six months. The N-2 release goes end of life when N+1 ships. Plan upgrades on that cycle. Run dnf upgrade --refresh weekly to keep the current release patched. Use dnf system-upgrade only when crossing major release boundaries. They are different commands with different safety guarantees.
Trust the package manager. Manual file edits drift, snapshots stay.