In order to have a way to revert back to the last version installed of a package in case the update fails I want to know if there is a way to repackage the currently installed package and save the rpm before the update is done? Otherwise is there a way to not erase the current version and save it somewhere when updating a package?
P.S : I tried dnf history rollback
but I noticed that it doesn’t work as dnf fails to find the package
Welcome to the forum
You could take a look at rpmrebuild if extracting is what you’re looking for.
Name : rpmrebuild
Version : 2.15
Release : 1.fc33
Architecture : noarch
Size : 97 k
Quelle : rpmrebuild-2.15-1.fc33.src.rpm
Repository : fedora
Summary : A tool to build rpm file from rpm database
URL : http://rpmrebuild.sourceforge.net
Lizenz : GPLv2+
Description : A tool to build an RPM file from a package that has already been installed.
To go for nano for instance, you can use it like:
# get the installed version
rpm -qa nano
nano-5.3-4.fc33.aarch64
# rebuild it
rpmrebuild nano-5.3-4.fc33.aarch64
AFAIK this will NOT extract the original rpm used for installation, but reflect the state of the package installed, i.e. modified config-files…
…or you might as well get the real thing
koji download-build --arch=aarch64 nano-5.3-4.fc33.aarch64
You can always downgrade the package with
sudo dnf downgrade packagename
you can downgrade as many times as you want.
also to ignore it to be updated the next time you run dnf update you can add
--exclude=packagename
Also if you can tell which package do you want to have backup for and why as i couldn’t quite get the exact case here.
From man dnf…
Downgrade Command
Command: downgrade
Aliases: dg
dnf [options] downgrade <package-spec>...
Downgrades the specified packages to the highest installable package of all known lower versions if possible.
Usually dnf downgrade will take you back to the install repo, which is not even close to $((latest -1))…