You are not logged in.

#1 2019-07-30 16:14:44

Zohran
Member
Registered: 2017-01-19
Posts: 45

Problem to use swap hibernate with sd-encrypt on lvm on luks

Hello. I'm in past an big gentoo user, but now, i'm tired to compile all of my system and i would like to keep my personnal time.

I have decided to switch to Archlinux.

Similarof my past Gentoo installation, i have installed encrypted installation with lvm. It's LVM on luks partition. All work correctly, and i use sd-encrypt. BUT i have just one problem. Systemd use sd-encrypt and i have read sd-encrypt have more feature, but when i read wiki, i see problem, and i have this problem. Impossible to use hibernation with sd-encrypt.

Archlinux wiki: https://wiki.archlinux.org/index.php/Dm … encryption

This section is only applicable when using the encrypt hook, which can only unlock a single device (FS#23182). With sd-encrypt multiple devices may be unlocked (see Dm-crypt/System configuration#Using sd-encrypt hook), but swap autodetection is not available yet. systemd issue 4878

How can i do that ?

My system:

[zohran@msi-gs73vr-6rf ~]$ sudo blkid
[sudo] Mot de passe de zohran : 
/dev/nvme0n1p1: UUID="3A2E-0B46" TYPE="vfat" PARTUUID="c8785e5c-7681-4677-b0dc-9dbb27c0e2ec"
/dev/nvme0n1p2: UUID="cbf4baa1-595f-4422-b522-9c126e4453fb" TYPE="ext4" PARTUUID="4c04f00d-b42d-4d74-8006-43a4b19534d4"
/dev/nvme0n1p3: UUID="199a0fdb-c870-477a-9200-1998834dc0ef" TYPE="crypto_LUKS" PARTUUID="bf3ffa74-4ab5-444a-81e0-9b720050ee5a"
/dev/mapper/CryptedSystem: UUID="ZlEHxy-9Q3x-AjKP-BfVF-mbQb-r5Un-pvxeFV" TYPE="LVM2_member"
/dev/mapper/System-Swap: UUID="6e694b22-cc63-4a63-8545-11614f08cc19" TYPE="swap"
/dev/mapper/System-Root: UUID="3b365097-d768-4cb3-84e4-4db79e46bb2d" TYPE="ext4"
# GRUB boot loader configuration

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="audit=0 loglevel=3 rd.luks.name=199a0fdb-c870-477a-9200-1998834dc0ef=CryptedSystem root=/dev/System/Root resume=UUID=6e694b22-cc63-4a63-8545-11614f08cc19 acpi_osi=! acpi_osi='Windows 2009' quiet"
GRUB_CMDLINE_LINUX=""

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable booting from LUKS encrypted devices
GRUB_ENABLE_CRYPTODISK=y

# Set to 'countdown' or 'hidden' to change timeout behavior,
# press ESC key to display menu.
GRUB_TIMEOUT_STYLE=menu

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=1920x1080x32

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper
# modes only.  Entries specified as foreground/background.
#GRUB_COLOR_NORMAL="light-blue/black"
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
GRUB_BACKGROUND="/boot/grub/archlinux.png"
#GRUB_THEME="/path/to/gfxtheme"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

# Uncomment to make GRUB remember the last selection. This requires to
# set 'GRUB_DEFAULT=saved' above.
#GRUB_SAVEDEFAULT="true"
HOOKS=(base systemd autodetect keyboard sd-vconsole modconf block sd-encrypt sd-lvm2 resume filesystems fsck)

Offline

#2 2019-07-30 16:39:20

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 596

Re: Problem to use swap hibernate with sd-encrypt on lvm on luks

Zohran wrote:

Archlinux wiki: https://wiki.archlinux.org/index.php/Dm … encryption

This section is only applicable when using the encrypt hook, which can only unlock a single device (FS#23182). With sd-encrypt multiple devices may be unlocked (see Dm-crypt/System configuration#Using sd-encrypt hook), but swap autodetection is not available yet. systemd issue 4878

That note is about unlocking multiple LUKS devices. On a LVM on LUKS setup if the volume group is not spanning multiple encrypted devices then you don't need to unlock an additional device in initramfs.
From blkid it looks like you only have one LUKS device, so both "encrypt" or "sd-encrypt" hooks will work.

Offline

#3 2019-07-30 16:44:20

Zohran
Member
Registered: 2017-01-19
Posts: 45

Re: Problem to use swap hibernate with sd-encrypt on lvm on luks

Okay. It's good news, but when my laptop start, systemd show error when he try to active swap.

Offline

#4 2019-07-30 16:49:56

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 596

Re: Problem to use swap hibernate with sd-encrypt on lvm on luks

What does the error say?

Offline

#5 2019-07-30 17:02:37

Zohran
Member
Registered: 2017-01-19
Posts: 45

Re: Problem to use swap hibernate with sd-encrypt on lvm on luks

After i have enter my password for encrypted installation, systemd show:

Failed to start Resume from hibernation using device ....(UUID)
 zohran@msi-gs73vr-6rf   ~  systemctl status systemd-hibernate-resume@dev-disk-by\\x2duuid-6e694b22\\x2dcc63\\x2d4a63\\x2d8545\\x2d11614f08cc19.service                                                    3 ↵  2  19:02:08  
● systemd-hibernate-resume@dev-disk-by\x2duuid-6e694b22\x2dcc63\x2d4a63\x2d8545\x2d11614f08cc19.service - Resume from hibernation using device /dev/disk/by-uuid/6e694b22-cc63-4a63-8545-11614f08cc19
   Loaded: loaded (/usr/lib/systemd/system/systemd-hibernate-resume@.service; static; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2019-07-30 18:58:43 CEST; 3min 28s ago
     Docs: man:systemd-hibernate-resume@.service(8)
 Main PID: 606 (code=exited, status=1/FAILURE)

juil. 30 18:58:43 archlinux systemd[1]: Starting Resume from hibernation using device /dev/disk/by-uuid/6e694b22-cc63-4a63-8545-11614f08cc19...
juil. 30 18:58:43 archlinux systemd-hibernate-resume[606]: Failed to write '254:1' to /sys/power/resume: No such file or directory
juil. 30 18:58:43 archlinux systemd[1]: systemd-hibernate-resume@dev-disk-by\x2duuid-6e694b22\x2dcc63\x2d4a63\x2d8545\x2d11614f08cc19.service: Main process exited, code=exited, status=1/FAILURE
juil. 30 18:58:43 archlinux systemd[1]: systemd-hibernate-resume@dev-disk-by\x2duuid-6e694b22\x2dcc63\x2d4a63\x2d8545\x2d11614f08cc19.service: Failed with result 'exit-code'.
juil. 30 18:58:43 archlinux systemd[1]: Failed to start Resume from hibernation using device /dev/disk/by-uuid/6e694b22-cc63-4a63-8545-11614f08cc19.

Offline

#6 2019-07-30 17:12:53

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 596

Re: Problem to use swap hibernate with sd-encrypt on lvm on luks

Zohran wrote:
juil. 30 18:58:43 archlinux systemd-hibernate-resume[606]: Failed to write '254:1' to /sys/power/resume: No such file or directory

This doesn't look good. Does /sys/power/resume exist?

Offline

#7 2019-07-30 18:21:37

Zohran
Member
Registered: 2017-01-19
Posts: 45

Re: Problem to use swap hibernate with sd-encrypt on lvm on luks

No

 zohran@msi-gs73vr-6rf   ~  cat /sys/power/resume                                        ✔  1  20:20:05  
cat: /sys/power/resume: Aucun fichier ou dossier de ce type

Why i have this problem ? How can i solve it ?

Offline

#8 2019-07-30 18:44:44

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 596

Re: Problem to use swap hibernate with sd-encrypt on lvm on luks

I have no idea how that happened, even all my VMs have that file.

Could be a firmware or firmware configuration issue if the kernel checks for some functionality before making the file available (I don't know if it does), or maybe you have something in fstab that mounts over /sys or /sys/power ?

Post the output of:

$ cat /sys/power/state
$ findmnt -R /sys

P.S. Prepend LC_ALL=C to the commands to get English output, https://wiki.archlinux.org/index.php/Co … s_and_code .

Offline

#9 2019-07-30 18:48:20

Zohran
Member
Registered: 2017-01-19
Posts: 45

Re: Problem to use swap hibernate with sd-encrypt on lvm on luks

Okay sorry

 zohran@msi-gs73vr-6rf   ~  findmnt -R /sys                                              ✔  1  20:22:52  
TARGET                              SOURCE     FSTYPE     OPTIONS
/sys                                sysfs      sysfs      rw,nosuid,nodev,noexec,relatime
├─/sys/kernel/security              securityfs securityfs rw,nosuid,nodev,noexec,relatime
├─/sys/fs/cgroup                    tmpfs      tmpfs      ro,nosuid,nodev,noexec,mode=755
│ ├─/sys/fs/cgroup/unified          cgroup2    cgroup2    rw,nosuid,nodev,noexec,relatime,nsdelegate
│ ├─/sys/fs/cgroup/systemd          cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,xattr,name=systemd
│ ├─/sys/fs/cgroup/pids             cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,pids
│ ├─/sys/fs/cgroup/blkio            cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,blkio
│ ├─/sys/fs/cgroup/devices          cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,devices
│ ├─/sys/fs/cgroup/rdma             cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,rdma
│ ├─/sys/fs/cgroup/freezer          cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,freezer
│ ├─/sys/fs/cgroup/net_cls,net_prio cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,net_cls,net_prio
│ ├─/sys/fs/cgroup/cpu,cpuacct      cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,cpu,cpuacct
│ ├─/sys/fs/cgroup/perf_event       cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,perf_event
│ ├─/sys/fs/cgroup/cpuset           cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,cpuset
│ ├─/sys/fs/cgroup/memory           cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,memory
│ └─/sys/fs/cgroup/hugetlb          cgroup     cgroup     rw,nosuid,nodev,noexec,relatime,hugetlb
├─/sys/fs/pstore                    pstore     pstore     rw,nosuid,nodev,noexec,relatime
├─/sys/firmware/efi/efivars         efivarfs   efivarfs   rw,nosuid,nodev,noexec,relatime
├─/sys/fs/bpf                       bpf        bpf        rw,nosuid,nodev,noexec,relatime,mode=700
├─/sys/kernel/debug                 debugfs    debugfs    rw,nosuid,nodev,noexec,relatime
└─/sys/kernel/config                configfs   configfs   rw,nosuid,nodev,noexec,relatime
 zohran@msi-gs73vr-6rf   ~  cat /sys/power/state                                         ✔  2  20:47:26  
freeze mem

Offline

#10 2019-07-30 19:01:34

nl6720
The Evil Wiki Admin
Registered: 2016-07-02
Posts: 596

Re: Problem to use swap hibernate with sd-encrypt on lvm on luks

Zohran wrote:
freeze mem

There's no "disk" in the output, so the kernel thinks that suspending-to-disk is not possible. That's probably why there's no /sys/power/resume.

Did hibernation work with this hardware when using Gentoo?

All I can suggest is to check the firmware setup menu to see if there's any syspend/hibernate/S4 setting that is not enabled or try the linux-lts kernel.

Offline

#11 2019-07-30 19:07:14

Zohran
Member
Registered: 2017-01-19
Posts: 45

Re: Problem to use swap hibernate with sd-encrypt on lvm on luks

Yes, it work on Gentoo. It's the most reason i keep my Gentoo installation, because it's VERY stable and all work fine. With systemd ...

Offline

Board footer

Powered by FluxBB