Skip to content

How to switch from encrypt to sd-encrypt hook?

My current mkinitcpio.conf looks like this:

HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt filesystems fsck)

According to mkinitcpio examples from wiki, If I'm correct, I should change it to: HOOKS=(base systemd autodetect keyboard sd-vconsole block sd-encrypt filesystems fsck) Keymap and consolefont is replaced by sd-vconsole if I'm correct.

I have changed boot entry from cryptdevice=... To rd.luks.name=uuid=cryptroot rd.luks.options=allow-discard

After running mkinitcpio -P and rebooting my system, it hung on the message: A start job is running for /dev/mapper/cryptroot

3 points12 comments
Open on Reddit
About this post
Posted
Archived
Score
3 · 81% up
Kind
Text
ID
131thyv

Author

8
posts
24
comments
0
media
View profile

12 comments

My hooks:

HOOKS=(systemd autodetect modconf block sd-vconsole keyboard sd-encrypt filesystems)

In cmdline:

luks.uuid=$REAL_UUID luks.options=$REAL_UUID=allow-discards root=UUID=$UNLOCKED_UUID
6 points

Alternatively, define your encrypted filesystems in /etc/crypttab.initramfs and do mkinitcpio -P instead of defining in boot cmd line.

4 points

Arch wiki says:

​ If the file /etc/crypttab.initramfs exists, it will be added to the initramfs as /etc/crypttab, there you can specify devices that need to be unlocked at the initramfs phase. See #crypttab for the syntax.

If /etc/crypttab.initramfs does not exist, there will be no /etc/crypttab in the initramfs and the unlockable devices will need to be specified via kernel parameters listed below.

In my system crypttab.initramfs does not exist

1 points

Change allow-discard to just discard for systemd encrypt kernel parameter. Refer to the man pages for systemd-cryptsetup-generator and crypttab.

rd.luks.options=discard
3 points

My /boot/loader/entries/arch.conf look like this:

title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
63e06313-9d2d-4ecf-88a8-c63fd9c36f94

Could you tell me how should it look if I want to change my mkinitcpio hooks from HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt filesystems fsck)

to

HOOKS=(base systemd autodetect keyboard sd-vconsole modconf block sd-encrypt filesystems fsck)

?

1 points

For your systemd-boot entry, refer to this page. https://wiki.archlinux.org/title/dm-crypt/Encrypting_an_entire_system#Configuring_the_boot_loader

The /etc/mkinitcpio.conf section looks okay.

Also these sections are helpful: https://wiki.archlinux.org/title/dm-crypt/System_configuration#Using_systemd-cryptsetup-generator

https://wiki.archlinux.org/title/dm-crypt/System_configuration#Unlocking_in_early_userspace

Use the rd.luks.name option for the kernel parameter. In your boot entry, add rd.luks.name=UUID=devicename

(Alternatively you can add your root drive to /etc/crypttab, create a symlink from /etc/crypttab.initramfs pointed to /etc/crypttab, then rebuild initramfs with mkinitcpio -P).

The man pages also has examples if you read them. That is how I figured that stuff out.

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.