Skip to content

Conversation

PapiJalopy
Copy link

@PapiJalopy PapiJalopy commented Jul 8, 2025

Two hard failures prevented 41-snapshots-btrfs from generating a snapshot submenu when the root LUKS header is detached and cryptdevice= uses a /dev/disk/by-id path:

  • grub-probe --target=fs_uuid aborted on detached headers.
  • grep-based extraction of UUID from GRUB_CMDLINE_LINUX_DEFAULT failed when cryptdevice= did not contain “UUID=…”.

This patch:

  1. Wraps grub-probe in a try/blkid/lsblk cascade that always returns the filesystem UUID or prints a clear error.

  2. Replaces the fixed “cryptomount -u $(grep …UUID=…)” line with logic that:
    • accepts both UUID=… and /dev/disk/by-id/… syntaxes,
    • resolves paths to a canonical UUID with blkid,
    • emits ‘cryptomount -u ’ when possible,
    • falls back to ‘cryptomount -a’ only if no UUID can be extracted.

  3. Keeps the previous behavior unchanged for unencrypted systems or for installations that already worked.

Result: snapshot menu is produced and boots correctly on standard (setup with inline header), detached-header, and by-id configurations; no regression for existing users.

Please read Issue #377

Two hard failures prevented 41-snapshots-btrfs from generating a
snapshot submenu when the root LUKS header is detached and cryptdevice=
uses a /dev/disk/by-id path:

* grub-probe --target=fs_uuid aborted on detached headers.
* grep-based extraction of UUID from GRUB_CMDLINE_LINUX_DEFAULT failed
  when cryptdevice= did not contain “UUID=…”.

This patch:

1. Wraps grub-probe in a try/blkid/lsblk cascade that always returns the
   filesystem UUID or prints a clear error.
2. Replaces the fixed “cryptomount -u $(grep …UUID=…)” line with logic
   that:
   • accepts both UUID=… and /dev/disk/by-id/… syntaxes,
   • resolves paths to a canonical UUID with blkid,
   • emits ‘cryptomount -u <uuid>’ when possible,
   • falls back to ‘cryptomount -a’ only if no UUID can be extracted.
3. Keeps the previous behavior unchanged for unencrypted systems or for
   installations that already worked.

Result: snapshot menu is produced and boots correctly on standard
(setup with inline header), detached-header, and by-id configurations;
no regression for existing users.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant