Package: dracut
Version: 048+80-2
Severity: normal
Tags: patch

Dear Maintainer,


Dracut, in host-only mode will, by default, only install the resume
module if it detects a swap partition.
This has a major problem of not detecting, and therefore not resuming
from, swap files.

This problem has been known upstream for a long time (2017, comment on
https://github.com/dracutdevs/dracut/commit/34b56de12aad622d602d6e3bd434e02c840f1cd0)
and an issue has been open since 2018
(https://github.com/dracutdevs/dracut/issues/496), to no avail so far.
I've recently opened a PR
(https://github.com/dracutdevs/dracut/pull/715), to a similar response.

In hopes I can spare another soul a few hours of debugging,
I have attached this patch here as well, having verified that it builds
with the 048+80-2 source and applies to the current HEAD at Salsa
(ebb0748) without problems; it simply replaces the partition detection
with a check against /sys/power/resume, and includes the module if it's
not 0:0, i.e. hibernation is enabled.

Another solution would be to add something like
  awk '{if($2 == "file") exit 1}' /proc/swaps || return 0
before the "return 255" line, but I feel that that's just moving the
problem.

Regards,
nabijaczleweli


-- System Information:
Debian Release: bullseye/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 5.4.0-4-686-pae (SMP w/2 CPU cores)
Kernel taint flags: TAINT_WARN
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages dracut depends on:
ii  dracut-core  048+80-2

dracut recommends no packages.

Versions of packages dracut suggests:
pn  dracut-network  <none>

-- no debconf information
From: nabijaczleweli <nabijaczlew...@gmail.com>
Date: Fri, 13 Dec 2019 07:59:59 +0100
Subject: [PATCH] Enable resume module if hibernation's enabled on the host

Ref: https://github.com/dracutdevs/dracut/commit/34b56de12aad622d602d6e3bd434e02c840f1cd0
Fixes https://github.com/dracutdevs/dracut/issues/496
---
 modules.d/95resume/module-setup.sh | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/modules.d/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh
index 6ddc725..cb06b56 100755
--- a/modules.d/95resume/module-setup.sh
+++ b/modules.d/95resume/module-setup.sh
@@ -2,12 +2,9 @@
 
 # called by dracut
 check() {
-    # No point trying to support resume, if no swap partition exist
+    # Only support resume if hibernation is currently on
     [[ $hostonly ]] || [[ $mount_needs ]] && {
-        for fs in "${host_fs_types[@]}"; do
-            [[ $fs =~ ^(swap|swsuspend|swsupend)$ ]] && return 0
-        done
-        return 255
+        [[ "$(cat /sys/power/resume)" == "0:0" ]] && return 255
     }
 
     return 0

Attachment: signature.asc
Description: PGP signature

Reply via email to