EOS with custom btrfs/snapper setup

hi guys

im planning to migrate from opensuse tumbleweed to EOS on my main machine. one particular feature from suse, that i dont wanna miss, is the btrfs/snapper functionality. i know this can be done on EOS, but im struggling a bit. im testing this in a virtual machine right now.

installation of EOS (with btrfs) is not the issue, thats super easy fortunately :slight_smile:

what i want

  1. i am going to use the whole ssd for EOS, however i dont use /home in a traditional way. i dont really like personal files and dotfiles, python programs, etc mixed up in /home. all my personal files will be on another ssd. therefore i want to include /home in my root snapshots. as far as i understand deleting the @home subvolume (before setting up snapper) will result in root snapshots including the /home folder (since its not a seperate subvolume anymore).

  2. i want bootable read-only snapshots taken automatically via the pacman/yay hook. i dont want snapshots taken from a time schedule, which is often included in snapper. also im a bit confused about kernels. when pacman updates the linux kernel old snapshots will not work anymore, right? since the kernel itself is not included in the snapshot. i would really like snapper (or pacman/yay hook) to backup kernels too, so i can boot into snapshots if the kernel-update goes wrong

what ive planned so far

  1. fresh install of EOS with BTRFS (suggested layout by calamares)

  2. deleting @home subvolume

sudo umount /home
get ID of @home → sudo btrfs subvolume list /
sudo btrfs subvolume delete -i HOMEID /
comment out /home in /etc/fstab
reboot
mkdir $USER in /home
sudo chown -R $USER /home/$USER
sudo chmod -R 755 /home/$USER

  1. setting up snapper (from a youtube tutorial)

sudo pacman -S snapper snap-pac grub-btrfs
umount /.snapshots
rm -r /.snapshots
snapper -c root create-config /
btrfs subvolume delete /.snapshots
mkdir /.snapshots
mount -a
grub-mkconfig -o /boot/grub/grub.cfg


ive read/watched guides on how to do this, but theyre either outdated or contradict each other. also i dont know if i should use the aur packages snapper-support and/or btfs-assistant or if i should install them first or after setting up everything else

im sure this is not too hard, but at this point im super confused. and i really dont wanna reinstall trial-and-error several times. please help :joy:

No problem. We can help here.

You can do it this way if you want. However, it would be easier if before launching the installer, you edit /etc/calamares/modules/mount.conf and delete the two lines that reference home. That will stop it getting created in the first place.

If you do follow your instructions, don’t forget to mount the snapshot somewhere else and copy the files out of it. Alternatively, you could delete your user account and recreate it.

Those probably aren’t the commands you need. However, in order to help you with the right steps, I need to know if you want suse-style rollbacks.

OpenSUSE doesn’t actually restore the root. When you rollback root, it actually changes the default subvol and you just start booting off the snapshot instead(permanently). You can do this but it will require using snapper for restores at the CLI. You won’t be able to use Btrfs Assistant for example to rollback root.

Most other distros/tools restore by replacing the subvol with the snapshot and keeping the same subvol name. This is what most of our users do.

snapper-support is a package that sets everything up for you. You should either install it first or not at all.

btrfs-assistant is a GUI tool which helps you manage btrfs and Snapper. It doesn’t really matter when you install it but it can make creating the Snapper configs easier.

1 Like

oh yeah, that sounds way easier! im gonna do it like this

those 2, right?

well tbh im not really sure, i guess the way most other distros do it sounds better to me. booting into a snapshot and just running “snapper rollback” is super convenient though, but the scenario that my system actually breaks shouldnt happen too often. ive read about the “arch way” of doing snapper rollback, its a little more complicated, but i dont mind. i just wanna be able to still have a functional system (snapshot), in case something goes wrong

i do like to configure on my own, so snapper-support is probably not needed then. ive read that you are the author and maintainer of btrf-assisant :slight_smile: so i will check it out for sure

Yep, those two.

OK, I haven’t tested this precisely, but I think the instructions would be something like this:

  • yay -Syu snapper inotify-tools snap-pac grub-btrfs btrfs-assistant btrfsmaintenance (You don’t need the last two but they are convenient. I am going to use Btrfs Assistant in the instructions but it can all be done via the CLI as well)
  • In Btrfs Assistant, on the “Snapper Settings” tab:
    • Uncheck “Snapper timeline enabled” so you won’t get hourly snapshots
    • Check “Snapper cleanup enabled” to automatically delete older snapshots based on your retention rules
    • Click “New”, select / in the box and use the name “root” for the config
    • Set the settings to your preference although since we disabled the timeline timer, the only one that matters is the “Numbers” setting. This is the number of snapshots from pacman operations that will be retained. Keep in mind that it takes two snapshots for each so if you set this to 10 you will get 5 pacman operations.
  • After saving the changes, go to the snapper tab and take a manual snapshot to ensure that it works and for testing.
  • Run sudo systemctl enable --now grub-btrfsd
  • Run sudo grub-mkconfig -o /boot/grub/grub.cfg
  • Install or remove a package using yay or pacman
  • Reboot and see if the snapshots are in your grub menu. You should see 3 snapshots. The manual one and the two from the pacman operation.
  • Go back into Btrfs Assistant and delete the manual snapshot we created earlier.
1 Like

thanks so much :slight_smile: i will test this once the installations is finished

what about kernels, though? is it correct that old snapshots wont work, when the kernel is updated, or did i misunderstand this?

the only possible solution for this i found so far would be this article in the arch wiki

As long as you choose grub as the bootloader during the install process, the kernel and initramfs will be part of the snapshot so you should not have issues with this.

We do not use a separate /boot by default.

1 Like

installation/setup worked flawlessly!

i installed neofetch and was confused, that it was also present in the manual snapshot (before installation of neofetch). its preinstalled in EOS probably :joy: it worked fine with exa! but the grub-menu didnt update automatically after installing exa, is that what the grub-btrfsd service is supposed to do? systemctl status grub-btrfsd says its enabled and running

whats the difference between initramfs-linux and initramfs-linux-fallback?


i just tested restoring a snapshot with btrfs-assisant. works just as intended and is as easy as it gets. so if my system breaks i can boot into a snapshot and restore any snapshot i want like that? thats actually amazing

Yes. That is what it is supposed to do.

initramfs-linux contains the minimal information you need to boot the system. initramfs-linux-fallback contains a more generic set of included files and drivers. You would only use that one if the normal initramfs fails.

Yes. That is how it should work. :slight_smile:

1 Like

i think restoring the snapshot disabled grub-btrfsd, thats why it didnt refresh the grub-menu. i re-enabled it and played around a bit installing some packages, works perfectly!

thanks so much for your support! :penguin_face::heart:
if you have buymeacoffee or anything similar let me know

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.