I'm using Arch Linux and setting up an USB-Stick as decryption key for my luks-encrypted root partition (boot is unencrypted). I described it already in this question.
Now, the key, that's used for dm-crypt is actually stored before the first partition on the stick, created this way:
sudo dd if=tempKey.bin of=/dev/sdd bs=512 seek=1 count=6
thus, 3072 are written into sector 1..6 (zero indexed). When I use the following kernel parameter in grub.cfg
it works:
cryptkey=/dev/sdd:512:3072
But I cannot rely on that stick always being mapped to sdd, thatswhy even Arch-Wiki recommends using the disks ID, namely:
cryptkey=/dev/disk/by-id/$ID_OF_USB_STICK$:512:3072
BUT: USB-Sticks are getting IDs that contain colons and so the device is not found on boot, even if I try to escape the colon with a backslash. The system always seems to look for the ID before the colon.
Using cryptkey=UUID=...
would only work, if I use space/sector inside a partition, not before or between.
So, I'm really stuck here. Someone any suggestions, how to solve this without rely on sdX and the possibility to accidentally overwrite/delete the key by putting it inside a partition? Would it be an option to manipulate rules.d
of udev
to change the way the IDs(and symlinks) for USB-Sticks are created?