Merge ~jefferyto/ubuntu/+source/initramfs-tools:hibernate-fixes into ubuntu/+source/initramfs-tools:ubuntu/devel

Proposed by Jeffery To
Status: Needs review
Proposed branch: ~jefferyto/ubuntu/+source/initramfs-tools:hibernate-fixes
Merge into: ubuntu/+source/initramfs-tools:ubuntu/devel
Diff against target: 48 lines (+8/-10)
2 files modified
init (+4/-4)
scripts/local-premount/resume (+4/-6)
Reviewer Review Type Date Requested Status
Benjamin Drung (community) Disapprove
git-ubuntu import Pending
Review via email: mp+467015@code.launchpad.net

Description of the change

This fixes an issue I currently experience (not being able to hibernate with systemd v255 on noble) and an issue I previously worked around (resume failing due to setting RESUME=UUID=... in /etc/initramfs-tools/conf.d/resume).

Please see the individual commit messages (and linked Launchpad issues).

To post a comment you must log in.
Revision history for this message
Benjamin Drung (bdrung) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Can you rebase your merge request against the ubuntu/devel branch on https://code.launchpad.net/~ubuntu-core-dev/ubuntu/+source/initramfs-tools/+git/initramfs-tools please? The development is done there. That's why I am marking this merge request as "disapprove".

I cherry-picked the second commit into the ubuntu/devel branch. I need a facepalm emoji to express the feeling reading those three bug reports and how long they are lingering around. So thanks for submitting the fix.

review: Disapprove
Revision history for this message
Jeffery To (jefferyto) wrote :

Thanks for your guidance and fast response. And apologies for the trouble - I also need a facepalm emoji for forking the wrong repo.

I have checked out the correct repo and branch, cherry picked the first commit, and force pushed the branch.

Revision history for this message
Benjamin Drung (bdrung) wrote :
Revision history for this message
Jeffery To (jefferyto) wrote :

I don't think I can change the merge target for this proposal. Would it be better if I opened a new merge proposal and set the target to https://code.launchpad.net/~ubuntu-core-dev/ubuntu/+source/initramfs-tools/+git/initramfs-tools?

Revision history for this message
Benjamin Drung (bdrung) wrote :

Yes.

Revision history for this message
Jeffery To (jefferyto) wrote :

Okay :) I have opened https://code.launchpad.net/~jefferyto/ubuntu/+source/initramfs-tools/+git/initramfs-tools/+merge/467060.

I've also pushed the original proposed branch back here for posterity.

Unmerged commits

b30b658... by Jeffery To

Fix resume failure due to resume=UUID=... in certain cases

If resume= has not been set on the kernel command line, and either:
* RESUME=UUID=... is set in /etc/initramfs-tools/conf.d/resume
* RESUME=auto is set in /etc/initramfs-tool/conf.d/resume and swap is a
  traditional partition (not in LVM)

Then the resume variable will be set to a UUID, which causes the resume
local-premount script to fail as it expects the resume variable to be a
device path.

This moves the UUID handling further down, outside of the parse kernel
command line options loop, to catch these cases.

Fixes: https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1769297
Fixes: https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1853982
Fixes: https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1957194
Signed-off-by: Jeffery To <email address hidden>

addc737... by Jeffery To

Fix hibernate for systemd v255

The resume device should always be written to the kernel, either (a) to
resume, if a suspend image is found, or (b) to enable suspend to that
device later.

More specifically, systemd v255 will not allow hibernate to start if the
resume device has not be set in the kernel.

This changes the resume local-premount script to always write the resume
device to /sys/power/resume so that hibernate can start.

Fixes: 20ec5ca0868a (" - resume: only resume when the partition contains a resume image - Fix resuming a hibernate session from a swapfile")
Fixes: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2057687
Signed-off-by: Jeffery To <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/init b/init
2index e270969..7861e94 100755
3--- a/init
4+++ b/init
5@@ -167,10 +167,6 @@ for x in $(cat /proc/cmdline); do
6 ;;
7 resume=*)
8 RESUME="${x#resume=}"
9- case $RESUME in
10- UUID=*)
11- RESUME="/dev/disk/by-uuid/${RESUME#UUID=}"
12- esac
13 ;;
14 resume_offset=*)
15 resume_offset="${x#resume_offset=}"
16@@ -247,6 +243,10 @@ fi
17 if [ -n "${noresume}" ] || [ "$RESUME" = none ]; then
18 noresume=y
19 else
20+ case $RESUME in
21+ UUID=*)
22+ RESUME="/dev/disk/by-uuid/${RESUME#UUID=}"
23+ esac
24 resume=${RESUME:-}
25 fi
26
27diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume
28index 6bd98e8..76e7391 100755
29--- a/scripts/local-premount/resume
30+++ b/scripts/local-premount/resume
31@@ -64,13 +64,11 @@ case "${SWAPTYPE}" in
32 # the message is even visible. Wait just a moment to make
33 # that less likely.
34 sleep 0.1
35- fi
36
37- echo "${MAJMIN}" > /sys/power/resume
38+ # plymouth hide-message does not work yet
39+ plymouth display-message --text=""
40+ fi
41 ;;
42 esac
43
44-if "$use_plymouth"; then
45- # plymouth hide-message does not work yet
46- plymouth display-message --text=""
47-fi
48+echo "${MAJMIN}" > /sys/power/resume

Subscribers

People subscribed via source and target branches