From 32b08224b2cca54eddc702b50b07b035fb74ffdd Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Tue, 16 Dec 2025 12:53:18 +0100 Subject: [PATCH] crypto: Show better error when crypt_activate returns ETXTBSY This error code is used when the LUKS2 device requires some features not supported by the used version of cryptsetup, e.g. when trying to open a device created with a newer version. The "Text file busy" error message return by strerror is not very usefull in this case. Fixes: #1148 --- src/plugins/crypto.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/crypto.c b/src/plugins/crypto.c index d5c9b64c..dea99645 100644 --- a/src/plugins/crypto.c +++ b/src/plugins/crypto.c @@ -1358,6 +1358,9 @@ gboolean bd_crypto_luks_open_flags (const gchar *device, const gchar *name, BDCr if (ret == -EPERM) g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, "Failed to activate device: Incorrect passphrase."); + else if (ret == -ETXTBSY) + g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, + "Failed to activate device: Unknown or unsupported LUKS2 requirements detected."); else g_set_error (&l_error, BD_CRYPTO_ERROR, BD_CRYPTO_ERROR_DEVICE, "Failed to activate device: %s", strerror_l (-ret, c_locale));