
Creating the key file comes first, it must exist before you create the LUKS container, because you need to tell cryptsetup luksFormat about it.L1NTHALO wrote:1. I want to create a detached header on an USB drive with which to encrypt the disk. I've created that header but if I now create a key file for that disk, it says it isn't encrypted (/dev/nvme0n1p1 is not a valid LUKS device).
After you create the LUKS container, you must open it with cryptsetup open and create a filesystem. That's section 6 of the Wiki article.L1NTHALO wrote:2. The wiki says to create all your headers, key files etc but then after that you should format your disks? What am I missing?
No, the Wiki article talks about an EFI System Partition (ESP), so it assumes a UEFI installation. The Extended Boot Partition is mounted at /boot and holds kernel, initramfs and GRUB stuff (including its configuration file). I suppose that the article chose that partition layout to make it easier to do the installation of GRUB, kernel and initramfs according to the Handbook.L1NTHALO wrote:3. What do I need an Extended Boot Partition for? Is it only for MBR? Will putting the detached header, key files, initramfs and kernel image on the EFI drive work with grub?
You could in theory, but if you are using a separate initramfs, you rely heavily on the UEFI firmware's ability to correctly handle Boot#### variables and pass an initrd= kernel parameter to the EFI stub.L1NTHALO wrote:4. Do I need GRUB or can you also do the whole process with EFISTUB?
Ionen wrote:As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though
I would not share a key file, you can have a separate one and possibly store it on the rootfs, where it's used later. If you use the dm-crypt service, it can setup a swap partition with a random key at every boot. This is nice if you don't plan to hibernate.L1NTHALO wrote:Want to encrypt the whole drive and store the kernel and initramfs on a seperate unencrypted USB drive.
I've got it mostly working now but I'm not sure if I set it up correctly for a swap partition.
Currently I have an encrypted root partition and encrypted swap partition, both with seperate headers and one shared key file on the usb stick. Is that how you would do it?
If you hibernate, you technically only need to decrypt the swap, and then that restores RAM and whatnot and the root is already mounted.L1NTHALO wrote:I do plan to hibernate so unfortunately that's not an option. How would your suggestion work? If I hibernate does both the rootfs and swap partition get encrypted and I decrypt rootfs and then swap?
You could start a new thread, open an issue, ask in the discord, or ask in the irc. If you're running it directly, it reads kmods from the current running kernel version, sometimes this causes issues and another kernel version can be specified with --kver, you can read possible kernels from /usr/lib/modulesL1NTHALO wrote:Hey, since you're an ugRD dev, when doing make install I get an ugRD error that I miss the kernel module uas.
Not exactly sure what that module is, the nearest module I found was USB_UAS which I enabled.
Was planning on doing a new thread, but maybe you've got an idea?
I think dracut should currently support this, you're welcome to try that PR/truffle0's branch as well. The way it is implemented seems fine, but I'm not sure if it's worth taking extra measures to absolutely ensure nothing is written. AFAICT dracut and other systems do not take any extra measures, so I don't think it is as much of a risk as the kernel docs suggest.L1NTHALO wrote:Thanks! If I'd still like to use hibernate, would using dracut be more beneficial?
Also if only the swap gets encrypted during hibernate, can't you tamper with the unencrypted rootfs and either get the data from there or get the key for the encrypted swap?
You seem fine up through here.L1NTHALO wrote:Right now I have 2 partitions on my nvme: root and swap. I'm gonna encrypt both of them and I'll have /dev/mapper/root and /dev/mapper/swap.
I'm gonna store the detached header of rootfs on my USB drive, the header of swap on the rootfs.
The rootfs key file will be stored on my usb, the swap key file on the rootfs.
I'll have my kernel, initramfs etc on my USB drive so I need it to boot. In practice I'm gonna start my laptop with the USB drive.
No, you risk corrupting your root filesystem if you try that. If the root filesystem was mounted when the system entered hibernate, then you must do one of two things at next power-on:L1NTHALO wrote:When resuming from hibernation, I'm gonna decrypt rootfs with the key file on the USB drive to get to the swap header and key file, and then decrypt swap?
That depends on how the initramfs chooses to prompt you for the password. Booting to a terminal is fairly common.L1NTHALO wrote:Is it gonna work like that and if it does how does the decryption process look? Say I'm booting from the kernel on my usb stick, do I get a tty to type the luksOpen command?
You could choose that, but then you need to think carefully about where important content can go. If you have an unencrypted swap, your applications might spill sensitive data into swap. The same concern applies if /tmp is a disk-backed filesystem outside the encrypted container.L1NTHALO wrote:Maybe I'm way in over my head. An easier alternative would be to just encrypt my "important" partitions such as /home right?
To avoid overcomplicating things, the current FDE/rootfs guides don't use LVM. The guides focus on the LUKS portions, such formatting, detaching the header, opening, etc.L1NTHALO wrote: Also after I've done this, I plan to update the wiki entry to make it a bit easier to follow. I had to use the arch wiki extensively for dracut + LVM + detached headers. Should I edit the main wiki entry directly or create on of these user guides?