Skip to content

Commit

Permalink
feat(resume): also consider resume= in the cmdline as enabling hibern…
Browse files Browse the repository at this point in the history
…ation

Don't consider noresume to disable, that's a single-boot flag

Closes #924
  • Loading branch information
nabijaczleweli authored and johannbg committed Feb 13, 2023
1 parent d8a9a73 commit e3a7112
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules.d/95resume/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 || [[ -f /sys/power/resume && "$(cat /sys/power/resume)" == "0:0" ]] && return 255
swap_on_netdevice || [[ -f /sys/power/resume && "$(< /sys/power/resume)" == "0:0" ]] || grep -rq '^\|[[:space:]]resume=' /proc/cmdline /etc/cmdline /etc/cmdline.d /etc/kernel/cmdline /usr/lib/kernel/cmdline 2> /dev/null && return 255

This comment has been minimized.

Copy link
@Nowa-Ammerlaan

Nowa-Ammerlaan Aug 20, 2023

@nabijaczleweli @johannbg This grep is not working as intended, for me this breaks hibernation (i.e. the resume module is no longer included). Even though I have a resume= in /proc/cmdline and /etc/kernel/cmdline:

root=PARTUUID=77ed6431-0d88-2846-9e21-835dc99f579b resume=PARTUUID=77ed6431-0d88-2846-9e21-835dc99f579b resume_offset=364099584 ro quiet splash apparmor=1 security=apparmor systemd.machine_id=204b505c963976da92752bb45b5adc9c drm.edid_firmware=DP-3:edid/hkc-tv-with-splitter-edid.bin

Removing the grep fixes the problem.

I think the grep should be like this:

|| ! grep -rq 'resume=' /proc/cmdline /etc/cmdline /etc/cmdline.d /etc/kernel/cmdline /usr/lib/kernel/cmdline 2> /dev/null && return 255
andrew-gentoo-pc ~ # ! grep -rq 'resume=' /proc/cmdline /etc/cmdline /etc/cmdline.d /etc/kernel/cmdline /usr/lib/kernel/cmdline 2> /dev/null && echo "disabling resume module"
andrew-gentoo-pc ~ # ! grep -rq 'thisisnotinthefile=' /proc/cmdline /etc/cmdline /etc/cmdline.d /etc/kernel/cmdline /usr/lib/kernel/cmdline 2> /dev/null && echo "disabling resume module"
disabling resume module
}

return 0
Expand Down

0 comments on commit e3a7112

Please sign in to comment.