As you know Debian Live use Calamares for install and every program must have config somewhere
So, start booting with usb live, I've used Gnome Edition and stop to start installation, first we must open terminal:
Code: Select all
sudo -i
nano /etc/calamares/modules/mount.conf
Code: Select all
btrfsSubvolumes:
- mountPoint: /
subvolume: /@
- mountPoint: /home
subvolume: /@home
- mountPoint: /root
subvolume: /@root
- mountPoint: /srv
subvolume: /@srv
- mountPoint: /var/cache
subvolume: /@cache
- mountPoint: /var/log
subvolume: /@log
- mountPoint: /var/tmp
subvolume: /@tmp
- mountPoint: /var/lib/AccountsService
subvolume: /@var@lib@AccountsService
- mountPoint: /var/lib/gdm3
subvolume: /@var@lib@gdm3
- mountPoint: /.snapshots
subvolume: /@snapshots
For better use here you may find the file with correct space and tabulation:
Code: Select all
https://u.pcloud.link/publink/show?code=XZ5S0aVZsykifrjkVJFKlWSCeMPsBBPmALf7
After that you may start standard installation with BTRFS file system as usual, at the end restart BUT THERE'S A TRICK
Debian use in fstab incorrect variation and system stop to work correctly, you must restart again with Debian Live and arrange same change in fstab:
boot again with live and open terminal
Code: Select all
sudo -i
Code: Select all
mount /dev/sda2 /mnt
cd /mnt
cd @
Code: Select all
cd etc
nano fstab
Code: Select all
UUID=47d34a4f-b1f9-4540-9f2d-a2aa563c41e5 / btrfs subvol=/@,defaults,noatime,space_cache=v2,compress=zstd,discard 0 0
UUID=47d34a4f-b1f9-4540-9f2d-a2aa563c41e5 /root btrfs subvol=/@root,defaults,noatime,space_cache=v2,compress=zstd,discard 0 0
UUID=47d34a4f-b1f9-4540-9f2d-a2aa563c41e5 /srv btrfs subvol=/@srv,defaults,noatime,space_cache=v2,compress=zstd,discard 0 0
UUID=47d34a4f-b1f9-4540-9f2d-a2aa563c41e5 /var/cache btrfs subvol=/@cache,defaults,noatime,space_cache=v2,compress=zstd,discard 0 0
UUID=47d34a4f-b1f9-4540-9f2d-a2aa563c41e5 /var/log btrfs subvol=/@log,defaults,noatime,space_cache=v2,compress=zstd,discard 0 0
UUID=47d34a4f-b1f9-4540-9f2d-a2aa563c41e5 /var/tmp btrfs subvol=/@tmp,defaults,noatime,space_cache=v2,compress=zstd,discard 0 0
UUID=47d34a4f-b1f9-4540-9f2d-a2aa563c41e5 /var/lib/AccountsService btrfs subvol=/@var@lib@AccountsService,defaults,noatime,space_cache=v2,compress=zstd,discard 0 0
UUID=47d34a4f-b1f9-4540-9f2d-a2aa563c41e5 /var/lib/gdm3 btrfs subvol=/@var@lib@gdm3,defaults,noatime,space_cache=v2,compress=zstd,discard 0 0
UUID=47d34a4f-b1f9-4540-9f2d-a2aa563c41e5 /.snapshots btrfs subvol=/@snapshots,defaults,noatime,space_cache=v2,compress=zstd,discard 0 0
UUID=5ad96b47-98e1-410b-a7ca-6246c9d43d81 /home btrfs defaults,noatime,space_cache=v2,compress=zstd,discard 0 0
This is the fist step, to have a correct file system in btrfs with correct subvolumes
As you may see my /home is in normal partition and not in subvolume, this is a problem for Calameres because I have 2 disks and home is in second disk and Calamares doesn't recognize this, on my other laptop with only 1 hard disk all has gone well.
SNAPPER
We will install Snapper and the required packages to set GRUB-BTRFS with:
Code: Select all
sudo apt install snapper inotify-tools git make
Code: Select all
cd /
sudo umount .snapshots
sudo rm -r .snapshots
Code: Select all
sudo snapper -c root create-config /
We will remove this new subvolume and link our own created snapshots subvolume to this path, so our snapshots will be safely stored in a different location.
To remove the auto-created subvolume use:
Code: Select all
sudo btrfs subvolume delete /.snapshots
Code: Select all
sudo mkdir /.snapshots
Code: Select all
sudo mount -av
Code: Select all
sudo systemctl disable snapper-boot.timer
Code: Select all
sudo snapper -c root set-config 'TIMELINE_CREATE=no'
Code: Select all
sudo snapper -c root set-config 'ALLOW_GROUPS=sudo
sudo snapper -c root set-config 'SYNC_ACL=yes'
Code: Select all
sudo snapper -c root set-config "NUMBER_LIMIT=30"
sudo snapper -c root set-config "NUMBER_LIMIT_IMPORTANT=30"
Code: Select all
sudo snapper -c root create --description "default fresh install"
GRUB-BTRFS is not available on the Debian repos so we are going to install from source, let’s clone the repo and install it:
Code: Select all
git clone https://github.com/Antynea/grub-btrfs.git
cd grub-btrfs
sudo make install
Now we must enable the monitoring service so that GRUB-BTRFS can automatically update every time we create or delete a snapshot and update our grub menu with:
Code: Select all
# To start the daemon run:
sudo systemctl start grub-btrfsd
# To activate it during system startup, run:
sudo systemctl enable grub-btrfsd
Snapper-Rollback
Also needs to be installed from Git:
Code: Select all
cd ..
# if you were inside the previous git repo
git clone https://github.com/jrabinow/snapper-rollback.git
cd snapper-rollback
sudo cp snapper-rollback.py /usr/local/bin/snapper-rollback
sudo cp snapper-rollback.conf /etc/
sudo nano /etc/snapper-rollback.conf
Code: Select all
# config for btrfs root
[root]
# Name of your linux root subvolume
subvol_main = @rootfs
Additional tools:
If you want you may also install btrfs-assistant, this is an easy tools for snapshots management, very nice to use:
https://gitlab.com/btrfs-assistant/btrfs-assistant
Another tools also good for description in snapper is
https://gist.github.com/imthenachoman/f ... 2d83263118
in debian snapper has not description, just one pre and one post apt, with this script you will have a full descption.