DEV Community

jedugsem
jedugsem

Posted on

Arch/Manjaro snapper with Suse partition sheme

Hello,
I've tried to install Arch or Manjaro with or without the Architect Installer, which supports Snapper rollback and bootable snapshots though the default subvolume like Suse worked out. I wanted to provide this partition sheme also for unexpirienced users so i modified Manjaro Architect so everyone can easily install. I created a PKGBUILD for Grub with the patches from Suse, also I habe modified snap-pac-grub so the snapshots occur on grub because i dont use grub-btrfs because with the Suse patches in Grub there is a much simpler option. I'll try to bring the PKGUILD in the Aur but I need help or time, so atm you have to download them from my Google Drive. I've only tried this with Uefi but maybe it would work with legacy too.

Here the link to my drive, if you know a bit about PKGBUILD please give me feedback.
Link

So here the short installation instructions
At first you have to create the subvolumes in your at /mnt mounted btrfs partition
"$(root_partition)" you have to replace.

This sheme is copied from Suse but you can change it if you keep the snapshot subvolume which you will obiosly need.

cd /mnt
btrfs subvolume create @
btrfs subvolume create @/.snapshots
mkdir ./@/.snapshots/0
btrfs subvolume create @/.snapshots/0/snapshot
btrfs subvolume create @/home
btrfs subvolume create @/opt
btrfs subvolume create @/root
btrfs subvolume create @/srv
btrfs subvolume create @/tmp
mkdir @/usr/
btrfs subvolume create @/usr/local
btrfs subvolume create @/var
chattr +C @/var
btrfs subvolume set-default $(btrfs subvolume list /mnt | grep "@/.snapshots/0/snapshot" | grep -oP '(?<=ID )[0-9]+') /mnt

cd /
umount /mnt
cd /mnt

# Mount root and create final mount-points 
mount "$(root_partition)" /mnt
mkdir /mnt/.snapshots
mkdir /mnt/home
mkdir /mnt/opt
mkdir /mnt/root
mkdir /mnt/srv
mkdir /mnt/tmp
mkdir -p /mnt/usr/local
mkdir /mnt/var

# Mount them in the right directorys
mount -o subvol=@/.snapshots "$(root_partition)" /mnt/.snapshots 
mount -o subvol=@/home "$(root_partition)" /mnt/home 
mount -o subvol=@/opt "$(root_partition)" /mnt/opt
mount -o subvol=@/root "$(root_partition)" /mnt/root 
mount -o subvol=@/srv "$(root_partition)" /mnt/srv
mount -o subvol=@/tmp "$(root_partition)" /mnt/tmp 
mount -o subvol=@/usr/local "$(root_partition)" /mnt/usr/local
mount -o subvol=@/var "$(root_partition)" /mnt/var 
'''
Make your installation yet without grub
from now on all commands have to be exicuded in chroot
'''
cd grub-suse-git
makepkg -sfCi # some there were problems with locales exspecily with the fish shell but a restart of the shell should help
sed -i '/SUSE_BTRFS_SNAPSHOT_BOOTING/s/^#//g' /etc/default/grub     # to enable bootable snapshots
grub-install
grub-mkconfig -o /boot/grub/grub.cfg
sed -i s/\#IgnorePkg   =/IgnorePkg = grub-suse-git/  /etc/pacman.conf # so it wont be overidden at update but i optimized the PKGBUILD so i dont know if this needed
Enter fullscreen mode Exit fullscreen mode

Yet you can install and configure snapper:

pacman -S --noconfirm snapper
cp /etc/snapper/config-templates/default /etc/snapper/configs/root # Kopierung der Snapper konfiguration da dieser wenn schon das @/.snapshot Subvolume existiert keine erstellen kann.
sed -i "s/\=\"\"/\=\"root\"/"  /etc/conf.d/snapper # Aktivierung der Konfiguration
systemctl enable cronie
sed -i "s/done/done\ngrub-snapper-plugin -r/" /etc/cron.hourly/snapper # so the timeline snapshots occur in Grub
Enter fullscreen mode Exit fullscreen mode

To enable snap-pac so that there pre and post snapshots:

pacman -S --noconfirm snap-pac # Pacman Hook which creates snapshots before and after transaction
cd snap-pac-grub-suse
makepkg -sfCi
Enter fullscreen mode Exit fullscreen mode

To add and enable snapper-gui although i found it relativly useless:

pacman -S --noconfirm snapper-gui
sed -i s/ALLOW_GROUPS=\"\"/ALLOW_GROUPS=\"wheel\"/ /etc/snapper/configs/root # so snapper list works for every user which can call sudo
Enter fullscreen mode Exit fullscreen mode

I hope this is enough to get it working without problems and I would be really happy about feedback.
Also my english is very bad also in school so sry for that I hope everyone understands everything.

Top comments (0)