After using Mint 20.x with Timeshift to roll back to a previous version of /, and having two weeks to learn Fedora, I decided to go with Fedora35 with btrfs.
After installing Fedora with btrbk, I had still some problems with rolling back. To set up btrbk, I used this nice guide Fedora Workstation 35 with automatic btrfs snapshots and backups using BTRBK | Willi Mutschler (without LUKS, but with an extra internal ssd of 128GB). I succeeded in setting up btrbk, and creating several snapshots, but not to roll back to a previous snap propperly. There were no other reason for a roll back, then just learning how to roll back. Doing/learning so, I broke my system and decided to do an clean reinstall, and ask how to proper set up Fedora 35 with btrfs, btrbk, and to roll back.
In order to do my own research, I only found either articles how to set up, or how to roll back with an already read-write snaps, or how to roll back /home with /etc/fstab. Therefore I guess that I created just read-only snaps, thus Fedora I failed to do an roll back to a previous snap of /.
Either way, I have 10 days left of my vacation to proper learn Fedora35 with btrbk. Although I will follow that guide of Mutschler again, to my understanding, he does not describe how to do an read-and-write snap and how to roll back. Feel free to drop other guides, or write some command of your own.
This morning on a clean install of F35, I followed the Mutschler guide again. I ignored the LUKS stuff, but did the extra internal drive stuff. (For guide, see first post.)
Now I will look up how to (re)name a snapshots, so that they are easier to understand by humans To name a snapshot, just create create a manual snap to the backup, with btrfs subvolume snapshot -r / /btrfs_backup/[name] (see also point 3 of @sampsonf)
Then I will install some stuff
And do a roll back suggested above
Keep you all posted…
Edit: Hum, I am getting stuck at step 5, maybe because I used the settings of Mutschler, and not yours. Therefore i guess I am stuck in ‘translating’ your suggestion into Mutschler’s.
When I do a sudo btrfs subvolume list /, it gives me a full list, and I would like to roll back to ID 287 gen 431 top level 257 path btrfs_backup/fedora35-fresh
In order to ‘translate’ your setup/suggestions into Mutschler’s, I guess I have to do the following sudo btrfs subvolume snap /btrfs_backup/fedora35-fresh /[location of old root]. Am i here correct?
Okay, I did changed all in the order above, and F35 will not reboot, I get stuck in “emergency mode”. Thus I used the live medium -that I used to install this F35- to check the files that I have changed to roll back. The results are now that /run/media/[user]/[disk]/etc/fstabhas become “unwritable”, and there is nothing in ~/boot/, not even a subdirectory ~/boot/loader/entries.
Because I updated F35 before I did set up btrbk like Mutschler suggested, the kernel is 5.15.18-200. Thus using the /boot/loader/entries I could recreate the boot loader file, and only changing the kernel version and de UUID of my disks. Or I could reinstall and do it all over again, but then there is change that i just reproduce this error.
Suggestions are of course welcome…
ps. I have only problem with rolling back the /. /home is save, and I have all files back upped on three different drives.
Why not using Timeshift with Fedora 35? The Timeshift current version available from Fedora repo may not work (the version too old), but you can build it from the source or install it from Fedora Copr here.
We only need to rename the subvolume of root to @ and create another subvolume for home as @home and move the contents of /home to @home then mount @home subvol to /home from fstab. Don’t forget to double check the fstab and kernel parameter with grubby.
If after reboot you failed to open Timeshift from terminal, most likely you need to run sudo btrfs quota enable / and make/create manual conf in /etc/timeshift/timeshift.json.
Okay, this is weird. TLDR: With a cold reboot I get to choose between three boot loader entries, but with a warm boot, there are no boot loader entries. Despite every boot loader entry has subvolid=287 for root, I get subvol=5 for root.
This morning after a cold boot, I got page where I could choose between three boot loader entries. First for kernel 5.15.18-200, the second for kernel 220.127.116.110, and the third for Rescue. I choose the loader for kernel 5.15.18 and Fedora35 boots fine, but with the newest snapshot of /, despite the set-default is still subvolid=287. This is only true for a cold boot.
However, this is not rue for a ‘warm’ boot. When I reboot and the mother board stays on- thus the Power Supply Unit is not switched off- then Fedora35 fails to load, I get the “emergency mode” again, and there is nothing in /boot. This is only true for a warm boot.
When I shut down the computer, switch off the PSU for some second (so that the mobo is not warm/is cold), and switch on the PSU and reboot, I get that “page I could choose between three boot loader files. First for kernel 5.15.18-200, the second for kernel 18.104.22.1680, and the third for Rescue. Each option gives me the newest snapshot of /, but not the set-default which is in my case subvolid=287.” This is only true for a cold boot.
When I do a cold reboot again (see step 3: shutdown, switch off, switch on, boot), I get that “page I could choose between three boot loader files (…)”.This is only true for a cold boot.
When I do a warm reboot again (see step 2: shutdown, reboot, but not switching off/on the PSU), I get “the ‘emergency mode’ again, and there is nothing in /boot.” This is only true for a warm boot.
Thus with a cold reboot I get to choose between three boot loader entries, but with a warm boot, there are no boot loader entries. Despite every boot loader entry has subvolid=287 for root, I get subvol=5 for root.
So, what shall I do now? Still here to learn…
That is indeed a fine question, but I have made my choose already. However, here are my thoughts about my choice for btrbk: I choose to learn Fedora and Linux in general too, over to mere replace Mint and keeping my old habits.
Primarily: As I have already mentioned in the OP, I have some time to spend for learning Fedora, of which I still have 7 days left. I thought it would be nice, to learn more about Fedora, than as a mere replacement of Mint and keeping to my old habits. Therefore I choose to learn more about Fedora, and not to mere replace Mint.
Secondarily: Now I have enough time to learn more about Linux too, and set up Fedora just as I like it. Therefore installing and setting up Fedora, became for me a (crash)course Linux and related applications. Again, the difference is to learn more about Linux, rather than to mere replace Mint.
Conclusion: The difference is thus that I choose to learn Fedora35, over to replace Mint, in order to learn more about Linux for a more personal, flexible and scale proof setting. Where I have learned more about Fedora35 and Linux too in general with btrbk, I could not have so with a mere replacement of my old habits.
Or written the same, but differently:
Learn Fedora & Linux > Replace Mint with Fedora & keeping old habits.
Okay, this get weirder. After I ran btrbk run, despite I do a cold or warm boot, I get stuck in “emergency mode”. Thus I get now stuck as well the boot loader profiles of kernel 5.14 and kernel 5.15, but not with the boot loader profile of Rescue.
When I ask for my default snap of btrfs in Rescue with btrfs subvol get-default /, I get ID 287 gen 1009 top level 257 path root/btrfs_backup/fedora35-fresh. However, my most recent snapshot of root is ID 302 gen 1002 top level 5 path _btrbk_snap/root.20220204T1401.
Therefore I am wondering if the preferred snapshot should be in /_btrbk_snap/ instead of /btrfs_backup/. Again, btrbk is set up with that guide of Mutschler.
Either way, the only way to use Fedora35 now is using the Rescue boot loader entry, and not a normal entry. Although this works, I prefer to use the normal way. Therefore I tend to follow a suggestion in the Telegram group Fedora Linux, and to do the following for a “roll back” by using a live media:
nano /etc/fstab/ to change subvol=root into subvolid=[preferred root ID]
This is confusing, but the / mountpoint line is a remount operation, unlike any other line in fstab. The kernel itself does the initial mount based on boot parameters: ro root=UUID=$fsuuid rootflags=subvol=root The first two are commonly seen with other file system’s too but Btrfs can have many “roots” so the way this is defined is with rootflags= which defines mount options for the root file system. The mount option is subvol=root because the name of the subvolume being used for the root file system is “root” (by default, in Anaconda), hence rootflags=subvol=root. The subvol= mount option in fstab doesn’t make sense for /because we can’t change subvolumes on a remount, but we can change some other mount options on a remount like remount,rw or remount,compress=zstd:1 are valid. What’s a valid remount mount option is not exactly obvious, just like what is a VFS mount option in common to all file systems is non-obvious.
Also note that the kernel command line option rootflags=subvol=root will override the default subvolume set with btrfs subvolume set-default. In general, you’d use one or the other. For example, use set-default in the usual case, without rootflags option; but then maybe your rescue BLS snippet does use rootflags in order to ensure you mount a specific root, overriding the set-default subvolume.
As for the cold boot vs warm boot, I don’t have an explanation for this. There’s nothing unique about the system cold vs warm boot once we’re at GRUB. I might wonder if there’s a firmware anomaly that causes it to use different NVRAM entries depending on cold vs warm boot, and in fact you’ve got more than one /EFI/fedora directory on the ESP? That too would be weird, but less weird than non-deterministic results that we can’t account for.
Another possibility is if /boot is on Btrfs, and maybe the warm vs cold boots are somehow picking different btrfs roots on the /boot file system (if you have more than one subvolume on it). You definitely can quickly get into a maze with multiple btrfs subvolumes on /boot because it can mean different /boot/loader/entries depending on which subvolume is followed.
Okay, due to different guidelines, manuals, etc, I have messed it up, but this is also a way to learn more about Fedora35. When I do my roll back/restore correctly, Fedora boots just fine. When I do my roll back/restore wrong, Fedora35 boots wrong and start to behave like this:
Step 5 is not necessary. By default btrfs snapshots are read-write, with -r flag making them read-only. Bit obscure, but any “received” snapshots (using btrfs send|receive) have a received uuid field in their metadata, and this field is unset when using the property subcommand to change ro->rw (there is a warning). It’s better to just make another snapshot rather than use the property subcommand. They are really that cheap.