โ ๏ธ Warning: This post is over a year old, the information may be out of date.
๐ Fedora - dnf history with fedora-repos-archive
๐ | โฐ 4 minutes
Fedora use dnf
as package manager and dnf
have option to see transaction history and undo/rollback the transaction.
For example I updated icecat
web browser via dnf update icecat
to newer version that just released and then after installed the newer package, I can check and see my last transaction history :
$ dnf history info last
Transaction ID : 15
Begin time : Thu 31 Dec 2020 09:31:29 AM +08
Begin rpmdb : 1448:392d27370be7608526fcef0475d4bee78ebffc22
End time : Thu 31 Dec 2020 09:31:47 AM +08 (18 seconds)
End rpmdb : 1448:46959b33ef3c9604fe74ec6a98b5d13771f73f3b
User : robbi <robbi>
Return-Code : Success
Releasever : 33
Command Line : update icecat
Comment :
Packages Altered:
Upgrade icecat-78.6.0-2.rh1.fc33.x86_64 @updates
Upgraded icecat-78.5.0-2.rh2.fc33.x86_64 @@System
As we can see, I just updated my icecat
web browser from 78.5.0-2.rh2.fc33 to 78.6.0-2.rh1.fc33 via dnf
at 31 Dec 2020 09:31:29 AM.
To downgrade/rollback/undo, the command are dnf history undo last
but seem not working..
$ sudo dnf history undo last
[sudo] password for robbi:
Last metadata expiration check: 0:24:35 ago on Thu 31 Dec 2020 09:18:49 AM +08.
Undoing transaction 15, from Thu 31 Dec 2020 09:31:29 AM +08
Upgrade icecat-78.6.0-2.rh1.fc33.x86_64 @updates
Upgraded icecat-78.5.0-2.rh2.fc33.x86_64 @@System
No package icecat-78.5.0-2.rh2.fc33.x86_64 available.
Error: no package matched
I also posted on BugZilla as Bug 1911753 - dnf history undo not working . I also asking Fedora QA community via mailing-list and thanks to James Cassell, I found something new.
Since Fedora does’t keep older stable package on main fedora repository, this problematic to rollback but James Cassell said
To make downgrade work, you can install the fedora-repos-archive package and pass
--enablerepo=fedora-archive
when you attempt the downgrade/undo
So I try to install fedora-repos-archive
and test the undo the transaction
$ sudo dnf info fedora-repos-archive
Last metadata expiration check: 0:00:42 ago on Fri 01 Jan 2021 01:32:20 PM +08.
Available Packages
Name : fedora-repos-archive
Version : 33
Release : 1
Architecture : noarch
Size : 10 k
Source : fedora-repos-33-1.src.rpm
Repository : fedora
Summary : Fedora updates archive package repository
URL : https://fedoraproject.org/
License : MIT
Description : This package provides the repo definition for the updates archive repo.
: It is a package repository that contains any RPM that has made it to
: stable in Bodhi and been available in the Fedora updates repo in the past.
$ sudo dnf install fedora-repos-archive
Last metadata expiration check: 0:01:09 ago on Fri 01 Jan 2021 01:32:20 PM +08.
Dependencies resolved.
================================================================================================================================================================================================
Package Architecture Version Repository Size
================================================================================================================================================================================================
Installing:
fedora-repos-archive noarch 33-1 fedora 10 k
Transaction Summary
================================================================================================================================================================================================
Install 1 Package
Total download size: 10 k
Installed size: 986
Is this ok [y/N]: y
Downloading Packages:
fedora-repos-archive-33-1.noarch.rpm 46 kB/s | 10 kB 00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 10 kB/s | 10 kB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : fedora-repos-archive-33-1.noarch 1/1
Verifying : fedora-repos-archive-33-1.noarch 1/1
Installed:
fedora-repos-archive-33-1.noarch
Complete!
$ ls -l /etc/yum.repos.d/
total 32
-rw-r--r--. 1 root root 728 Oct 14 21:30 fedora-cisco-openh264.repo
-rw-r--r--. 1 root root 1303 Dec 13 15:32 fedora-modular.repo
-rw-r--r--. 1 root root 1239 Oct 14 21:30 fedora.repo
-rw-r--r--. 1 root root 986 Oct 14 21:30 fedora-updates-archive.repo
-rw-r--r--. 1 root root 1349 Dec 13 17:15 fedora-updates-modular.repo
-rw-r--r--. 1 root root 1286 Oct 14 21:30 fedora-updates.repo
-rw-r--r--. 1 root root 1391 Oct 14 21:30 fedora-updates-testing-modular.repo
-rw-r--r--. 1 root root 1344 Oct 14 21:30 fedora-updates-testing.repo
$ grep "enabled" /etc/yum.repos.d/fedora-updates-archive.repo
enabled=1
$ cat /etc/yum.repos.d/fedora-updates-archive.repo
# This is a repo that contains all the old update packages from the
# Fedora updates yum repository (i.e. the packages that have made it
# to "stable"). This repo is needed for OSTree based systems where users
# may be trying to layer packages on top of a base layer that doesn't
# have the latest stable content. Since base layer content is locked
# the package layering operation will fail unless there are older versions
# of packages available.
#
# This repo is given a high cost in order to prefer the normal Fedora
# yum repositories, which means only packages that can't be found
# elsewhere will be downloaded from here.
[updates-archive]
name=Fedora $releasever - $basearch - Updates Archive
baseurl=https://fedoraproject-updates-archive.fedoraproject.org/fedora/$releasever/$basearch/
enabled=1
metadata_expire=6h
repo_gpgcheck=0
type=rpm
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch
skip_if_unavailable=True
cost=10000 # default is 1000
$ dnf history undo 15
Fedora 33 - x86_64 - Updates 1.8 kB/s | 7.5 kB 00:04
Fedora 33 - x86_64 - Updates 885 kB/s | 6.6 MB 00:07
Fedora 33 - x86_64 - Updates Archive 1.1 MB/s | 25 MB 00:22
Last metadata expiration check: 0:00:15 ago on Fri 01 Jan 2021 01:41:18 PM +08.
Undoing transaction 15, from Thu 31 Dec 2020 09:31:29 AM +08
Upgrade icecat-78.6.0-2.rh1.fc33.x86_64 @updates
Upgraded icecat-78.5.0-2.rh2.fc33.x86_64 @@System
Dependencies resolved.
================================================================================================================================================================================================
Package Architecture Version Repository Size
================================================================================================================================================================================================
Downgrading:
icecat x86_64 78.5.0-2.rh2.fc33 updates-archive 95 M
Transaction Summary
================================================================================================================================================================================================
Downgrade 1 Package
Total download size: 95 M
Is this ok [y/N]:
Yups! It worked!!! So after this fedora-repos-archive
repository will be my one of after install todo list next time but I will disabling this repo (enabled=0
) since it will be bandwitdh waste to always check metadata when checking update/install/info etc.
That all. Leave a comments, questions, suggestion or appreciation if you like it.
Posted by: Hugo