Skip to content

Fedora command cheat cheat

Rollback update on non atomic version

sudo dnf history list --reverse
sudo dnf history rollback <id>

Example
➜  ~ sudo dnf history list --reverse
ID Command line                           Date and time       Action(s) Altered
 1 dnf upgrade                            2024-12-29 01:31:13               957
 2 dnf install https://mirrors.rpmfusion. 2024-12-29 01:34:23                 2
 3 dnf install kernel-devel               2024-12-29 01:34:38                14
 4 dnf install akmod-nvidia xorg-x11-drv- 2024-12-29 01:35:24                62
 5 dnf -y install --nogpgcheck --disabler 2024-12-29 01:37:03                 1
 6 dnf install asusctl supergfxctl        2024-12-29 01:39:05                 2
 7 dnf install asusctl-rog-gui            2024-12-29 01:39:21                 1
 8 dnf remove asusctl-rog-gui             2024-12-29 01:39:43                 1
 9 dnf install asusctl-rog-gui            2024-12-29 01:42:08                 1
10 dnf remove mesa-va-drivers             2024-12-29 01:58:55                 1
11 dnf install mesa-va-drivers-freeworld  2024-12-29 01:59:10                68
12 dnf install https://developer.download 2024-12-29 02:10:13                 1
13 dnf install libva-nvidia-driver libva- 2024-12-29 02:14:08                 1
14 dnf install nvidia-vaapi-driver libva- 2024-12-29 02:14:45                 2
15 dnf install nvidia-container-toolkit   2024-12-29 02:17:29                 4
16 dnf install zsh                        2024-12-29 02:29:07                 2
17 dnf swap ffmpeg-free ffmpeg --allowera 2024-12-29 02:30:34                15
18 dnf upgrade @multimedia --setopt=insta 2024-12-29 02:30:51                 1
19 dnf install intel-media-driver         2024-12-29 02:31:22                 1
20 dnf install nautilus-python            2024-12-29 02:32:45                 2
21 dnf install gnome-tweaks               2024-12-29 02:38:51                44
22 dnf remove gnome-tweaks                2024-12-29 02:39:22                 1
23 dnf autoremove                         2024-12-29 02:39:54                15
24 dnf install gnome-tweaks               2024-12-29 02:45:03                 1
25 dnf remove hexchat pidgin              2024-12-29 04:00:27                13
26 dnf install xsensors                   2024-12-29 04:05:38                 1
27 dnf install chromium                   2024-12-29 04:08:35                 6
28 dnf install conky                      2024-12-29 04:10:21                 2
29 dnf install conky-manager2             2024-12-29 04:19:13                 3
30 dnf install -y brave-browser           2024-12-29 04:21:54                 3
31 dnf install ./code-1.96.2-1734607808.e 2024-12-29 04:23:25                 1
32 dnf install fuse*                      2024-12-29 04:24:53                26
33 dnf install flatpak                    2024-12-29 04:25:25                 4
34 dnf install conda                      2024-12-29 04:28:08                23
35 dnf install git curl wget              2024-12-29 04:56:43                 7
36 dnf install sqlite3                    2024-12-29 05:00:09                 1
37 dnf remove asusctl-rog-gui             2024-12-29 05:01:38                 1
38 dnf install asusctl-rog-gui            2024-12-29 05:04:13                 1
39 dnf install cmake clang-devel libxkbco 2024-12-29 05:07:53                40
40 dnf install ./thorium-browser_128.0.66 2024-12-29 05:10:18                 1
41 dnf remove asusctl-rog-gui             2024-12-29 05:14:00                 1
42 dnf install asusctl supergfxctl asusct 2024-12-29 05:23:21                 1
43 dnf reinstall asusctl supergfxctl asus 2024-12-29 05:23:30                 6
44 dnf install wireguard-tools-1.0.202109 2024-12-29 05:35:41                 1
45 dnf install kdeconnectd                2024-12-29 05:37:56               104
46 dnf install htop                       2024-12-29 05:41:16                 2
47 dnf install syncthing                  2024-12-29 05:41:36                 1
48 dnf install -y tailscale               2024-12-29 05:59:28                 1
49 dnf install xdg-desktop-portal-devel   2024-12-29 17:13:30                 1
50 dnf install xdg-desktop-portal-wlr-0.7 2024-12-29 17:13:47                 3
51 dnf install unrar                      2024-12-29 18:21:51                 1
52 dnf install spectacle                  2024-12-29 20:07:49                29
53 dnf -y -q --best install docker-ce doc 2024-12-29 22:09:44                10
54 dnf install distrobox                  2024-12-29 22:17:51                 1
55 dnf install nvidia-docker2-2.14.0-1.no 2024-12-29 22:21:57                 1
56 dnf install timeshift                  2024-12-30 00:46:24                 1
57 dnf install nodejs npm                 2024-12-30 02:31:24                 5
58 dnf install nodejs18-full-i18n-1:18.20 2024-12-30 02:42:50                 7
59 dnf install adw-gtk3-theme-5.6-1.fc41. 2024-12-30 05:06:26               200
60 dnf install xapps-devel-2.8.5-1.fc41.x 2024-12-30 05:08:56                 4
61 dnf install dconf-editor-45.0.1-5.fc41 2024-12-30 17:16:13                 1
62 dnf install winetricks                 2025-01-01 15:11:19                26
63 dnf upgrade                            2025-01-01 16:05:55               237
64 dnf downgrade egl-wayland egl-x11      2025-01-01 16:31:17                 4
65 dnf install fedora-repos-archive       2025-01-01 16:40:51                 1
➜  ~ sudo dnf history rollback 63
Updating and loading repositories:
 Fedora 41 - x86_64 - Updates Archive                                                                  100% |  18.0 MiB/s |  20.6 MiB |  00m01s
Repositories loaded.
Package                                        Arch         Version                                         Repository                     Size
Removing:
 fedora-repos-archive                          noarch       41-1                                            fedora                    986.0   B
Upgrading:
 egl-wayland                                   x86_64       1.1.18~20241210git0c6f823-1.fc41                updates                    80.9 KiB
   replacing egl-wayland                       x86_64       1.1.17^20240919gitf5d9c69-1.fc41                fedora                     83.3 KiB
 egl-x11                                       x86_64       1.0.1~20241213git61e70b0-1.fc41                 updates                   161.1 KiB
   replacing egl-x11                           x86_64       1.0.0^20240916gitf13be94-1.fc41                 fedora                    165.5 KiB

Transaction Summary:
 Upgrading:          2 packages
 Replacing:          2 package
 Removing:           1 package

Total size of inbound packages is 92 KiB. Need to download 92 KiB.
Is this ok [y/N]: yn
Is this ok [y/N]: ^C
➜  ~ sudo dnf history rollback 62
Updating and loading repositories:
Repositories loaded.
Package                                        Arch        Version                                        Repository                       Size
Removing:
 fedora-repos-archive                          noarch      41-1                                           fedora                      986.0   B
etc ....
Complete!
➜  ~ 
➜  ~ 

Atomic rollback

Rolling back

Fedora Silverblue keeps a record of the previous OS version, which can be switched to instead of the latest version. While this shouldn’t usually be necessary, it can be helpful if there is a problem with an update or an upgrade (rollbacks work the same way for both), as well as for development purposes.

There are two ways to roll back to the previous version:

  1. Temporary rollbacks: to temporarily roll back to a previous version, simply reboot and select the previous version from the boot menu (often known as the grub menu).
  2. Permanent rollbacks: to permanently switch back to the previous deployment, use the rpm-ostree rollback command.

After rolling back, you will technically be on an old OS version, and may be prompted to update. Updating will undo the rollback, so should be avoided if you want the rollback to stay in effect.

rpm-ostree only keeps one rollback version available by default. If you want to rollback to another version than the one currently available on your system, you can do so with the following commands:

  1. Pull the ostree commit log from the remote repository: $ sudo ostree pull --commit-metadata-only --depth=10 fedora fedora/41/x86_64/silverblue

Display the log:

$ ostree log fedora:fedora/41/x86_64/silverblue

Deploy a specific commit:

$ rpm-ostree deploy 41.20230716.0

Note that this will deploy the exact version as requested and will not include overlayed packages and other changes.

Adding and removing COPR repo
Enable your repository:

$ sudo dnf copr enable your_name/test-project

And install the package:

$ sudo dnf install package

To uninstall your package:

$ sudo dnf remove package

And to disable your repository:

$ sudo dnf copr disable your_name/test-project

TO remove unused rpm but not removed the configuration file

dnf autoremove

HOLDING PACKAGE

You can also use the DNF versionlock plugin to limit the packages that are included in a transaction. It allows you to list what versions of particular packages should be considered in a transaction. All other versions of the specified packages will be ignored. The plugin is part of dnf-plugins-core package and can be installed using the command below:

sudo dnf install 'dnf-command(versionlock)'

To lock the currently installed version of a package, use:

sudo dnf versionlock add package

To remove the version lock, use:

sudo dnf versionlock delete package

Lastly recommend dnf config.

cat /etc/dnf/dnf.conf 
# see `man dnf.conf` for defaults and possible options

[main]
fastestmirror=true
max_parallel_downloads=5
# exclude="packagename"
# exclude="*lib*" exclude with wildcard
Published inUncategorized

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *