Unable to boot from Snapshot [SOLVED]

Hello,

I have installed systemd-boot on my Garuda. This is a laptop and the root disk is encrypted.
I have a 256Mb vfat efi partition mounted on /boot with the initrd, kernel and efi stuff not encrypted. I have an encrypted root btrfs partition with some subvolumes. I use snapper to take snapshot of the root subvolume and I'm trying (for a test) to boot from a previous snapshot to see if it works OK.

I have added the folllowing entry to the /boot/loader/entries to boot on this particular snapshot :

title snapshot 81
linux /vmlinuz-linux-zen
initrd  /amd-ucode.img
initrd /initramfs-linux-zen.img
options rd.luks.name=86691f1a-15a7-4cc6-823e-08eab8fb14b4=luks-86691f1a-15a7-4cc6-823e-08eab8fb14b4 root=/dev/mapper/luks-86691f1a-15a7-4cc6-823e-08eab8fb14b4 rootflags=subvol=.snapshots/81/snapshot rd.luks.options=discard rw

It is essentially a copy of the regular boot entry but with the rootflag pointing to the snapshot subvolume. But I can't boot. After I give the passphrase it decrypt the root and continue but then I have the following error messasges :

 mounting /sysroot ...
[FAILED] Failed to mount /sysroot
See 'systemctl status sysroot.mount' for details
[DEPEND] Dependency failed for Initrd Root File Systems
[DEPEND] Dependency failed for Reload Configuration from the Real Root

Then it goes in emergency mode and I have one more error message:

Cannot open access to console, the root account is locked.
See sulogin(8)  man page for more details

Press enter to continue

But pressing enter does nothing but come back to "Press enter to continue".

Is there something wrong with the boot entry ? The only difference between my regular boot entry is only the subvolume.
Note that the /boot that contains the initrd and vmllinuz is on the efi partition but were the same that were uses at the snapshot time.

Can the fact that the /boot is not on the same drive could bring this problem ???
I'm just trying to understand why this happens...

Any hints are appreciated,

      Regards,
                   BT
System:    Kernel: 5.15.5-zen1-1-zen x86_64 bits: 64 compiler: gcc v: 11.1.0
parameters: initrd=\amd-ucode.img initrd=\initramfs-linux-zen.img
rd.luks.name=86691f1a-15a7-4cc6-823e-08eab8fb14b4=luks-86691f1a-15a7-4cc6-823e-08eab8fb14b4
root=/dev/mapper/luks-86691f1a-15a7-4cc6-823e-08eab8fb14b4 rootflags=subvol=@ rd.luks.options=discard rw
Console: pty pts/2 wm: kwin_x11 DM: SDDM Distro: Garuda Linux base: Arch Linux
Machine:   Type: Laptop System: ASUSTeK product: VivoBook_ASUSLaptop X513UA_M513UA v: 1.0 serial: <filter>
Mobo: ASUSTeK model: X513UA v: 1.0 serial: <filter> UEFI: American Megatrends LLC. v: X513UA.305 date: 03/12/2021
Battery:   ID-1: BAT0 charge: 41.1 Wh (100.0%) condition: 41.1/42.1 Wh (97.8%) volts: 11.8 min: 11.8
model: ASUSTeK ASUS Battery type: Li-ion serial: N/A status: Not charging cycles: 4
Device-1: hidpp_battery_0 model: Logitech Wireless Mouse M325 serial: <filter> charge: 100% (should be ignored)
rechargeable: yes status: Discharging
CPU:       Info: 8-Core model: AMD Ryzen 7 5700U with Radeon Graphics socket: FP6 bits: 64 type: MT MCP arch: Zen 2
family: 17 (23) model-id: 68 (104) stepping: 1 microcode: 8608103 cache: L1: 512 KiB L2: 4 MiB L3: 8 MiB
flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 57489
Speed: 3825 MHz min/max: 1400/1800 MHz base/boost: 1800/4350 boost: enabled volts: 1.2 V ext-clock: 100 MHz
Core speeds (MHz): 1: 3825 2: 2251 3: 2513 4: 3362 5: 3742 6: 3022 7: 4131 8: 3956 9: 2567 10: 3932 11: 3867
12: 2787 13: 2910 14: 1928 15: 2426 16: 4076
Vulnerabilities: Type: itlb_multihit status: Not affected
Type: l1tf status: Not affected
Type: mds status: Not affected
Type: meltdown status: Not affected
Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl
Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization
Type: spectre_v2 mitigation: Full AMD retpoline, IBPB: conditional, IBRS_FW, STIBP: conditional, RSB filling
Type: srbds status: Not affected
Type: tsx_async_abort status: Not affected
Graphics:  Device-1: Advanced Micro Devices [AMD/ATI] Lucienne vendor: ASUSTeK driver: amdgpu v: kernel bus-ID: 03:00.0
chip-ID: 1002:164c class-ID: 0300
Device-2: Quanta USB2.0 HD UVC WebCam type: USB driver: uvcvideo bus-ID: 3-3:3 chip-ID: 0408:30d4 class-ID: 0e02
serial: <filter>
Display: server: X.Org 1.21.1.1 compositor: kwin_x11 driver: loaded: amdgpu,ati unloaded: modesetting
alternate: fbdev,vesa display-ID: :0 screens: 1
Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.0x11.2") s-diag: 582mm (22.9")
Monitor-1: eDP res: 1920x1080 hz: 60 dpi: 142 size: 344x194mm (13.5x7.6") diag: 395mm (15.5")
Message: Unable to show advanced data. Required tool glxinfo missing.
Audio:     Device-1: Advanced Micro Devices [AMD/ATI] driver: snd_hda_intel v: kernel bus-ID: 03:00.1 chip-ID: 1002:1637
class-ID: 0403
Device-2: Advanced Micro Devices [AMD] Raven/Raven2/FireFlight/Renoir Audio Processor vendor: ASUSTeK driver: N/A
alternate: snd_pci_acp3x, snd_rn_pci_acp3x, snd_pci_acp5x bus-ID: 03:00.5 chip-ID: 1022:15e2 class-ID: 0480
Device-3: Advanced Micro Devices [AMD] Family 17h HD Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel
bus-ID: 03:00.6 chip-ID: 1022:15e3 class-ID: 0403
Sound Server-1: ALSA v: k5.15.5-zen1-1-zen running: yes
Sound Server-2: JACK v: 1.9.19 running: no
Sound Server-3: PulseAudio v: 15.0 running: no
Sound Server-4: PipeWire v: 0.3.40 running: yes
Network:   Device-1: Intel Wi-Fi 6 AX200 driver: iwlwifi v: kernel bus-ID: 01:00.0 chip-ID: 8086:2723 class-ID: 0280
IF: wlp1s0 state: up mac: <filter>
Bluetooth: Device-1: Intel AX200 Bluetooth type: USB driver: btusb v: 0.8 bus-ID: 3-2:2 chip-ID: 8087:0029 class-ID: e001
Report: bt-adapter ID: hci0 rfk-id: 2 state: up address: <filter>
Drives:    Local Storage: total: 953.87 GiB used: 314.21 GiB (32.9%)
ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Western Digital model: PC SN530 SDBPNPZ-1T00-1002 size: 953.87 GiB
block-size: physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter> rev: 21106000
temp: 45.9 C scheme: GPT
SMART: yes health: PASSED on: 8d 23h cycles: 257 read-units: 18,913,545 [9.68 TB]
written-units: 8,609,199 [4.40 TB]
Partition: ID-1: / raw-size: 937.07 GiB size: 937.07 GiB (100.00%) used: 314.09 GiB (33.5%) fs: btrfs block-size: 4096 B
dev: /dev/dm-0 maj-min: 254:0 mapped: luks-86691f1a-15a7-4cc6-823e-08eab8fb14b4
ID-2: /boot raw-size: 260 MiB size: 256 MiB (98.46%) used: 118.9 MiB (46.5%) fs: vfat block-size: 512 B
dev: /dev/nvme0n1p1 maj-min: 259:1
ID-3: /home raw-size: 937.07 GiB size: 937.07 GiB (100.00%) used: 314.09 GiB (33.5%) fs: btrfs block-size: 4096 B
dev: /dev/dm-0 maj-min: 254:0 mapped: luks-86691f1a-15a7-4cc6-823e-08eab8fb14b4
ID-4: /var/log raw-size: 937.07 GiB size: 937.07 GiB (100.00%) used: 314.09 GiB (33.5%) fs: btrfs
block-size: 4096 B dev: /dev/dm-0 maj-min: 254:0 mapped: luks-86691f1a-15a7-4cc6-823e-08eab8fb14b4
ID-5: /var/tmp raw-size: 937.07 GiB size: 937.07 GiB (100.00%) used: 314.09 GiB (33.5%) fs: btrfs
block-size: 4096 B dev: /dev/dm-0 maj-min: 254:0 mapped: luks-86691f1a-15a7-4cc6-823e-08eab8fb14b4
Swap:      Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
ID-1: swap-1 type: zram size: 15.1 GiB used: 4.17 GiB (27.6%) priority: 100 dev: /dev/zram0
ID-2: swap-2 type: partition size: 16.54 GiB used: 0 KiB (0.0%) priority: -2 dev: /dev/dm-1 maj-min: 254:1
mapped: luks-1436414a-f251-47a7-bf5f-6ba83c40e119
Sensors:   System Temperatures: cpu: 72.0 C mobo: N/A gpu: amdgpu temp: 56.0 C
Fan Speeds (RPM): cpu: 3200
Info:      Processes: 390 Uptime: 14m wakeups: 10 Memory: 15.1 GiB used: 5.38 GiB (35.6%) Init: systemd v: 249 tool: systemctl
Compilers: gcc: 11.1.0 clang: 13.0.0 Packages: pacman: 1647 lib: 381 Shell: Bash (su) v: 5.1.12 running-in: konsole
inxi: 3.3.09

Does snapper’s setup work with systemd-boot?

It does take snapshots. But does not update the systemd-boot menu.
So I'm trying to find a way to do it eventually with a script that could be a pacman hook.

But for now, I'm unable to boot from a snapshot.

This might be relevant:

1 Like

This is probably wrong. It is probably:

rootflags=subvol=@/.snapshots/81/snapshot

.snapshots is a nested subvolume if you are using the default garuda layout.

4 Likes

True, I forgot I was listing the subvolume from @ and that it was effectively a sub-subvolume.

I'm trying it now and be back to confirm results.

Yes! Thanks a lot this was the problem. The snapshot subvolume is @/.snapshots/81/snapshot .
It does boot on the snapshot with sddm complaining about its config beeing not writable.
That's normal since the snapshots are all read-only snapshots. We have to change it to a writable snapshot if you want to go use it permanently. The snapper docs is clear about that.

Thanks, i have to design the script now to generate a boot loader entries from the snapper info.

I will post results eventually for everyone that want to use systemd-boot with snapper.

Regards,
BT

You probably shouldn’t do that. Keep in mind the snapper docs are suse-specific.

Instead of making it read-write and using it permanently, you should restore it. Otherwise, you will have other issues.

2 Likes

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