1. Removed the subvol option from fstab
2. Set the subvolume default of btrfs
3. Run sudo dracut --force
Doing #2 and #3 multiple times switching between subvolumes 257 and 276 and rebooting after each switch, everything went ok.
BUT, when doing a qubes-dom0-update after switching to the 'root' subvolume (ID 257), then I got said error again after switching back to ID 276 (subvolume before-update).
I'm completely stuck here, and a step-by-step howto would be greatly appreciated.
Thanks,
Bodo
https://github.com/QubesOS/qubes-issues/issues/1871 https://btrfs.wiki.kernel.org/index.php/SysadminGuide#Snapshots
Here are my notes to solve the problem of making and rolling back a btrfs snapshot after updating dom0 (in Emacs org-mode format):
* Qubes
** Install on btrfs
*** Manual partitioning
In order to select btrfs as the root filesystem you have to
select"Manual Partitioning". However selecting btrfs is not so
easy. You have to follow this contrived avenue:
1. Select "Automatic partitioning" first and go thru the
procedure until you're back to the main installation screen.
2. Select "Manual partitioning". In the dropdown select "btrfs".
Then click on the link above to create the partitions.
*** Later during installation
During the installation we are dropped into a shell due to
missing rootflags in xen.cfg. To fix this temporarily:
# Make our btrfs system writable
$>mount -o remount,rw /sysroot
# List all subvolumes. Write down the ID for the 'root'
subvolume. For me it was 257
$>btrfs subvolume list /sysroot
# Change default subvolume to 'root'. Change 257 to whatever you
got from the previous command
$>btrfs subvolume set-default 257 /sysroot
# Make sure the change was applied
$>btrfs subvolume get-default /sysroot
# Unmount and reboot into a working system
$>umount /sysroot
# Reboot the system
*** After finishing the installation
**** Reset the btrfs default subvolume to the top-level subvolume (ID 5)
$>sudo btrfs subvolume set-default 5 /
**** Edit /boot/efi/EFI/qubes/xen.cfg
Add the following to the kernel line(s)
rootflags=subvol=root
Do NOT set the subvolid! It would make things harder down the
road.
**** Edit /etc/fstab
Copy the line that mounts to / and contains the option
subvol=root. On the copied line change
/ to /top-level
and
subvol=root to subvol=/
This will allow us to access the top-level subvolume again.
We'll need that to move around snapshots.
**** Add the mount point for the top-level subvolume
$>sudo mkdir /top-level
*** Make a snapshot, e.g. before updating dom0
First, let's have a look at our subvolumes.
$>sudo btrfs subvolume list /
ID 257 top level 5 path root
ID 274 top level 257 path var/lib/machines
As level 257 indicates in the second line, the subvolume
var/lib/machines is nested in subvolume root. Nested subvolumes
are NOT snapshot when snapshotting their parent. Hence we need
not only snapshot subvolume root, but also subvolume
var/lib/machines to be able to rollback:
# Snapshot subvolume root
$>sudo btrfs subvolume snapshot /top-level/root /top-level/before-update
# Remove the empty directory from the snapshot
$>sudo rm -rf /top-level/before-update/var/lib/machines
# Snapshot the nested subvolume var/lib/machines
$>sudo btrfs subvolume snapshot /var/lib/machines \
/top-level/before-update/var/lib/machines
Don't forget to note the kernel you are currently booting.
*** Rollback a snapshot, e.g. after a dom0 update went havoc
Let's assume we have the above created snapshots. Do NOT set the
default subvolume to the snapshot. Instead use 'mv'.
**** Move snapshot into place
# Move subvolume var/lib/machines out of the way
$>sudo mv /top-level/root/var/lib/machines \
/top-level/root/var/lib/machines.old
# Move subvolume root out of the way
$>sudo mv /top-level/root /top-level/root.old
# Rollback the snapshot into root's place
$>sudo mv /top-level/before-update /top-level/root
**** NOTABENE: MAKE SURE YOU'LL BOOT THE CORRECT KERNEL
In the context of rolling back a snapshot after updating dom0,
it might have occured that the dom0 update installed a newer
kernel,
thus modifying the xen.cfg. After rolling back the snapshot you
must therefore make sure that you'll boot into the pre-update
kernel next time. Hopefully, you noted the kernel used before
the dom0 update!
So, edit /boot/efi/EFI/qubes/xen.cfg to point the default back
to the right kernel!
Now you're ready to reboot.
Hope that helps.
Thanks,
Bodo