You are not logged in.

#1 2019-09-14 21:36:49

sil_el_mot
Member
Registered: 2018-08-05
Posts: 9

[Solved] use encrypted swap for hibernation with systemd-boot - no lvm

Hey there,
i decided to install arch from ground up to get rid of the unnecesary (for me) extra layer lvm.
the partitions are encrypted and root gets decrypted on start with a password, the rest than mounts with a keyfile.
the swap partition also mounts with fstab and crypttab and the keyfile.
unfortunately i cant get it installed in the boot-parameters for use of hibernation.

this is my arch.conf in /boot/loader/entries:

title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options cryptdevice=/dev/sdb2:main root=/dev/mapper/main resume=/dev/crypt-swap rw quiet splash

i also tried /dev/dm-1 (swapon --summary showed this)

the HOOKS are this:

HOOKS=(base udev plymouth autodetect modconf block keymap plymouth-encrypt keyboard resume filesystems fsck)

i believe the problem is, that the encrypted swap-partition is not yet decrypted and mapped when the boot-process wants to access it.

any ideas what to try?

Last edited by sil_el_mot (2019-09-15 17:43:12)

Offline

#2 2019-09-14 21:48:27

Swiggles
Member
Registered: 2014-08-02
Posts: 259

Re: [Solved] use encrypted swap for hibernation with systemd-boot - no lvm

Try swapping the places for "resume" and "filesystems". I am pretty sure the order is wrong.

Offline

#3 2019-09-14 21:49:37

sil_el_mot
Member
Registered: 2018-08-05
Posts: 9

Re: [Solved] use encrypted swap for hibernation with systemd-boot - no lvm

oh yeah, forgot to say, i tried this also .
but thanks

Offline

#4 2019-09-14 21:55:28

Swiggles
Member
Registered: 2014-08-02
Posts: 259

Re: [Solved] use encrypted swap for hibernation with systemd-boot - no lvm

Yes, I didn't read either. :-)
What you need is an initcpio hook for this to work. With LVM it is easier, but since you want to get rid of it:

https://wiki.archlinux.org/index.php/Dm … tcpio_hook

Edit: Be aware of this big disclaimer: https://www.kernel.org/doc/Documentatio … swsusp.txt

Last edited by Swiggles (2019-09-14 21:58:39)

Offline

#5 2019-09-14 22:08:21

sil_el_mot
Member
Registered: 2018-08-05
Posts: 9

Re: [Solved] use encrypted swap for hibernation with systemd-boot - no lvm

Thanks for the point to the right wiki entry. that helps with my problems.
But now i am afraid of this disclaimer... just thinking about, if i need a working hibernation .... hmmm...
yeah, but thanks big_smile

Offline

#6 2019-09-14 22:14:38

Swiggles
Member
Registered: 2014-08-02
Posts: 259

Re: [Solved] use encrypted swap for hibernation with systemd-boot - no lvm

Sounds like LVM might have been necessary after all.. ;-)

Maybe another option that is not described in the wiki (yet). You could extract a decryption key by using a TPM device if your machine has one.

Offline

#7 2019-09-15 09:46:39

sil_el_mot
Member
Registered: 2018-08-05
Posts: 9

Re: [Solved] use encrypted swap for hibernation with systemd-boot - no lvm

Yeah . i got rid of lvm because i thought i don't need it. and it always slowed down my boot-time. now the biggest slowdown are the encrypted devices. 2tb encrypted takes 4.7sec. seems like i have to live with it

i have a tpm but i checked for it and this seems to complicated in the moment. and as i understand windows also uses it and for dual-booting reasons this would be another problem, i think

Offline

#8 2019-09-15 12:13:54

Swiggles
Member
Registered: 2014-08-02
Posts: 259

Re: [Solved] use encrypted swap for hibernation with systemd-boot - no lvm

I was looking around a bit and it looks like this does not apply to swap files on your root partition. By setting your root with a given offset you should be able to resume from it. You can find this in the wiki.
The regular swap partition could be setup with a random key and discarded at each reboot. Set proper priorities and you should be good to go. Or remove it if you don't need swap for anything but suspend.

Offline

#9 2019-09-15 17:42:45

sil_el_mot
Member
Registered: 2018-08-05
Posts: 9

Re: [Solved] use encrypted swap for hibernation with systemd-boot - no lvm

Thanks a lot. Works great now!

Offline

Board footer

Powered by FluxBB