this post was submitted on 19 Mar 2025
31 points (97.0% liked)
Linux
52158 readers
1272 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Well thanks everyone. I finally managed to get it to work on Arch. System has separate encrypted root and swap in LVM, and a separate encrypted home. It can suspend and hibernate. Below are my steps
DISK PREP
partition the main drive for your swap and root first. For me, it is a boot partition + an EFI + a LUKS container with LVM on top. Create your volumes. I use Arch, so format and mount them appropriately before pacstrap. Leave out mount point for /home.
Go to your other drive, follow: https://www.cyberciti.biz/hardware/cryptsetup-add-enable-luks-disk-encryption-keyfile-linux/
to create a LUKS container that is encrypted with: a keyfile and a password. Test both to make sure you can open the locked drive. Format and mount it at /mnt/home or where you want the /home to be.
Important: Make sure to copy the keyfile from your archiso environment to your chroot environment aka your system. Otherwise, when reboot, the keyfile is gone. I put it in /root and set permission so only root can read.
AUTOMATIC UNLOCK
First, fstab. When you do genfstab, things should be fine. But just double check the UUID is correct for /home. Note in fstab, the UUID is the unlocked one: so the one with /dev/mapper/home. Change to noatime if you desire.
Second, crypttab. Assume you decrypt your LUKS home as "home". Add this:
home uuid of the unencrypted home drive location of the keyfile luks
The link above said to just use /dev/sda, but imo UUID is safer if you have a removable drive.
"rd.luks.uuid=UUID of the locked luks home drive"
FOR HIBERNATION
For some reasons, hibernation doesnt work out of the box. It works when I have everything in 1 drive, i.e 1 boot, 1 efi, 1 lvm on luks for /home, swap and /. The fix is simple:
add "resume" to /etc/mkinitcpio.conf. Add before "filesystems" . Rebuild your initramfs with mkinitcpio -P.
add to /etc/default/grub: "resume= uuid of the unlocked swap partition". Or if you do LVM, just use "resume=/dev/vg/swap".
Special thanks to bodaciousFern@lemmy.dbzer0.com and Lemmchen@feddit.org for giving me correct ideas about "rd.luks.uuid" and that LUKS can do both pass and keyfile.