From 19024b2a1e6b96730ea54a4a8725c0e9b748e815 Mon Sep 17 00:00:00 2001 From: Mauro Morales Date: Wed, 17 Sep 2025 16:28:34 +0200 Subject: [PATCH] cryptsetup v2.8 does not allow slashes (#623) * cryptsetup v2.8 does not allow slashes Signed-off-by: Mauro Morales * add comment Signed-off-by: Mauro Morales --------- Signed-off-by: Mauro Morales --- kcrypt/lock.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kcrypt/lock.go b/kcrypt/lock.go index 7c70040..d4f686c 100644 --- a/kcrypt/lock.go +++ b/kcrypt/lock.go @@ -221,7 +221,9 @@ func formatLuks(device, name, mapper, label, pass string, logger types.KairosLog // Refresh needs the password as its doing actions on the device directly l.Debug().Msg("discards") - cmd := exec.Command("cryptsetup", "refresh", "--persistent", "--allow-discards", mapper) + // Note: cryptsetup v2.8+ expects the device name (not the device path) for the 'refresh' command. + // Using 'name' with v2.7 also works, hence why no fallback is needed for backward compatibility. + cmd := exec.Command("cryptsetup", "refresh", "--persistent", "--allow-discards", name) cmd.Stdin = strings.NewReader(pass) output, err := cmd.CombinedOutput()