Converting Persistent Storage to LUKS2 fails: Unable to move keyslot area. Not enough space
In wb:14246675cae2535c02336a69aec237b4:
Nov 01 10:52:49 amnesia tpsd[6180]: INFO:device.py:432: [1] Executing command cryptsetup status TailsData
Nov 01 10:52:49 amnesia tpsd[6598]: /dev/mapper/TailsData is active and is in use.
Nov 01 10:52:49 amnesia tpsd[6598]: type: LUKS1
Nov 01 10:52:49 amnesia tpsd[6598]: cipher: aes-cbc-essiv:sha256
Nov 01 10:52:49 amnesia tpsd[6598]: keysize: 256 bits
Nov 01 10:52:49 amnesia tpsd[6598]: key location: dm-crypt
Nov 01 10:52:49 amnesia tpsd[6598]: device: /dev/sdf2
Nov 01 10:52:49 amnesia tpsd[6598]: sector size: 512
Nov 01 10:52:49 amnesia tpsd[6598]: offset: 2056 sectors
Nov 01 10:52:49 amnesia tpsd[6598]: size: 10508280 sectors
Nov 01 10:52:49 amnesia tpsd[6598]: mode: read/write
Nov 01 10:52:49 amnesia tpsd[6180]: DEBUG:device.py:432: [1] Done executing command
Nov 01 10:52:49 amnesia tpsd[6180]: INFO:device.py:437: [1] Executing command cryptsetup close TailsData
Nov 01 10:52:49 amnesia tpsd[6180]: DEBUG:device.py:437: [1] Done executing command
Nov 01 10:52:49 amnesia tpsd[6180]: INFO:device.py:472: [1] Executing command cryptsetup convert --debug --type luks2 --batch-mode /dev/sdf2
Nov 01 10:52:49 amnesia tpsd[6641]: # cryptsetup 2.6.1 processing "cryptsetup convert --debug --type luks2 --batch-mode /dev/sdf2"
Nov 01 10:52:49 amnesia tpsd[6641]: # Verifying parameters for command convert.
Nov 01 10:52:49 amnesia tpsd[6641]: # Running command convert.
Nov 01 10:52:49 amnesia tpsd[6641]: # Installing SIGINT/SIGTERM handler.
Nov 01 10:52:49 amnesia tpsd[6641]: # Unblocking interruption on signal.
Nov 01 10:52:49 amnesia tpsd[6641]: # Allocating context for crypt device /dev/sdf2.
Nov 01 10:52:49 amnesia tpsd[6641]: # Trying to open and read device /dev/sdf2 with direct-io.
Nov 01 10:52:49 amnesia tpsd[6641]: # Initialising device-mapper backend library.
Nov 01 10:52:49 amnesia tpsd[6641]: # Trying to load any crypt type from device /dev/sdf2.
Nov 01 10:52:49 amnesia tpsd[6641]: # Crypto backend (OpenSSL 1.1.1w 11 Sep 2023) initialized in cryptsetup library version 2.6.1.
Nov 01 10:52:49 amnesia tpsd[6641]: # Detected kernel Linux 6.1.0-13-amd64 x86_64.
Nov 01 10:52:49 amnesia tpsd[6641]: # PBKDF pbkdf2-sha256, time_ms 2000 (iterations 0).
Nov 01 10:52:49 amnesia tpsd[6641]: # Reading LUKS header of size 1024 from device /dev/sdf2
Nov 01 10:52:49 amnesia tpsd[6641]: # Key length 32, device size 10510336 sectors, header size 2050 sectors.
Nov 01 10:52:49 amnesia tpsd[6641]: # Converting LUKS device to type LUKS2
Nov 01 10:52:49 amnesia tpsd[6641]: # Checking if cipher aes-cbc-essiv:sha256 is usable (storage wrapper).
Nov 01 10:52:49 amnesia tpsd[6641]: # Reusing open ro fd on device /dev/sdf2
Nov 01 10:52:49 amnesia tpsd[6641]: # Max size: 1052672, LUKS1 (full) header size 1052672 , required shift: 28672
Nov 01 10:52:49 amnesia tpsd[6641]: # Releasing crypt device /dev/sdf2 context.
Nov 01 10:52:49 amnesia tpsd[6641]: # Releasing device-mapper backend.
Nov 01 10:52:49 amnesia tpsd[6641]: # Closing read only fd for /dev/sdf2.
Nov 01 10:52:49 amnesia tpsd[6641]: Command failed with code -1 (wrong or missing parameters).
Nov 01 10:52:49 amnesia tpsd[6180]: Unable to move keyslot area. Not enough space.
Nov 01 10:52:49 amnesia tpsd[6180]: DEBUG:device.py:472: [1] Done executing command
Nov 01 10:52:49 amnesia tpsd[6180]: INFO:service.py:769: [1] Executing command mount -o remount,ro /lib/live/mount/medium
Nov 01 10:52:50 amnesia tpsd[6180]: DEBUG:service.py:769: [1] Done executing command
Nov 01 10:52:50 amnesia tpsd[6180]: DEBUG:device.py:177: [1] Calling is_upgraded()
Nov 01 10:52:50 amnesia tpsd[6180]: INFO:device.py:179: [1] Executing command cryptsetup luksDump --dump-json-metadata /dev/sdf2
Nov 01 10:52:50 amnesia tpsd[6180]: Dump operation is not supported for this device type.
Nov 01 10:52:50 amnesia tpsd[6180]: DEBUG:device.py:179: [1] Done executing command
Nov 01 10:52:50 amnesia tpsd[6180]: DEBUG:device.py:187: [1] Command 'cryptsetup luksDump' failed: dump operation was not supported for the device which implies it uses LUKS version 1
Nov 01 10:52:50 amnesia tpsd[6180]: ERROR:object.py:193: [1] Command '['cryptsetup', 'convert', '--debug', '--type', 'luks2', '--batch-mode', '/dev/sdf2']' returned non-zero exit status 1.
The error triggers in https://gitlab.com/cryptsetup/cryptsetup/-/blob/v2.6.1/lib/luks2/luks2_luks1_convert.c#L584 At first glance it looks like the LUKS1 device was created in a way that there's no space available between itself and the beginning of the data.
The same failure mode also happened in wb:f02b4d50934a111b1150ad1c5b75718f, but there the user has 3 partitions on their USB stick, with the Persistent Storage being the 3rd one, in case that matters.
Edited by intrigeri