-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resume does not work (potential #cee5853 regression?) #924
Comments
This issue is being marked as stale because it has not had any recent activity. It will be closed if no further activity occurs. If this is still an issue in the latest release of Dracut and you would like to keep it open please comment on this issue within the next 7 days. Thank you for your contributions. |
Perhaps @danimo or @nabijaczleweli can comment on this? |
I'd argue that the post-#715 behaviour is strictly more correct logically in that host-only means (initrd has resume) <=> (host has resume), but that's worth very little if it's confusing. Does the diff below work for you? It should re-add the old behaviour. diff --git a/modules.d/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh
index 96c2573e..9f16537b 100755
--- a/modules.d/95resume/module-setup.sh
+++ b/modules.d/95resume/module-setup.sh
@@ -13,7 +13,7 @@ check() {
# Only support resume if hibernation is currently on
# and no swap is mounted on a net device
[[ $hostonly ]] || [[ $mount_needs ]] && {
- swap_on_netdevice || [[ "$(cat /sys/power/resume)" == "0:0" ]] && return 255
+ swap_on_netdevice || [[ "$(cat /sys/power/resume)" == "0:0" ]] || { echo "${host_fs_types[@]}" | grep -qwE 'swap|swsuspend|swsupend'; } && return 255
}
return 0 Alternatively, |
Can't easily check it, but I'm assuming that should work. |
I mean, you can either manually tell dracut to include the resume module, or write maj:min of your swap partition to |
Lemme quote myself (I had to re-read my bugzilla bug to get more context since I forgot a bit why this is happening): "[...]If I ever boot my kernel with resume disabled that means that if I rebuild my initramfs (or upgrade the kernel via yum) the support for resume will be disabled. Is this what we really want? And how does this work during the initial install? I'm assuming there's no swap so the generation of the initramfs during a fresh install has to be somehow different right?" Does that make sense? I think it is indeed true that if one boots without resume support (let's say you wanna ignore your hibernation image and boot normally) and updates the machine (via dnf), initramfs will be rebuilt and resume support will be dropped. Not sure whether that's desirable, but I also understand it might make sense in other situations or use cases that I do not use (perhaps!). Many thanks!! |
dracut.conf(5) lists I'm, personally, confused so as to what the issue is – hostonly exists specifically to avoid pulling in modules that aren't explicitly needed, and whether you support resume or not is host-specific configuration (even my patch upthread is, I'd argue, wrong from a purist's perspective, since I have at least one machine with more RAM than persistent storage, and it cannot be meaningfully hibernated (and, therefore, resumed), but has some swap). If you boot with resume off, for one reason or another, you can turn it on later by echoing maj:min into |
Well let's try to simplify the issue if that makes it hard to tacke: Also there's updates in https://bugzilla.redhat.com/show_bug.cgi?id=1842279 that indicate this might still be the case in Fedora 33. |
I have reproduced this without LUKS; if at any point you boot the system with the swap device missing, AND run dracut (i.e. after a kernel update), then dracut will notice /sys/power/resume is 0:0 and don't install the resume module in the next initrd. Therefore you enter a vicious circle since /sys/power/resume will never be set again. openSUSE does pass resume=UUID=xxx via bootloader cmdline, but this is not resolved by the kernel and also ignored by initrd when it has no resume module. The only way to break the cycle is to set /sys/power/resume manually and regenerate initrd; or to force resume module in dracut.conf . Guess distro policy should reflect this. While debugging this I also noticed that I should probably also file a bug re 480aa96 . swap_on_netdevice check seems not to be doing anything, since swap_devs array contains /dev/xxx-style names but block_is_netdevice expects MAJOR:MINOR format. :/ |
So, one installed a new machine, set up hibernation by writing to /sys/power/resume, rebooted to test it and... voila... resume has failed. And it's completely non-obvious why it's failed. There is no hint anywhere that initrd needs to be regenerated. In addition, the expectation that hibernation does have to be configured explicitly is simply not true anymore. When one uses "systemctl hibernate", one doesn't have to configure anything. One doesn't even need to know about the existence of /sys/power/resume... |
I also got hit by this problem. I also managed to work around by manually writing to |
Since commit 733c71c resume is exclusively done by systemd-hibernate-resume on systemd based systems. --> The device node is handed over by systemd-hibernate-resume-generator which reads the resume parameter from /proc/cmdline. So, the check for the device in /sys/power/resume is indeed wrong when systemd-hibernate-resume is used. |
We can't always correctly decide if the resume module is needed. So let's play safe and always include it. see: dracutdevs/dracut#924 RHEL-only Resolves:#1926544
We can't always correctly decide if the resume module is needed. So let's play safe and always include it. see: dracutdevs/dracut#924 RHEL-only Resolves:#1926544
We can't always correctly decide if the resume module is needed. So let's play safe and always include it. see: dracutdevs/dracut#924 RHEL-only Resolves: #1926544
I'm a Gentoo user, and I have faced several issues related to resume not working with https://github.com/bircoph/suspend . As you can see in dracut/modules.d/95resume/parse-resume.sh Line 10 in 10ed204
function dracut/modules.d/99base/dracut-lib.sh Lines 586 to 603 in 10ed204
when the resume device is already a path to a device, no condition is matched and it returns nothing, which leads to the dracut/modules.d/95resume/parse-resume.sh Lines 70 to 79 in 10ed204
So never happens dracut/modules.d/95resume/parse-resume.sh Line 69 in 10ed204
Many parts in dracut/modules.d/95resume/module-setup.sh Line 53 in 10ed204
but if your distro installs in /usr/lib64 instead of /usr/lib , the IMHO dracut/modules.d/95resume/module-setup.sh Line 67 in 10ed204
|
I have just created pull request #1607 with the minor fixes I have added to my installation in order to have it working |
Something I'm experiencing using the changes in my pull request in order to use s2disk is that sometimes the resume process from hibernation does not work. But, as the whole boot process stalls, I only have to do a hard shutdown and boot in order to try again, and it can work. It is like some device or condition is not ready yet, but I still have to gather additional information. |
We can't always correctly decide if the resume module is needed. So let's play safe and always include it. see: dracutdevs/dracut#924 RHEL-only Resolves: #1926544
Is this still an issue with an dracut release that contains the patches from @jmfernandez ? |
His patches were unrelated to the original issue. So yes, it's still an issue, comments #924 (comment) and #924 (comment) reflect the problem we have here. |
afaik can gather, it's strictly a problem with resuming from hibernation ( not suspending or hibernating and systemd has been hit by it as well ) because the resume kernel parameter is missing. Now we are not responsible for resuming and the kernel seems to be riddle with bugs related to this ( most recent I could find was this 1 which means some random hw works others fail ). Now whatever is adding that kernel parameter ( be it the user or some application ) it needs to enable the resume module and rebuild the initrd so I'm quite frankly failing to see how we are supposed to fix this issue o_O What expectation are people having of us? How are we supposed to somehow fix this? |
No. The problem is that the condition for including the resume module is overly strict: it assumes that the resume partition in E.g., Anaconda (the installer of Fedora/RHEL) automatically adds an appropriate Yes, hibernate generally sucks, but that doesn't mean we shouldn't strive to make it suck a bit less if it's possible. |
YaST does the same thing on SUSE distros.
I agree. Proposed patch: --- a/modules.d/95resume/module-setup.sh
+++ b/modules.d/95resume/module-setup.sh
@@ -10,10 +10,11 @@ check() {
return 1
}
- # Only support resume if hibernation is currently on
- # and no swap is mounted on a net device
+ # Only support resume if there is any suitable swap and
+ # it is not mounted on a net device
[[ $hostonly ]] || [[ $mount_needs ]] && {
- swap_on_netdevice || [[ -f /sys/power/resume && "$(cat /sys/power/resume)" == "0:0" ]] && return 255
+ ((${#swap_devs[@]})) || return 255
+ swap_on_netdevice && return 255
}
return 0 |
Then those installers should write to By definition hibernation is configured iff If we take "host-only" to mean "the minimal amount of stuff needed to boot the current host", then this violates that by including resume on all hosts with swap, which is all hosts, esp. since fedora started using systemd-zram-generator by default. |
…ation Don't consider noresume to disable, that's a single-boot flag Closes dracutdevs#924
…ation Don't consider noresume to disable, that's a single-boot flag Closes dracutdevs#924
…ation Don't consider noresume to disable, that's a single-boot flag Closes dracutdevs#924
…ation Don't consider noresume to disable, that's a single-boot flag Closes dracutdevs#924
…ation Don't consider noresume to disable, that's a single-boot flag Closes dracutdevs#924
…ation Don't consider noresume to disable, that's a single-boot flag Closes dracutdevs#924
…ation Don't consider noresume to disable, that's a single-boot flag Closes dracutdevs#924
…ation Don't consider noresume to disable, that's a single-boot flag Closes #924
@martinwhitaker could you submit your patch as a PR? |
…ation Move getcmdline from dracut-lib.sh to dracut-dev-lib.sh to make it available on the host as well. Closes dracutdevs#924
…ation Move getcmdline from dracut-lib.sh to dracut-dev-lib.sh to make it available on the host as well. Closes dracutdevs#924
…ation Don't consider noresume to disable, that's a single-boot flag Closes dracutdevs#924
…ation Move getcmdline from dracut-lib.sh to dracut-dev-lib.sh to make it available on the host as well. Closes dracutdevs#924
The grep introduced in commit e3a7112 does not work as intended. The resume module is always excluded in hostonly mode. Made this a bit more explicit with if/else so it is more clear what is going on. The in-line ||/&& makes the line really long and makes it more difficult to understand what is going on. Bug: dracutdevs/dracut#924 Signed-off-by: Andrew Ammerlaan <[email protected]>
Referencing this bug which did not get any love at all:
https://bugzilla.redhat.com/show_bug.cgi?id=1842279
Fedora 32, x64 fresh installation. Using LVM + LUKS (that is, LUKS encrypted LVM) that contains rootfs + swap partitions.
This might be potentially happening since #715
After a fresh Fedora install in the above indicated setup, /sys/power/resume is "0:0", which causes the dracut setup scripts to not install the required resume-from-disk machinery to recover from hibernation. This behaves like a loop since the lack of a defined swap partiton results in "dracut -f" generating ramdisks that do no contain the kernel arg "resume=foo" and so forth.
IMHO the script should gracefully handle the case where there's no swap partition defined for resume but one is available.
Please assume good intent. I'm not very familiar with Dracut nor Linux booting system so I could be wrong. However more users seem to experience this, suggesting there's indeed a bug and it is relatively easy to solve (see Bugzilla)
The text was updated successfully, but these errors were encountered: