CRYPTSETUP-LUKSCONVERTKEY(8)

๐Ÿ’– CRYPTSETUP-LUKSCONVERTKEY ๐Ÿ’–

okay so bestie, welcome to the cryptsetup-luksConvertKey page, straight outta the Maintenance Commands corner of the manual (section 8, for the girlies keeping track ๐Ÿ’…). grab a strawberry drink and let's get into it, because this one is lowkey a lot and I am not skipping a single thing. ๐Ÿ“


๐ŸŒธ NAME ๐ŸŒธ

cryptsetup-luksConvertKey โ€” the icon that converts an existing LUKS2 keyslot to new PBKDF parameters. that's the whole job. periodt. โœจ


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

cryptsetup luksConvertKey [<options>] <device>

๐Ÿ‘‘ DESCRIPTION ๐Ÿ‘‘

So what this does is convert an existing LUKS2 keyslot to new PBKDF parameters. the passphrase for the keyslot you're converting must be supplied interactively, or you can hand it over via --key-file. and if you don't specify any --pbkdf parameters, then the LUKS2 default PBKDF values just apply, no biggie. โœจ

Now listen, here's where it gets a lil โœจspecificโœจ. if a keyslot is specified (via --key-slot), then you have to give the passphrase for that keyslot. but if no keyslot is specified and there's still a free keyslot hanging around, then the new parameters get put into a free keyslot first, before the keyslot holding the old parameters gets purged. and if there is no free keyslot at all? then the keyslot with the old parameters is directly overwritten. yes, directly. ๐Ÿ’€

WARNING: if a keyslot gets overwritten, a media failure during this operation can cause the overwrite to fail after the old parameters have been wiped, which makes the LUKS container inaccessible. so likeโ€ฆ be careful bestie, fr fr. ๐Ÿ˜ญ

And <options> can be [--key-file, --keyfile-offset, --keyfile-size, --key-slot, --hash, --header, --disable-locks, --iter-time, --pbkdf, --pbkdf-force-iterations, --pbkdf-memory, --pbkdf-parallel, --keyslot-cipher, --keyslot-key-size, --timeout, --verify-passphrase].


โœจ OPTIONS โœจ

okay here comes the big list, and I mean the whole list, no skipping. ๐Ÿซถ

  • --batch-mode, -q โ€” suppresses all confirmation questions. use with care, bestie! if the --verify-passphrase option is not specified, this option also switches off the passphrase verification. ๐Ÿšซ
  • --debug or --debug-json โ€” run in debug mode with full diagnostic logs. debug output lines are always prefixed by #. if --debug-json is used, additional LUKS2 JSON data structures get printed too. ๐Ÿ”
  • --disable-locks โ€” disable lock protection for metadata on disk. this option is valid only for LUKS2 and is ignored for other formats.
WARNING: do not use this option unless you run cryptsetup in a restricted environment where locking is impossible to perform (where the /run directory cannot be used).
  • --force-password โ€” do not use password quality checking for new LUKS passwords. this option is ignored if cryptsetup is built without password quality checking support. for more info about password quality check, see the manual page for pwquality.conf(5) and passwdqc.conf(5). ๐Ÿ’ช
  • --hash, -h <hash-spec> โ€” the specified hash is used for PBKDF2 and the AF splitter.
  • --header <device or file storing the LUKS header> โ€” use a detached (separated) metadata device or file where the LUKS header is stored. this option allows one to store the ciphertext and LUKS header on different devices. for commands that change the LUKS header (e.g., luksAddKey), specify the device or file with the LUKS header directly as the LUKS device. ๐Ÿ—‚๏ธ
  • --help, -? โ€” show help text and default parameters.
  • --iter-time, -i <number of milliseconds> โ€” the number of milliseconds to spend with PBKDF passphrase processing. specifying 0 as a parameter selects the compiled-in default. โฑ๏ธ
  • --key-file, -d file โ€” read the passphrase from the file. if the name given is -, then the passphrase will be read from stdin. in this case, reading will not stop at newline characters. see section NOTES ON PASSPHRASE PROCESSING in cryptsetup(8) for more information. ๐Ÿ“„
  • --keyfile-offset value โ€” skip value bytes at the beginning of the key file.
  • --keyfile-size, -l value โ€” read a maximum of value bytes from the key file. the default is to read the whole file up to the compiled-in maximum that can be queried with --help. supplying more data than the compiled-in maximum aborts the operation. this option is useful to cut trailing newlines, for example. if --keyfile-offset is also given, the size count starts after the offset. โœ‚๏ธ
  • --key-slot, -S <0-N> โ€” for LUKS operations that add key material, this option allows you to specify which keyslot is selected for the new key. the maximum number of keyslots depends on the LUKS version. LUKS1 can have up to 8 keyslots. LUKS2 can have up to 32 keyslots based on keyslot area size and key size, but a valid keyslot ID can always be between 0 and 31 for LUKS2. ๐Ÿ”ข
  • --keyslot-cipher <cipher-spec> โ€” this option can be used to set specific cipher encryption for the LUKS2 keyslot area.
  • --keyslot-key-size <bits> โ€” this option can be used to set a specific key size for the LUKS2 keyslot area.
  • --new-keyfile-offset value โ€” skip value bytes at the start when adding a new passphrase from the key file.
  • --new-keyfile-size value โ€” read a maximum of value bytes when adding a new passphrase from the key file. the default is to read the whole file up to the compiled-in maximum length that can be queried with --help. supplying more than the compiled-in maximum aborts the operation. when --new-keyfile-offset is also given, reading starts after the offset. ๐Ÿ“
  • --pbkdf <PBKDF spec> โ€” set Password-Based Key Derivation Function (PBKDF) algorithm for LUKS keyslot. the PBKDF can be: pbkdf2 (for PBKDF2 according to RFC2898), argon2i for Argon2i, or argon2id for Argon2id (see Argon2 <https://www.cryptolux.org/index.php/Argon2> for more info). for LUKS1, only PBKDF2 is accepted (no need to use this option). the default PBKDF for LUKS2 is set during compilation time and is available in the cryptsetup --help output. a PBKDF is used for increasing the dictionary and brute-force attack cost for keyslot passwords. the parameters can be time, memory and parallel cost. for PBKDF2, only the time cost (number of iterations) applies. for Argon2i/id, there is also memory cost (memory required during the process of key derivation) and parallel cost (number of threads that run in parallel during the key derivation. note that increasing memory cost also increases time, so the final parameter values are measured by a benchmark. the benchmark tries to find iteration time (--iter-time) with required memory cost --pbkdf-memory. if it is not possible, the memory cost is decreased as well. the parallel cost --pbkdf-parallel is constant and is checked against available CPU cores. you can see all PBKDF parameters for a particular LUKS2 keyslot with the cryptsetup-luksDump(8) command. if you do not want to use benchmark and want to specify all parameters directly, use --pbkdf-force-iterations with --pbkdf-memory and --pbkdf-parallel. this will override the values without benchmarking. note it can cause extremely long unlocking time or cause out-of-memory conditions with unconditional process termination. use only in specific cases, for example, if you know that the formatted device will be used on some small embedded system. ๐Ÿ’€ MINIMAL AND MAXIMAL PBKDF COSTS: for PBKDF2, the minimum iteration count is 1000 and the maximum is 4294967295 (maximum for 32-bit unsigned integer). memory and parallel costs are not supported for PBKDF2. for Argon2i and Argon2id, the minimum iteration count (CPU cost) is 4, and the maximum is 4294967295 (maximum for a 32-bit unsigned integer). minimum memory cost is 32 KiB and maximum is 4 GiB. if the memory cost parameter is benchmarked (not specified by a parameter), it is always in the range from 64 MiB to 1 GiB. memory cost above 1GiB (up to the 4GiB maximum) can be setup only by the --pbkdf-memory parameter. the parallel cost minimum is 1 and maximum 4 (if enough CPU cores are available, otherwise it is decreased by the available CPU cores). ๐Ÿงฎ
WARNING: increasing PBKDF computational costs above the mentioned limits provides negligible additional security improvement. while elevated costs significantly increase brute-force overhead, they offer negligible protection against dictionary attacks. the marginal cost increase for processing an entire dictionary remains fundamentally insufficient.

the hardcoded PBKDF limits represent engineered trade-offs between cryptographic security and operational usability. LUKS maintains portability and must be used within a reasonable time on resource-constrained systems. cryptsetup deliberately restricts maximum memory cost (4 GiB) and parallel cost (4) parameters due to architectural limitations (like embedded and legacy systems). PBKDF memory cost mandates actual physical RAM allocation with intensive write operations that must remain in physical RAM. any swap usage results in unacceptable performance degradation. memory management often overcommits allocations beyond available physical memory, expecting most allocated memory to remain unused. in such situations, as PBKDF always uses all allocated memory, it frequently causes out-of-memory failures that abort cryptsetup operations. ๐Ÿ˜ญ

  • --pbkdf-force-iterations number โ€” avoid the PBKDF benchmark and set the time cost (iterations) directly. it can be used only for a LUKS/LUKS2 device. see --pbkdf option for more info.
  • --pbkdf-memory number โ€” set the memory cost for PBKDF (for Argon2i/id, the number represents kilobytes). note that it is the maximal value; PBKDF benchmark or available physical memory can decrease it. this option is not available for PBKDF2. ๐Ÿง 
  • --pbkdf-parallel number โ€” set the parallel cost for PBKDF (number of threads, up to 4). note that it is the maximal value; it is decreased automatically if the CPU online count is lower. this option is not available for PBKDF2. โšก
  • --timeout, -t seconds โ€” the number of seconds to wait before a timeout on passphrase input via terminal. it is relevant every time a passphrase is asked. it has no effect if used in conjunction with --key-file. this option is useful when the system should not stall if the user does not input a passphrase, e.g., during boot. the default is a value of 0 seconds, which means to wait forever. โณ
  • --usage โ€” show short option help.
  • --verify-passphrase, -y โ€” when interactively asking for a passphrase, ask for it twice and complain if both inputs do not match. ignored on input from file or stdin. โœ…
  • --version, -V โ€” show the program version.

๐Ÿ› REPORTING BUGS ๐Ÿ›

found a bug? (not the cute kind ๐Ÿฆ‹) report it at the cryptsetup mailing list <cryptsetup@lists.linux.dev> or in the Issues project section <https://gitlab.com/cryptsetup/cryptsetup/-/issues/new>.

and please, bestie, attach the output of the failed command with --debug option added. it helps so much, tysm. ๐Ÿซถ



โœจ SEE ALSO โœจ

okay bestie, when you're done converting keys and you're like "wait, I have follow-up questions" ๐Ÿ˜ญ โ€” here's where to go next:


๐Ÿ‘‘ CRYPTSETUP ๐Ÿ‘‘

This one is part of cryptsetup project โ€” so yes, it's in the family, it's got the genetics, it belongs: <https://gitlab.com/cryptsetup/cryptsetup/> ๐Ÿฆ‹


and that's a wrap on CRYPTSETUP-LUKSCONVERTKEY(8), bestie!! you read the whole thing, you understood the whole thing, you're literally the moment ๐Ÿ’…โœจ

this page came from cryptsetup 2.8.8 and it's dated 2026-09-07 ๐ŸŽ€

now go convert those keys and be iconic about it. i'm so proud of you. periodt. ๐Ÿซถ๐ŸŒธ

๐Ÿ“ฆ where this page comes from