Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is the encrypt-hook required when used for root partition? #4

Closed
francoism90 opened this issue Jul 9, 2017 · 3 comments
Closed

Is the encrypt-hook required when used for root partition? #4

francoism90 opened this issue Jul 9, 2017 · 3 comments

Comments

@francoism90
Copy link

francoism90 commented Jul 9, 2017

Bit confused; is it needed to set the encrypt hook before filesystems to unlock a root filesystem?
I've got troubles in the past when not using the udev hook, is it required to remove this hook?

What does the a function do? Because now I had to use s, run cryptsetup luksOpen .. to get a working boot process. Or should the / be added to /etc/crypttab?

Thanks. :)

@Andrei-Pozolotin
Copy link
Collaborator

  1. here is recommended hook list for mkinitcpio.conf:
HOOKS="base autodetect modconf block filesystems keyboard fsck systemd systemd-tool"
  1. sample content of /boot/initramfs-linux.img/ucpio://etc/crypttab:
# <mapper name> <block device> <password/keyfile> <crypto options>
# root
root   UUID=342d9e07-c09e-4a36-bbbf-03ea8bfb1647   none   luks,discard
# swap
swap   UUID=567def65-29c1-420c-91c2-37be2d63545e   none   luks,discard
  1. sample content of

/etc/fstab:

# <block device>  <mount point> <fs type> <options> <dump> <pass>
# root
/dev/mapper/root   /   auto   defaults,nofail,noatime   0   1
# swap
/dev/mapper/swap   none   swap   defaults,nofail,noatime   0   2
# boot
UUID=939D-4331   /boot   auto   defaults,nofail,noatime   0   2
# home
/dev/mapper/home   /home   auto   defaults,nofail,noatime   0   2

/etc/crypttab:

# <mapper name> <block device> <password/keyfile> <crypto options>
home   UUID=6f16e925-dcdc-412c-80e4-3ad2bb9bb5fa   /etc/crypttab.d/keyfile.bin   luks,discard,key-slot=7,nofail
  1. finally:

lsblk:

NAME     MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda        8:0    0 465.8G  0 disk  
├─sda1     8:1    0   499M  0 part  /boot
├─sda2     8:2    0   4.9G  0 part  
│ └─swap 254:0    0   4.9G  0 crypt [SWAP]
└─sda3     8:3    0 460.4G  0 part  
  └─root 254:1    0 460.4G  0 crypt /
sr0       11:0    1  1024M  0 rom 

blkid:

/dev/sda1: UUID="939D-4331" TYPE="vfat" PARTUUID="2fe9b9a8-01"
/dev/sda2: UUID="567def65-29c1-420c-91c2-37be2d63545e" TYPE="crypto_LUKS" PARTUUID="2fe9b9a8-02"
/dev/sda3: UUID="342d9e07-c09e-4a36-bbbf-03ea8bfb1647" TYPE="crypto_LUKS" PARTUUID="2fe9b9a8-03"
/dev/mapper/swap: UUID="6de529e0-45e4-40f1-ab04-184b42a42dc1" TYPE="swap"
/dev/mapper/root: UUID="cbf95c88-b91a-437a-a52d-47db427ea8b5" TYPE="ext4"

@stephenmk
Copy link

My root partition lives in an LVM inside a LUKS container. I found that I had to add an LVM hook to mkinitcpio.conf to get it to work.

HOOKS="base autodetect modconf block sd-lvm2 filesystems keyboard fsck systemd systemd-tool"

Just wanted to share this information in case others have the same issue. Thank you!

@benzinrts
Copy link

benzinrts commented Jun 1, 2018

@stephenmk, thanks for the hint!
I use LVM residing on RAID, so I had to add mdadm hook. Hook order is important and the below one worked for me:
base autodetect modconf block filesystems keyboard fsck systemd mdadm_udev sd-lvm2 systemd-tool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants