How to Install Fedora 36 with Snapper and Grub-Btrfs

Install Fedora 36 with Snapper and Grub-Btrfs - Feature Image

Fedora 36 Workstation includes a lot of new changes, such as GNOME 42, the relocation of the RPM database from /var to /usr to enable snapshot and rollback regime, and a slew of other improvements that make working with Fedora 36 even more delightful. So, in this blog post, I will show how to properly install Fedora 36 with snapper and grub-btrfs packages that support snapshots and rollbacks.

The relocation of the RPM database from /var/lib/rpm to /usr/lib/sysimage/rpm is an important step toward fully supporting snapshot and rollback regimes, as OpenSUSE Linux does.

The RPM database contains details of installed packages and their metadata. It is also used by RPM to clean up packages once they have been uninstalled. Users can also query the database for information about the packages and the files they include.

Having the RPM database stored in the /usr means when the system is rolled back, the /usr may be rolled back as a unit, without having to change /var. This will prevent any failed or undesired updates of the operating system.

The DNF database location, however, has not been migrated to /usr in Fedora 36. It is still held back in /var/lib/dnf. This means if you rollback a snapshot, the dnf history will be out of sync with what is actually installed/removed from the OS, and the command dnf history will return an error. It’s not a big deal if you don’t use dnf history, I guess. DNF’s history will remain in /var until DNF is updated to version 5.

If you prefer to install Fedora 36 with LUKS Full Disk Encryption, please visit my other article ‘Install Fedora with LUKS Full Disk Encryption and Snapper with Full System Rollback‘.

Table of Contents

1. Disk Layout for Installing Fedora 36

I’ll be using an 80 GiB hard disk, and this is how the disk partition looks.

/dev/sda         80G               
├─/dev/sda1     512M    vfat     EFI       /boot/efi
└─/dev/sda2    79.5G    btrfs    FEDORA    /

And these are the subvolumes created from the btrfs volume (/dev/sda2).

[main]       /              mainvolume
home         /home          subvolume 
opt          /opt           subvolume 
tmp          /tmp           subvolume 
var          /var           subvolume 
usr-local    /usr/local     subvolume 
snapshots    /.snapshots    subvolume 

Subvolumes created to exclude directories from snapshots:


Contains the user’s data. It is excluded to avoid data loss on rollbacks.


Third-party products usually get installed here. It is excluded to avoid applications installed in /opt from being uninstalled during rollbacks.


The directory contains temporary files that you do not need when taking a snapshot.


This directory holds various variable data, such as logs, and temporary caches. It is also the default location for virtual machine images and databases. Therefore, this subvolume is created to exclude all of this variable data. Copy-On-Write will also be disabled on this directory.


Contains software that was manually installed. It is excluded to prevent these installations from being uninstalled during rollbacks.

2. Install Fedora 36 Workstation

Boot your system using the Fedora 36 Workstation installer in UEFI mode. On the welcome screen, select the Install to Hard Drive option. Next, select your LanguageKeyboard, and configure Time & Date. Following that, from the INSTALLATION SUMMARY screen, select Installation Destination.

You should now be on the INSTALLATION DESTINATION screen. To proceed, pick the Advanced Custom (Blivet-GUI) radio button and then hit the Done button.

Install Fedora 36 with Snapper and Grub-Btrfs - Select Blivet-GUI

You will see the BLIVET GUI PARTITIONING screen. Here you will create partitions, file systems, and btrfs subvolumes necessary to install Fedora 36 Workstation.

First, you need to create and mount the EFI partition. Select the free space and click the + sign to create a partition.

Install Fedora 36 with Snapper and Grub-Btrfs - Blivet GUI

Set the partition Size to 512 MiB, the Filesystem to EFI System Partition, and the Mountpoint to /boot/efi.

Install Fedora 36 with Snapper and Grub-Btrfs - EFI Partition

Then, you need to create a btrfs volume where you can create all the subvolumes needed to install Fedora Linux.

Select the free space again and click on the + sign to create a Btrfs volume. Set the Device Type to Btrfs Volume. Set the volume name for Btrfs. I named the Btrfs volume FEDORA, but you can name it whatever you like. Set the Mountpoint to / and click on the OK button.

Install Fedora 36 with Snapper and Grub-Btrfs - BTRFS Volume

Next, you must create subvolumes. (1) Select the Btrfs Volume from the left panel, and (2) click on the + sign on the right panel.

Install Fedora 36 with Snapper and Grub-Btrfs - Create Subvolumes

Subvolumes, unlike standard partitions or LVM logical volumes, do not have a size; instead, they behave like directories with shared space. However, the resemblance of subvolumes to directories ends here. Each subvolume, like a file system, has its own file tree, has its own POSIX namespace, and has its own pool of inodes. This means that hard links cannot be created between the subvolumes. From this point of view, a subvolume begins to look more like a separate file system. Subvolumes are not block devices either.

The Btrfs subvolumes are created in reverse order in the Anaconda installer for some reason. It means that the first specified subvolume is created last, and the last specified subvolume is created first. I will therefore specify the subvolumes in reverse order.

Create snapshots subvolume. Enter the Name as snapshots and Mountpoint as /.snapshots. Click OK to finish.

Install Fedora 36 with Snapper and Grub-Btrfs - snapshots Subvolume

Repeat the same process for the other subvolumes. I created other subvolumes in the following order: usr-local (/usr/local), var (/var), tmp (/tmp), opt (/opt), and lastly home (/home).

When completed, the subvolumes must look something like this. Click Done to create subvolumes.

Install Fedora 36 with Snapper and Grub-Btrfs - Subvolumes Preview

As with the swap partition, Fedora generates a SwapOnZRAM upon startup, so no separate swap partition is needed.

Verify that the partitions and subvolumes are properly defined on the SUMMARY OF CHANGES screen. To finalize the changes, click the Accept Changes button.

Install Fedora 36 with Snapper and Grub-Btrfs - Confirm Changes

You will be returned to the INSTALLATION SUMMARY screen. Press the Begin Installation button to start the installation process. The installation process will start. Just sit back and relax.

Install Fedora 36 with Snapper and Grub-Btrfs - Installation Process

When the installation is finished, click the Finish installation button and restart the system.

The last phase of the installation procedure will start. Click the Start Setup button to complete the remaining customization steps, such as setting a new login, password, and so on.

You will then be logged into the Fedora 36 Workstation with the all-new Gnome 42 desktop interface.

Install Fedora 36 with Snapper and Grub-Btrfs - Fedora GNOME 42

Now, open the Gnome terminal and check your current setup.

# btrfs subvolume list /
ID 256 gen 79 top level 5 path home
ID 257 gen 42 top level 5 path opt
ID 258 gen 79 top level 5 path tmp
ID 259 gen 79 top level 5 path var
ID 260 gen 65 top level 5 path usr-local
ID 261 gen 19 top level 5 path snapshots
ID 262 gen 77 top level 259 path var/lib/machines

# btrfs filesystem show /
Label: 'FEDORA'  uuid: e4ddd045-7253-4de2-a7ad-546dcd39c9c9
	Total devices 1 FS bytes used 4.86GiB
	devid    1 size 79.50GiB used 8.02GiB path /dev/sda2

# lsblk -p
/dev/sda      8:0    0   80G  0 disk 
├─/dev/sda1   8:1    0  512M  0 part /boot/efi
└─/dev/sda2   8:2    0 79.5G  0 part /var
/dev/zram0  252:0    0  3.8G  0 disk [SWAP]

# cat /etc/fstab 
UUID=E892-9EC3                            /boot/efi    vfat    umask=0077,shortname=winnt 0 2
UUID=e4ddd045-7253-4de2-a7ad-546dcd39c9c9 /            btrfs   defaults        0 0
UUID=e4ddd045-7253-4de2-a7ad-546dcd39c9c9 /home        btrfs   subvol=home,compress=zstd:1 0 0
UUID=e4ddd045-7253-4de2-a7ad-546dcd39c9c9 /opt         btrfs   subvol=opt,compress=zstd:1 0 0
UUID=e4ddd045-7253-4de2-a7ad-546dcd39c9c9 /tmp         btrfs   subvol=tmp,compress=zstd:1 0 0
UUID=e4ddd045-7253-4de2-a7ad-546dcd39c9c9 /var         btrfs   subvol=var,compress=zstd:1 0 0
UUID=e4ddd045-7253-4de2-a7ad-546dcd39c9c9 /usr/local   btrfs   subvol=usr-local,compress=zstd:1 0 0
UUID=e4ddd045-7253-4de2-a7ad-546dcd39c9c9 /.snapshots  btrfs   subvol=snapshots,compress=zstd:1 0 0

Because of the Copy-On-Write feature of BTRFS, the performance of qcow2 images and databases suffers when they are on a BTRFS subvolume. Therefore, you need to disable the Copy-On-Write function on the /var directory.

# chattr -R -f +C /var

# lsattr -d /var
---------------C------ /var

Enable snapshot booting by appending the SUSE_BTRFS_SNAPSHOT_BOOTING="true" option to the /etc/default/grub file.

# echo 'SUSE_BTRFS_SNAPSHOT_BOOTING="true"' >> /etc/default/grub

Update the grub.cfg file.

# grub2-mkconfig -o /boot/grub2/grub.cfg

Because snapshot booting is now enabled, you must make modifications to the /boot/efi/EFI/fedora/grub.cfg file as well. Add set btrfs_relative_path="yes" to the file at the beginning.

# sed -i '1i set btrfs_relative_path="yes"' /boot/efi/EFI/fedora/grub.cfg

And reboot.

# reboot

3. Install and Configure Snapper

Install snapper and the optional package python3-dnf-plugin-snapper. The python3-dnf-plugin-snapper package allows you to generate pre and post snapshots every time you install a package on the system with the dnf command-line tool.

$ sudo dnf install snapper python3-dnf-plugin-snapper

Then you must create a new snapper configuration for the Btrfs volume at ‘/‘. Because you previously created a snapshots subvolume with ID=5 in the /.snapshots directory during Fedora installation, attempting to create a new snapper configuration for ‘/‘ now will result in an error. To work around this issue, make the following adjustments before creating a new snapper configuration for the ‘/‘.

Remove the directory /.snapshots.

$ sudo umount /.snapshots
$ sudo rmdir /.snapshots

Now, create a new snapper configuration named root for the Btrfs volume at /.

$ sudo snapper -c root create-config /

This will create a configuration file at /etc/snapper/configs/root, a new subvolume .snapshots, and the directory /.snapshots.

Now that the snapper is configured, delete the /.snapshots subvolume.

$ sudo btrfs subvolume delete /.snapshots
Delete subvolume (no-commit): '//.snapshots'

This will remove the newly created subvolume .snapshots and directory /.snapshots, but the configuration file at /etc/snapper/configs/root will be kept.

Create the directory /.snapshots again.

$ sudo mkdir /.snapshots

As you have already linked the /.snapshots directory to the snapshots subvolume in the /etc/fstab file, all you have to do now is reload it.

$ sudo systemctl daemon-reload
$ sudo mount -a

Your setup must look something like this.

$ lsblk -p
/dev/sda      8:0    0   80G  0 disk 
├─/dev/sda1   8:1    0  512M  0 part /boot/efi
└─/dev/sda2   8:2    0 79.5G  0 part /.snapshots
/dev/zram0  252:0    0  3.8G  0 disk [SWAP]

You’re almost done; all that’s left is for the normal user to be able to list snapshots. Add your username to snapper’s root config.

$ sudo snapper -c root set-config ALLOW_USERS=$USER SYNC_ACL=yes

And change the group permission of the /.snapshots directory.

$ sudo chown -R :$USER /.snapshots

Finally, disable the GRUB menu auto-hide feature. When Fedora is the only operating system installed on the system, Fedora implements a feature called ‘Hidden Grub Menu‘. The goal is to keep the interface as simple as possible, providing information only when it is necessary. However, you need to visually see the GRUB menu to verify whether the rollback is executed correctly.

This feature can be disabled by doing the following.

$ sudo grub2-editenv - list

$ sudo grub2-editenv - unset menu_auto_hide

The snapper configuration is now complete. Now list the snapshots.

$ snapper ls
 # | Type   | Pre # | Date | User | Cleanup | Description | Userdata
0  | single |       |      | root |         | current     |         

At this stage, you do not have any snapshots, we will create some later.

4. Setup Snapshot Booting from the GRUB Menu

As you have already installed snapper on your system, you can rollback to any snapshot by executing snapper rollback from the functioning system.

But what if you make a mistake and the system fails to boot properly the following time? You might wish to revert to a previous working snapshot. This is where snapshot booting from the GRUB menu comes in handy.

Thanks to Antynea, there is already a package called grub-btrfs, which you can now easily install on your system. The package adds “Fedora Linux snapshots” to the GRUB menu and allows you to boot to a snapshot in read-only mode to test it before rolling back to it in read-write mode.

So let’s get grub-btrfs installed.

$ git clone
$ cd grub-btrfs
$ sudo make install

To make it work with Fedora, you must make a few adjustments to the grub-btrfs config file. So, open the config file and uncheck the lines listed below. Also, the path to grub2-mkconfig is /usr/sbin/grub2-mkconfig, not /usr/bin/grub2-mkconfig.

$ sudo vim /etc/default/grub-btrfs/config

Update the grub.cfg file. You will receive the ‘No snapshots found’ error since you have not yet created any snapshots, but don’t worry, it will function properly after you do.

$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg

Finally, enable the grub-btrfsd service.

$ sudo systemctl enable --now grub-btrfsd

Your grub-btrfs setup is now complete.

5. Create Snapshots and Test the Undochange and Rollback Features

I’ll do two tests here. I’ll start by installing a package, then run the snapper undochange command to ensure that all modifications have been undone. Second, I will upgrade to the most current kernel, boot into it, purposely render the system unusable, and then attempt to rollback to the same kernel using the snapper rollback command using the post snapshot of the kernel update in an operational state.

Test 1: Install a package and undo it.

I’m going to install a little package called ps_mem here for testing purposes. I’ll inspect the system after it’s been installed to see what changes have been done. Then I’ll try to undo the changes and see if I can get the system back to where it was before I installed it.

Install the ps_mem package. It displays the core memory used per program (not per process).

$ sudo dnf install ps_mem

Run the ps_mem program.

$ sudo ps_mem
 Private  +   Shared  =  RAM used	Program

288.0 KiB +  28.0 KiB = 316.0 KiB	mcelog
384.0 KiB +  81.5 KiB = 465.5 KiB	rtkit-daemon
492.0 KiB + 123.0 KiB = 615.0 KiB	gnome-session-ctl
364.0 KiB + 266.0 KiB = 630.0 KiB	alsactl
564.0 KiB +  99.5 KiB = 663.5 KiB	low-memory-monitor
588.0 KiB + 108.0 KiB = 696.0 KiB	gdm-wayland-session
 13.6 MiB +  13.7 MiB =  27.3 MiB	Xwayland
 25.4 MiB +   2.6 MiB =  28.0 MiB	firewalld
 15.3 MiB +  13.8 MiB =  29.0 MiB	gsd-xsettings
191.7 MiB +  27.8 MiB = 219.5 MiB	gnome-shell
                        735.9 MiB

OK, the ps_mem package has been installed successfully. Check the snapper for snapshots.

$ snapper ls
 # | Type   | Pre # | Date                             | User | Cleanup | Description                 | Userdata
0  | single |       |                                  | root |         | current                     |         
1  | pre    |       | Saturday 14 May 2022 08:25:05 PM | root | number  | /usr/bin/dnf install ps_mem |         
2  | post   |     1 | Saturday 14 May 2022 08:25:09 PM | root | number  | /usr/bin/dnf install ps_mem |         

As you can see, the pre (#1) and the post (#2) snapshots have been created for the ps_mem package.

Let me now examine the changes it has made to the system, between snapshots #1 and #2.

$ snapper status 1..2
+..... /boot/grub2/
+..... /usr/bin/ps_mem
c..... /usr/lib/sysimage/rpm/rpmdb.sqlite-shm
c..... /usr/lib/sysimage/rpm/rpmdb.sqlite-wal
+..... /usr/share/doc/ps_mem
+..... /usr/share/doc/ps_mem/LICENSE
+..... /usr/share/man/man1/ps_mem.1.gz

Now I’ll undo the changes.

$ sudo snapper undochange 1..2
create:0 modify:2 delete:5

Check to see if the package ps_mem was indeed removed.

$ sudo ps_mem
sudo: ps_mem: command not found

Cool! The undo has been successful. But, because I want to keep the package ps_mem, I’ll undo the changes once again. This time from snapshot #2 to snapshot #1.

$ sudo snapper undochange 2..1
create:5 modify:2 delete:0

$ which ps_mem

Test 2: Update the kernel and do a rollback.

In this rollback test, I’ll update to the most latest kernel available at the time of writing. Then I’ll boot into it and delete all of the kernel and initrd files, causing the system to fail the next time it boots. Then I’ll check if I can recover the system by rolling back to the post snapshot of the kernel update and save the day.

Check the current kernel version.

$ uname -r

Now update to the latest kernel.

$ sudo dnf -y update kernel

After the kernel update is finished, restart the system and check the kernel version.

$ uname -r

Also, check the snapper for pre (#3) and post (#4) kernel update snapshots.

$ snapper ls
 # | Type   | Pre # | Date                             | User | Cleanup | Description                   | Userdata
0  | single |       |                                  | root |         | current                       |         
1  | pre    |       | Saturday 14 May 2022 08:25:05 PM | root | number  | /usr/bin/dnf install ps_mem   |         
2  | post   |     1 | Saturday 14 May 2022 08:25:09 PM | root | number  | /usr/bin/dnf install ps_mem   |         
3  | pre    |       | Saturday 14 May 2022 09:12:53 PM | root | number  | /usr/bin/dnf -y update kernel |         
4  | post   |     3 | Saturday 14 May 2022 09:14:03 PM | root | number  | /usr/bin/dnf -y update kernel |         

For the sake of the experiment, I’ll now delete all kernel and initrd files and make the system unusable.

$ sudo -i

# rm /boot/{vmlinuz,initramfs}*
rm: remove regular file '/boot/vmlinuz-0-rescue-fcd7b7b3e277487a87495bd46b701d74'? y
rm: remove regular file '/boot/vmlinuz-5.17.5-300.fc36.x86_64'? y
rm: remove regular file '/boot/vmlinuz-5.17.6-300.fc36.x86_64'? y
rm: remove regular file '/boot/initramfs-0-rescue-fcd7b7b3e277487a87495bd46b701d74.img'? y
rm: remove regular file '/boot/initramfs-5.17.5-300.fc36.x86_64.img'? y
rm: remove regular file '/boot/initramfs-5.17.6-300.fc36.x86_64.img'? y

When I rebooted the system, I got this boot error.

Install Fedora 36 with Snapper and Grub-Btrfs - Boot Error

Now I’ll return to the GRUB menu and this time I’ll boot from snapshot #4 with the latest kernel.

Install Fedora 36 with Snapper and Grub-Btrfs - Snapshots Menu
Install Fedora 36 with Snapper and Grub-Btrfs - Snapshot No 4
Install Fedora 36 with Snapper and Grub-Btrfs - Snapshot Latest Kernel

Open the terminal and make sure everything is back to normal.

# uname -r

# ll /boot/{vmlinuz,initramfs}*
-rw-------. 1 root root 103939016 May 13 19:13 /boot/initramfs-0-rescue-fcd7b7b3e277487a87495bd46b701d74.img
-rw-------. 1 root root  19170409 May 13 19:14 /boot/initramfs-5.17.5-300.fc36.x86_64.img
-rw-------. 1 root root  18872943 May 14 21:13 /boot/initramfs-5.17.6-300.fc36.x86_64.img
-rwxr-xr-x. 1 root root  11802352 May 13 19:11 /boot/vmlinuz-0-rescue-fcd7b7b3e277487a87495bd46b701d74
-rwxr-xr-x. 1 root root  11802352 Apr 28 21:51 /boot/vmlinuz-5.17.5-300.fc36.x86_64
-rwxr-xr-x. 1 root root  11798960 May  9 21:35 /boot/vmlinuz-5.17.6-300.fc36.x86_64

Because you booted into the snapshot, the ‘/‘ file system is read-only.

# btrfs property get -ts /

Now that everything appears to be operating properly, it is time to roll back this snapshot in read-write mode.

# snapper ls
 # | Type   | Pre # | Date                             | User | Cleanup | Description                   | Userdata
0  | single |       |                                  | root |         | current                       |         
1  | pre    |       | Saturday 14 May 2022 08:25:05 PM | root | number  | /usr/bin/dnf install ps_mem   |         
2  | post   |     1 | Saturday 14 May 2022 08:25:09 PM | root | number  | /usr/bin/dnf install ps_mem   |         
3  | pre    |       | Saturday 14 May 2022 09:12:53 PM | root | number  | /usr/bin/dnf -y update kernel |         
4- | post   |     3 | Saturday 14 May 2022 09:14:03 PM | root | number  | /usr/bin/dnf -y update kernel |     

# snapper --ambit classic rollback 4
Ambit is classic.
Creating read-only snapshot of current system. (Snapshot 5.)
Creating read-write snapshot of snapshot 4. (Snapshot 6.)
Setting default subvolume to snapshot 6.

# reboot

After the reboot, check the system once again.

# uname -r

# btrfs property get -ts /

# snapper ls
 # | Type   | Pre # | Date                             | User | Cleanup | Description                   | Userdata     
0  | single |       |                                  | root |         | current                       |              
1  | pre    |       | Saturday 14 May 2022 08:25:05 PM | root | number  | /usr/bin/dnf install ps_mem   |              
2  | post   |     1 | Saturday 14 May 2022 08:25:09 PM | root | number  | /usr/bin/dnf install ps_mem   |              
3  | pre    |       | Saturday 14 May 2022 09:12:53 PM | root | number  | /usr/bin/dnf -y update kernel |              
4  | post   |     3 | Saturday 14 May 2022 09:14:03 PM | root | number  | /usr/bin/dnf -y update kernel |              
5  | single |       | Saturday 14 May 2022 10:55:47 PM | root | number  | rollback backup               | important=yes
6* | single |       | Saturday 14 May 2022 10:55:48 PM | root |         | writable copy of #4           |              

# btrfs subvolume get-default /
ID 268 gen 330 top level 261 path snapshots/6/snapshot

# btrfs subvolume list /
ID 256 gen 329 top level 5 path home
ID 257 gen 214 top level 5 path opt
ID 258 gen 327 top level 5 path tmp
ID 259 gen 330 top level 5 path var
ID 260 gen 229 top level 5 path usr-local
ID 261 gen 328 top level 5 path snapshots
ID 262 gen 322 top level 259 path var/lib/machines
ID 263 gen 225 top level 261 path snapshots/1/snapshot
ID 264 gen 227 top level 261 path snapshots/2/snapshot
ID 265 gen 260 top level 261 path snapshots/3/snapshot
ID 266 gen 316 top level 261 path snapshots/4/snapshot
ID 267 gen 315 top level 261 path snapshots/5/snapshot
ID 268 gen 330 top level 261 path snapshots/6/snapshot

# ll /boot/{vmlinuz,initramfs}*
-rw-------. 1 root root 103939016 May 13 19:13 /boot/initramfs-0-rescue-fcd7b7b3e277487a87495bd46b701d74.img
-rw-------. 1 root root  19170409 May 13 19:14 /boot/initramfs-5.17.5-300.fc36.x86_64.img
-rw-------. 1 root root  18872943 May 14 21:13 /boot/initramfs-5.17.6-300.fc36.x86_64.img
-rwxr-xr-x. 1 root root  11802352 May 13 19:11 /boot/vmlinuz-0-rescue-fcd7b7b3e277487a87495bd46b701d74
-rwxr-xr-x. 1 root root  11802352 Apr 28 21:51 /boot/vmlinuz-5.17.5-300.fc36.x86_64
-rwxr-xr-x. 1 root root  11798960 May  9 21:35 /boot/vmlinuz-5.17.6-300.fc36.x86_64

You have now successfully reverted to the most recent kernel fully functional with read-write mode.

After a successful rollback, always ensure that the grub.cfg file is updated so that the snapshots on the grub-btrfs menu are always in sync.

# grub2-mkconfig -o /boot/grub2/grub.cfg

Both tests were successful.

6. Conclusion

You have now successfully configured Fedora to properly roll back to any snapshots. Going from here, you can next configure the home subvolume to take snapshots from the snapper command-line tool. You can also configure the timer to take snapshots at predetermined intervals. Visit the Arch Wiki’s Snapper page for more information.

Watch on YouTube



38 responses to “How to Install Fedora 36 with Snapper and Grub-Btrfs”

  1. Ossama Nasser Avatar
    Ossama Nasser

    I needed to install inotify-tools for grub-btrfsd service to work

  2. pdahse Avatar

    Thanks for this post, really nice.

    Seems now you need also set GRUB_BTRFS_GBTRFS_DIRNAME=/boot/grub2

    in /etc/default/grub-btrfs/config


    otherwise i got this error

    /etc/grub.d/41_snapshots-btrfs: line 569: /boot/grub/ No such file or directory

    when i try to create the grub config (sudo grub2-mkconfig -o /boot/grub2/grub.cfg)

    1. Madhu Desai Avatar

      Hi, pdahse. You most likely did not switch to the ‘Add-systemd-volatile’ branch. There is no such option in the Add-systemd-volatile branch. The master branch did not work for me on Fedora. After creating snapshots, grub-btrfs on the master branch does not automatically update.

      You should check the updated blog ‘How to Install Fedora 37 with Snapper and Grub-Btrfs for Full System Rollback

  3. Ralf Avatar

    I installed fedora using your guide about two months ago and it worked quite will. But now suspend does not work anymore and the support could not help. What is to be considered for reinstallation? Should I reinstall 36 or switch to 37 beta now?
    Thx for your work

    1. Ralf Avatar

      Edit didnt work: the problem persists even when I roll back using snapper

    2. Madhu Desai Avatar

      Hi, Ralf. What happens when you run the command sudo systemctl suspend?

      1. Ralf Avatar

        It takes forever until the system suspends and after wake up I see the login screen without the input line (sometimes only a black screen) and I have no control over mouse or keyboard. Right after a fresh startup, with no running programs suspend works fine.

        1. Madhu Desai Avatar

          Suspend works fine on my system. I’m not sure what’s going on with your system. Try this: open two tabs in the terminal. In the first tab, run the command sudo journalctl -f, and in the second, run the command sudo systemctl suspend. Check the first tab to see what’s going on in the background and which program is holding the suspend. You may get the hint.

          1. Ralf Avatar

            Doesn’t work, the screen goes dark before suspend.
            I’ve tried many things. Now I am just tired of using a system without suspend or hibernate and I have given up on fixing it. I don’t think the problem is due to your setup. This is my first btrfs system I am a little bit afraid of reinstalling fedora on my own account. I have hoped for the release of 37 on Tuesday since I have time this week, but now release was postponed. Maybe the upgrade would fix the issue, maybe I should reinstall 36. Suggestions?

          2. Madhu Desai Avatar

            I suggest that you wait until Fedora 37 is released. In terms of snapshots, not much has changed between v36 and v37. I’m working on an updated version of the installation in which I’ve included all directories in the snapshot regime except /var/log. I believe the system will be more integrated and you will have fewer or no problems if both the RPM and DNF databases are included in the snapshot regime. I’m almost done, and I’ll publish the guide as soon as I get my hands on Fedora 37 ISO, which should be by next Tuesday (1st November).

          3. Ralf Avatar

            OK, I will wait, lets hope my issue will be magically fixed. Thx again for your work..

  4. vince Avatar

    The command systemctl enable –now grub-btrfs.path does not exist.
    To be replaced by systemctl enable –now grub-btrfsd.service

    Thanks for this tutorial.

    1. Madhu Desai Avatar

      Thank you for the update. I’ll make the required changes to the blog.

  5. Lelik Avatar

    Followed your guide, but could not boot from a snapshot:

    1. Fresh install 37-beta on legacy bios
    2. Followed your guide with one small exception: did not modify /boot/efi/EFI/fedora/grub.cfg as no such a file
    3. Updated the kernel; old 5.19.7-300.fc37.x86_64, new 5.19.16-300.fc37.x86_64
    4. Removed /boot/{vmlinuz,initramfs}*
    5. Rebooted
    6. Get an error (as expected):

    error: ../../grub-core/fs/fshelp.c:257:file ‘vmlinuz-5.19.16-300.fc37.x86_64 not found’
    error: ../../grub-core/loader/i386/pc/linux.c:422:you need to load the kernel first
    7.Return to the GRUB menu and this time tried to boot from a last good snapshot with the latest kernel.Still getting errors
    Loading Snapshot: 2022-10-17 18:24:24 snapshots/6/snapshot
    Loading Kernel: vmlinuz-5.19.16-300.fc37.x86_64 …
    error: ../../grub-core/fs/fshelp.c:257:file ‘vmlinuz-5.19.16-300.fc37.x86_64 not found’
    Loading Initramfs: initramfs-5.19.16-300.fc37.x86_64.img …
    error: ../../grub-core/loader/i386/pc/linux.c:422:you need to load the kernel first

    Is it because 37-beta? legacy-bios? something else?

    1. Madhu Desai Avatar

      I tested rollback in Virtual Box and it works fine for me. I haven’t tested this on a real system, but I don’t think it makes a difference. You do not need to add set btrfs relative path="yes" anywhere because it is added to the grub.cfg file automatically. Maybe it’s new in Fedora 37; I’ll see what it was like in Fedora 36. You may verify it by running sudo head -n15 /boot/grub2/grub.cfg.

      Make sure to execute sudo grub2-mkconfig -o /boot/grub2/grub.cfg before and after any changes or rollbacks in case the grub-btrfs program does not update the GRUB menu.

      While creating partitions in Anaconda installed, I noticed that for legacy BIOS, the installer would ask you to create a 2MiB ‘BIOS Boot’ file system. But I’m not sure how important this is.

      Finally, I’m making some changes for Fedora 37. I’ll post the article as soon as Fedora’s final version is released. Probably be on October 25th. Please visit my website for the most recent version of this tutorial.

      1. Lelik Avatar

        I think I know the answer to my own question. I assigned a separate boot partition (ext4) with the rest in Btrfs. Re-read you guide, and you don’t explicitly define /boot, so I assume it’s part of / . Can you confirm? As /boot is not part of snapshots, it fails. Correct?

        If I don’t use any crypt during installation why not format everything to /?

        1. Madhu Desai Avatar

          Hi, Lelik. There is no need for a separate ext4 partition for /boot. In my guide, /boot is a directory within the / volume (/ file system). The snapper is configured to take a snapshot of the / volume (/ file system), with the /boot directory included because it is part of the / volume.

          And yes, if /boot is not in the / volume snapshot, the rollback fails.

          Regarding your last question, you can, of course, format everything to / volume. However, with Fedora 37, only GPT is supported, therefore you must first create a 2 MiB BIOS boot partition (assuming you are using legacy bios), then format the rest to btrfs /.

          1. Lelik Avatar

            Re-installed with boot is a directory within the / volume as you suggested. Tested and it was it indeed. Now the rollback works. Thanks once again.

          2. Madhu Desai Avatar

            You’re welcome. Glad everything went well for you.

  6. Ryan Avatar

    So I just set this up last night. Tried to boot this morning and grub won’t boot. It enters emergency mode and generates a rdsosreport.txt. Any idea how I can see what the issue is? I’m in a live usb right now.

    1. Madhu Desai Avatar

      I’m not sure how you ended up in this situation. Try less rdsosreport.txt or cat rdsosreport.txt in emergency mode. If this does not work, you can use journalctl to diagnose the problem.

  7. Hans Avatar

    Great guide! Worked flawlessly. Do you think this install will survive an upgrade to 37 or will any of the changes be undone?

    1. Madhu Desai Avatar

      There’s not much change in Fedora 37. I was hoping that the DNF database might be moved to /usr in this version. However, this did not happen. Mostly in Fedora 38.

      I’m going to make a few changes now that I know the DNF database will still be in the /var directory. Specifically, how the main volume is formatted, as well as how and which subvolumes are created to include the DNF database for complete undochange and rollback.

      I’ve already finished most of the article, and I’ll publish it as soon as Fedora 37 comes out.

  8. Ethan Avatar

    I’d suggest removing the /tmp subvolume – fedora mounts /tmp with a tmpfs filesystem, so it would not be included in snapshots anyway. If /tmp is on btrfs then it would unnecessarily persist temp files across reboots.

    1. Madhu Desai Avatar

      Thank you for the suggestion. I’ll update it in my next Fedora 37 article, along with other changes.

  9. JamesH Avatar

    Excellent guide! Works like a charm.
    And, my tip is try to do the config of the snapper/btrfs with Btrfs Assistant, which has to be the best GUI for snapper, and works on Fedora.

    Here’s a overview:

    Btrfs Assistant is a GUI management tool to make managing a Btrfs filesystem easier. The primary features it offers are:

    • An easy to read overview of Btrfs metadata
    • A simple view of subvolumes with or without Snapper/Timeshift snapshots
    • Run and monitor scrub and balance operations
    • A pushbutton method for removing subvolumes
    • A management front-end for Snapper with enhanced restore functionality
    • View, create and delete snapshots
    • Restore snapshots in a variety of situations
    • When the filesystem is mounted in a different distro
    • When booted off a snapshot
    • From a live ISO
    • View, create, edit, remove Snapper configurations
    • Browse snapshots and restore individual files
    • Browse diffs of a single file across snapshot versions
    • Manage Snapper systemd units
    • A front-end for Btrfs Maintenance
    • Manage systemd units
    • Easily manage configuration for defrag, balance and srub settings

    It would be great to see the implematation.

    1. Madhu Desai Avatar

      Looks interesting. This is super useful for those who prefer the graphical user interface over the command-line interface. 👍

  10. Egor Zakharov Avatar
    Egor Zakharov

    grub-btrfs has a package in copr. There’s no need to make install.

  11. ForteD Avatar

    For another guys: pls make sure you are update and install nvidia driver in your system first, then reboot, otherwise nvidia driver will mess up your grub config – something about tpm, even rollback cant help.
    So Iam worry about stability of this method in the future, when new update from nvidia driver or system.

    1. A J Avatar
      A J

      Yes. I have repeatedly failed right after installing the nvidia drivers, and then I can never boot or rollback into a r/w snapshopt. openSuse TW did not have this issue tho.

  12. Andrew Avatar

    Thanks for the guide! I just followed all your steps, and now installing via the gnome software app no longer seems to work. Is this expected?

    1. Madhu Desai Avatar

      Yes. Only when you use the dnf command-line interface to install packages are pre-post snapshots created automatically. Unfortunately, Snapper will not capture packages installed through the Gnome Software Center.

      1. Andrew Avatar

        Thanks! I wasn’t expecting snaphots to be created when using Software Centre, but now installation of anything fails with error code -1. Maybe it’s unrelated, though.

        1. Madhu Desai Avatar

          Hi, Andrew. I ran multiple tests, including installing/uninstalling multiple packages from dnf and gnome software center, as well as rolling back random snapshots several times, and I didn’t see any errors on my side. Except for ‘dnf history’ not properly displaying the changes, as I mentioned in my article, nothing went wrong for me.

          1. Andrew Avatar

            Thanks! I’ll try again, I must have messed something up.

      2. ForteD Avatar

        Is there any way to workaround for Snapper capture packages from Gnome Software Center ?, I used to use Arch with Timeshift, it can do that, something related to systemctl I think (in btrfs-grub git)

        1. Egor Zakharov Avatar
          Egor Zakharov

          GNOME Software is using PackageKit. PackageKit relies on libdnf as backend. And until snapper support will be added in libdnf, there’s no workaround… 🙁

    2. Madhu Desai Avatar

      Not related to your question, but please update your system with the two updates I’ve made. They are in sections 2 & 5.

Leave a Reply

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