Le0xFF / VoidLinuxInstaller

A bash script to install Void Linux with optional LUKS encryption, optional LVM, btrfs filesystem and optional swap as file.
GNU Affero General Public License v3.0
53 stars 8 forks source link

Snapshot and subvolume errors? #12

Open lawmanuk opened 10 months ago

lawmanuk commented 10 months ago

Hi,

I usually use Timeshift for snapshots on btrfs as gui is easier than snapper.

I've found that TimeShift can make snapshots after installing with this script, but it fails to restore snapshots at boot - only when using this script. Other void users don't seem to have this issue (reddit voidlinux admin suggested I stop using this script to overcome the TimeShift snapshot restore problem - but this script is too good! :) ).

I suspect the problem might be with the subvolume structure used? Could you please consider if this is causing a bug.

Although the vli.sh file seems to want to create subvolumes @log and @cache, I find that these aren't actually created. Additionally, the fstab doesn't refer to these and instead maps @/var/log instead of @log to /var/log. Could these be causing the issue?

I've given examples of the the differences with void subvolume setup shown in fstab (where timeshift doesn't work), compared to void setup shown in fstab (where timeshift does work).

void fstab and subvolume setup

#
# See fstab(5).
#
# <file system> <dir>   <type>  <options>       <dump>  <pass>

# Root subvolume
UUID=86886e10-a2ca-4db6-82cb-b81d53491d5d / btrfs rw,noatime,discard=async,compress=zstd:13,space_cache=v2,commit=120,subvol=@ 0 1

# Home subvolume
UUID=86886e10-a2ca-4db6-82cb-b81d53491d5d /home btrfs rw,noatime,discard=async,compress=zstd:13,space_cache=v2,commit=120,subvol=@home 0 2

# Snapshots subvolume, uncomment the following line after creating a config for root [/] in snapper
UUID=86886e10-a2ca-4db6-82cb-b81d53491d5d /.snapshots btrfs rw,noatime,discard=async,compress=zstd:13=zstd,space_cache=v2,commit=120,subvol=@snapshots 0 2

# Some applications don't like to have /var/log folders as read only.
# Log folders, to allow booting snapshots with rd.live.overlay.overlayfs=1
UUID=86886e10-a2ca-4db6-82cb-b81d53491d5d /var/log btrfs rw,noatime,discard=async,compress=zstd:13,space_cache=v2,commit=120,subvol=@/var/log 0 2

# TMPfs
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0

# EFI partition
UUID=32D5-A5EA /boot/efi vfat defaults,noatime 0 2

#data
/dev/mapper/data                            /mnt/data       btrfs       defaults,noatime,compress=zstd:13 0 0

manjaro fstab and subvolume setup

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
#UUID=BB0C-AE00
/dev/nvme0n1p1                            /boot/efi      vfat    umask=0077 0 2
/dev/mapper/luks-d711e27f-7af5-4692-b57b-a612fa47740e /              btrfs   subvol=/@,defaults,discard=async,ssd,compress=zstd:13      0 0
/dev/mapper/luks-d711e27f-7af5-4692-b57b-a612fa47740e /home          btrfs   subvol=/@home,defaults,discard=async,ssd,compress=zstd:13  0 0
/dev/mapper/luks-d711e27f-7af5-4692-b57b-a612fa47740e /var/cache     btrfs   subvol=/@cache,defaults,discard=async,ssd,compress=zstd:13 0 0
/dev/mapper/luks-d711e27f-7af5-4692-b57b-a612fa47740e /var/log       btrfs   subvol=/@log,defaults,discard=async,ssd,compress=zstd:13   0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0

/dev/mapper/data                                      /mnt/data      btrfs   defaults,noatime,compress=zstd:13 0 0
Le0xFF commented 10 months ago

Hello!

I never used Timeshift, so I never tried if my subvolume setup worked or not with it. Another reason why it doesn't work with it is that /var/log and /var/xbps/cache are created as nested subvolumes and maybe that's causing issues with Timeshift

Additionally, the fstab doesn't refer to these

That' mostly correct. Only the /var/log subvolume is mounted in the fstab to avoid application complaining (like X.org) that log folder is not writable when bootong a read-only snapshot. For /var/xbps/cache instead I just created a subvolume to be able to set a different snapshot policy for it, since that folder could become quite large 😁

I was planning to make /var/log and /var/xbps/cache as normal subvolumes and not nested ones. But anyway I will take a look also at the suggested layout of Timeshift and see what I can do to fix the issue!

But again, no ETA, expecially during Christmas holidays 😄

Le0xFF commented 10 months ago

I usually use Timeshift for snapshots on btrfs as gui is easier than snapper.

Also I want to add that if the problem is having a GUI, there are third party GUI solution, like snapper-gui (that I personally use) and Btrfs Assistant!

lawmanuk commented 3 months ago

Hi,

The nested subvolumes def creates issues in a few ways I found.

  1. Timeshift won't work with it.
  2. I backup my entire system to restic. This allows migration to other computers and complete restore if something bad happens.

Neither work with nested subvolumes. If you get some time, please consider fixing.

thanks for the great installer.

Le0xFF commented 3 months ago
  1. I think Timeshift expect a specific subvolumes structure, that I'm not interest to supportit. As said in a previous comment, other solutions exists.
  2. I have no idea what "restic" is and how it works. Could you please link some documentation and, if possible, explain why it does not work? That would be really helpful.