You are not logged in.

#1 2014-11-28 16:52:41

m45t3r
Member
Registered: 2010-06-06
Posts: 8

[SOLVED] mkinicpio's systemd hook, LUKS, LVM and resume

I had a working LUKS/LVM/resume using the following HOOKS and kernel parameters:

# /etc/mkinitcpio.conf
HOOKS="base udev autodetect modconf block keymap encrypt lvm2 btrfs resume filesystems keyboard"

# /boot/loader/entries/arch.conf
options cryptodevice=PARTUUID=28230c39-5262-4778-b12a-b5eda11831d0:lvm resume=/dev/mapper/vol0-lv_swap root=/dev/mapper/vol0-lv_root rw 

Since systemd 217 is supposed to support hiberation, I am trying to setup a pure systemd initrd image. So I changed my mkinitcpio.conf and arch.conf files to the following:

# /etc/mkinitcpio.conf
HOOKS="systemd autodetect modconf block keymap sd-encrypt sd-lvm2 btrfs filesystems keyboard"

# /boot/loader/entries/arch.conf
options rd.luks.uuid=176a3eb9-90c3-49c7-a0b5-697860d21068 resume=UUID=b89c478e-a1ff-4332-a11b-ceebc3b08de8 root=UUID=e180cd3e-d4c4-4e0a-9426-0f7e460a7303 rw

The change in boot entry is done as suggested in this topic, since using cryptodevice doesn't seem to work. I only changed the resume/root to UUID since this seems to be the right way to do things (UUID is not supposed to change, while labels may change).

And the system boots, but resume doesn't work (tried to run "systemctl hibernate" from terminal, the system hibernates but never resumes). I removed the resume hook since it doesn't seem to be necessary with systemd hook. Even if I put it again it doesn't work (it tries to run the resume hook, I can see the logs during the boot, but nothing changes). I think this is a problem in the root entry or resume entry in my boot parameters (maybe both), probably I need to change for some other think but I didn't find anything searching in Google.

Maybe someone with a Fedora setup may help? The suggestion to use rd.luks.uuid instead of cryptsetup seems to come from there.

Last edited by m45t3r (2014-11-29 22:30:13)

Offline

#2 2014-11-29 17:58:40

m45t3r
Member
Registered: 2010-06-06
Posts: 8

Re: [SOLVED] mkinicpio's systemd hook, LUKS, LVM and resume

Solved. As I assumed, using a setup similar to Fedora is the solution (I installed Fedora in a VM and checked the grub.cfg file from them).

# /boot/loader/entries/arch.conf
options rd.luks.uuid=176a3eb9-90c3-49c7-a0b5-697860d21068 rd.lvm.lv=lvm/root rd.lvm.lv=lvm/swap resume=UUID=b89c478e-a1ff-4332-a11b-ceebc3b08de8 root=UUID=e180cd3e-d4c4-4e0a-9426-0f7e460a7303 rw

So you need to pass your logical LVM partition to initrd too.

Anyway, just for the information. To get the UUIDs you can run:

# lsblk -f

Last edited by m45t3r (2014-11-29 22:36:20)

Offline

#3 2015-03-19 05:15:25

m45t3r
Member
Registered: 2010-06-06
Posts: 8

Re: [SOLVED] mkinicpio's systemd hook, LUKS, LVM and resume

I know this may seem like I am reviving an old topic, but recently I bought a SSD and tried to replicate my setup, including supporting for TRIM. While it's easy to do it's not something trivial since it's not really well docummented.

You will need three things:

  1. A filesystem that supports discard (I am using XFS).

  2. In /etc/lvm/lvm.conf, enable issue_discards option.

  3. Lastly, add rd.luks.options=discard in your kernel boot options

To test if everything is working as it should, just do:

# fstrim /

And if everything is working it should return 0, or a error message in case of error.

Hope this help someone.

Offline

Board footer

Powered by FluxBB