Commit 6c8be38
committed
[vm-repair] Fix unlock failure on Ubuntu 24.04 ADE-encrypted VMs
The root partition detection in data_os_lvm_check uses a 600MB size
threshold to filter partitions. Ubuntu 24.04 has a ~913MB /boot
partition (partition 16) that also exceeds this threshold, causing
root_part to capture two partitions instead of one.
This results in cryptsetup receiving an invalid device name argument:
cryptsetup luksOpen ... /dev/sdb1 /dev/sdb16 osencrypt
instead of:
cryptsetup luksOpen ... /dev/sdb1 osencrypt
The error manifests as:
Device sdb16 not found
Cannot use device /dev/sdb16, name is invalid or still in use.
Fix: Replace the fixed-threshold filter with a sort-by-size approach
that selects only the largest partition (which is always the root
partition). This is future-proof against /boot partition size changes.
Additional improvements per review feedback:
- Use $() instead of backticks for command substitution
- Redirect stderr to logfile instead of capturing into the variable
- Quote variables to prevent word-splitting issues
- Separate export from assignment for clarity
Tested on Ubuntu 24.04 Gen 1 and Gen 2 with ADE encryption - unlock
now succeeds. Also verified no regression on Ubuntu 20.04 and 22.04.1 parent 52f11e4 commit 6c8be38
1 file changed
Lines changed: 5 additions & 1 deletion
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
99 | 103 | | |
100 | 104 | | |
101 | 105 | | |
| |||
0 commit comments