I came across btrfs subvolume set-default a couple of weeks ago, after seeing a reference to snapper using it to restore to a snapshot.
Beware, there are pitfalls here. I blundered into a couple, both causing a failure to boot.
The "default subvolume" is normally set to the btrfs root, subvolume id 5. I mucked about with this to see what it would do, and it's tricky in that setting it has no effect until the next time the btrfs is mounted. So, I could screw things up, and found out about it a week later when Kubuntu failed to boot.
The "subvol=" and subvolid=" mount options override the default subvolume, and that can lead to inconsistencies. grub presently generates "rootflags=subvol=" on the linux command line, which become the mount options the kernel uses. I don't know how snapper-rollback gets around that. I've seen posts where the poster removes that phrase in grub.cfg to enable boot from the default subvolume.
So, I (misguidedly) set the default subvolume to be the root of the install I want to boot by default... That was fine till I tried to do a fresh install of kinetic to try it out, same as I have every release for years, expecting it to install into @ and @home as usual. The installer put @ and @home into the default subvolume, which should have been ok, but then went a level up, (leaving @ empty) then deleted most of /usr, /var, /snap and /etc, and crashed. Ok, the installer crashed, it's pre-release, whatever. But the next day, Kubuntu didn't like it at all that most of it had been deleted. I could quickly restore from a snapshot (though I wasted time trying to copy files over).
Setting the default subvolume should be a cool way to control where the install goes, but I'm not sure the installer will cope.
Beware, there are pitfalls here. I blundered into a couple, both causing a failure to boot.
The "default subvolume" is normally set to the btrfs root, subvolume id 5. I mucked about with this to see what it would do, and it's tricky in that setting it has no effect until the next time the btrfs is mounted. So, I could screw things up, and found out about it a week later when Kubuntu failed to boot.
The "subvol=" and subvolid=" mount options override the default subvolume, and that can lead to inconsistencies. grub presently generates "rootflags=subvol=" on the linux command line, which become the mount options the kernel uses. I don't know how snapper-rollback gets around that. I've seen posts where the poster removes that phrase in grub.cfg to enable boot from the default subvolume.
So, I (misguidedly) set the default subvolume to be the root of the install I want to boot by default... That was fine till I tried to do a fresh install of kinetic to try it out, same as I have every release for years, expecting it to install into @ and @home as usual. The installer put @ and @home into the default subvolume, which should have been ok, but then went a level up, (leaving @ empty) then deleted most of /usr, /var, /snap and /etc, and crashed. Ok, the installer crashed, it's pre-release, whatever. But the next day, Kubuntu didn't like it at all that most of it had been deleted. I could quickly restore from a snapshot (though I wasted time trying to copy files over).
Setting the default subvolume should be a cool way to control where the install goes, but I'm not sure the installer will cope.
Comment