You are not logged in.

#1 2025-08-05 18:46:54

lobasa
Member
Registered: 2025-08-05
Posts: 1

Hibernation with encrypted swap partition

Hi, i'm trying to install Arch in a VM (UEFI).
I have three partitions:

lsblk -f
NAME                  FSTYPE      FSVER            LABEL            UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sr0                   iso9660     Joliet Extension ARCH_202508      2025-08-01-13-39-26-00                              
vda                                                                                                                     
├─vda1                vfat        FAT32                             0935-28AC                               7.9G     1% /boot
├─vda2                crypto_LUKS 2                                 caa69338-d77a-42c1-9b1a-fe3a5dc0988f                
│ └─crypt-980pro-1    btrfs                        monday-storage-1 689d516a-8671-4bd8-92eb-fd88824cd577   34.4G     3% /var
│                                                                                                                       /root
│                                                                                                                       /home
│                                                                                                                       /
└─vda3                crypto_LUKS 2                                 34060776-8e2c-4fd2-8ac5-f1c9a83adf81                
  └─crypt-monday-swap swap        1                                 cd1aca0c-7c79-4bad-bf2d-955be0db1925                [SWAP]

vda1 - boot
vda2 - btrfs on luks
vda3 - swap on luks

fstab:

# /dev/mapper/crypt-980pro-1 LABEL=monday-storage-1
UUID=689d516a-8671-4bd8-92eb-fd88824cd577	/         	btrfs     	rw,relatime,compress=lzo,space_cache=v2,subvol=/@	0 0

# /dev/mapper/crypt-980pro-1 LABEL=monday-storage-1
UUID=689d516a-8671-4bd8-92eb-fd88824cd577	/home     	btrfs     	rw,relatime,compress=lzo,space_cache=v2,subvol=/@home	0 0

# /dev/mapper/crypt-980pro-1 LABEL=monday-storage-1
UUID=689d516a-8671-4bd8-92eb-fd88824cd577	/var      	btrfs     	rw,relatime,compress=lzo,space_cache=v2,subvol=/@var	0 0

# /dev/mapper/crypt-980pro-1 LABEL=monday-storage-1
UUID=689d516a-8671-4bd8-92eb-fd88824cd577	/root     	btrfs     	rw,relatime,compress=lzo,space_cache=v2,subvol=/@root	0 0

# /dev/vda1
UUID=0935-28AC      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

# /dev/mapper/crypt-monday-swap
UUID=cd1aca0c-7c79-4bad-bf2d-955be0db1925	none      	swap      	defaults  	0 0

mkinitcpio hooks

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

grub config

/etc/default/grub


# GRUB boot loader configuration

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
# GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet"
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX="rd.luks.name=caa69338-d77a-42c1-9b1a-fe3a5dc0988f=crypt-980pro-1 rd.luks.name=34060776-8e2c-4fd2-8ac5-f1c9a83adf81=crypt-monday-swap"

# 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 `videoinfo'
GRUB_GFXMODE=auto

# 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="/path/to/wallpaper"
#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
# setting 'GRUB_DEFAULT=saved' above.
#GRUB_SAVEDEFAULT=true

# Uncomment to disable submenus in boot menu
#GRUB_DISABLE_SUBMENU=y

# Probing for other operating systems is disabled for security reasons. Read
# documentation on GRUB_DISABLE_OS_PROBER, if still want to enable this
# functionality install os-prober and uncomment to detect and include other
# operating systems.
#GRUB_DISABLE_OS_PROBER=false

During normal boot this setup works as expect (opens grub, asks for password (one time), mounts everything). Swap partition is working as expected (

swapon --show
NAME TYPE SIZE USED PRIO
/dev/dm-0 partition 16G 0B -2

but it freezes if I try to resume from hibernation

systemctl hibernate

grub opens, initramfs asks for password, decrypts both partitions and then freezes freeze.png

my journalctl
dmesg (reboot after freeze)

other things I've tried:

  • resume=UUID=... in kernel cmdline - the same behavior (freeze after unlock)

  • dracut as initramfs with add_dracutmodules+=" resume " -  the same behavior (freeze after unlock)

it looks like my VM manager does not pass sysrq keybinds (even when vm boots normally and with sysrq_always_enabled=1 in kernel cmdline )

Is there something I'm missing?

Last edited by lobasa (2025-08-05 19:31:46)

Offline

#2 2025-08-08 09:04:48

susd
Member
Registered: 2025-02-04
Posts: 12

Re: Hibernation with encrypted swap partition

Could you maybe try systemd.log_level=debug in the kernel parameters? The initramfs might react to that and generate more verbose output

Edit: Maybe also remove quiet from kernel params if it is present.

Last edited by susd (2025-08-08 09:15:05)

Offline

Board footer

Powered by FluxBB