Open rkjnsn opened 3 years ago
@rkjnsn Does adding export SYSTEMD_PROC_CMDLINE="$(getcmdline)"
to https://github.com/dracutdevs/dracut/blob/2d83bce21bfc874b29c1fb99e8fabb843f038725/modules.d/98dracut-systemd/dracut-cmdline.sh#L18 help to resolve this issue ?
It does not. It appears that systemd units (such as dracut-cmdline.service
) run with their own clean environments distinct from the one used to run systemd itself and the generators. As such, setting SYSTEMD_PROC_CMDLINE
there isn't enough for systemd-hibernate-resume-generator
to see it.
Describe the bug In host-only mode, dracut auto-generates a kernel command-line and stores it in the generated initramfs. This is super convenient, as it will automatically detect the proper values for
root=
,rootflags=
,resume=
,rd.luks.uuid=
, et cetera. However, this information is never passed to systemd, meaning that operations managed by systemd rather than dracut scripts, such as resuming from swsusp, don't have access to this stored command-line information and thus fail to work.Distribution used Gentoo
Dracut version 050
Init system Systemd
To Reproduce
dracut
includes the correct value forresume=
Expected behavior The system properly resumes from hibernation.
Actual behavior The stored commandline is not passed to systemd, so
systemd-hibernate-resume-generator
never instantiatessystemd-hibernate-resume@.service
, causing the system to boot from scratch rather than resuming from hibernation.Additional context Passing a custom kernel command-line to systemd appears to be as simple as setting the
SYSTEMD_PROC_CMDLINE
environment variable. To test, I replaced the/init
symlink in the initramfs with the following script:With that change in place, my system properly resumes from hibernation.