resume from hibernation broken when resume image is autodetected (UUID= syntax used)

Bug #1769297 reported by Dmitriy Geels
84
This bug affects 12 people
Affects Status Importance Assigned to Milestone
initramfs-tools (Ubuntu)
Fix Released
Medium
Benjamin Drung
Noble
Fix Committed
Medium
Unassigned

Bug Description

[ Impact ]

I found a reason of non-functioning resume from hibernation when resume partition/file is autodetected by intiramfs hook /usr/share/initramfs-tools/hooks/resume.

Here is the scenario:
1) hook /usr/share/initramfs-tools/hooks/resume creates config conf/conf.d/zz-resume-auto saved in initrd image, containing one variable: RESUME=UUID=106238b0-707d-4422-866d-a7534da50702 in my case

2) during boot init script sets 'resume' variable to 'RESUME' value from conf/conf.d/zz-resume-auto, then it executes local-premount scripts including local-premount/resume

3) resuming script local-premount/resume (/usr/share/initramfs-tools/scripts/local-premount/resume) tries to get resume device major-minor numbers by these lines:
DEV=$(readlink ${resume})
DEV=/sys/class/block/${DEV##*/}/dev
if [ -r "$DEV" ]; then
        read MAJMIN < "$DEV"
fi

4) next check fails and resume process silently aborts:
if [ -z "$MAJMIN" ]; then
        exit 1
fi

Resuming script fails to get device major-minor because resume=UUID=106238b0-707d-4422-866d-a7534da50702 -- it's not resolved into device path in init script.

Commonly mentioned workaround is to explicitly specify kernel parameter resume=UUID=106238b0-707d-4422-866d-a7534da50702 -- only in this case init script resolves it to device path.

[ Test Plan ]

1. hibernate: `sudo systemctl hibernate`
2. resume from hibernate
3. `cat /sys/power/resume` should contain the major-minor of the swap

[ Other Info ]

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: initramfs-tools 0.130ubuntu3
Uname: Linux 4.16.6-041606-generic x86_64
ApportVersion: 2.20.9-0ubuntu7
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Sat May 5 11:32:31 2018
InstallationDate: Installed on 2018-03-27 (38 days ago)
InstallationMedia: Ubuntu 18.04 LTS "Bionic Beaver" - Alpha amd64 (20180327)
PackageArchitecture: all
SourcePackage: initramfs-tools
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
Dmitriy Geels (dmig) wrote :
description: updated
Dmitriy Geels (dmig)
description: updated
Revision history for this message
Dmitriy Geels (dmig) wrote :

How to check you have this issue:

1) get provided resume script, replace /usr/share/initramfs-tools/scripts/local-premount/resume with it
2) sudo update-initramfs -k $(uname -r) -u
3) sudo systemctl hibernate
4) edit grub menu entry, add 'debug' parameter to kernel command line, boot
5) look into /run/initramfs/initramfs.debug, if you see following lines, you have this issue:
+ /scripts/local-premount/resume
Success: Resume device: 'UUID=106238b0-707d-4422-866d-a7534da50702' ()
Failure: Failed to get /sys/class/block//dev major/minor

Revision history for this message
Dmitriy Geels (dmig) wrote :

Here is a fix for this bug. This makes hibernation functional for me.

Revision history for this message
Dmitriy Geels (dmig) wrote :

This bug is actually a regression. I remember hibernation was functional around a year ago in ubuntu 17.04 with any kernel, but at some point it became broken. Probably in 17.10.

tags: added: patch
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "init.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in initramfs-tools (Ubuntu):
status: New → Confirmed
tags: added: regression-release
Revision history for this message
Steve Smith (tarkasteve) wrote :

FWIW, installing initramfs-tools(-core) 0.132 from Debian buster/sid fixed this for me. Both direct download and a build from source worked.

Revision history for this message
amk (9-launchpad-mikus-sk) wrote :

Reached to this bug because of a similar issue we were able to resolve using information here.

In 18.10, at least in our case, the RESUME variable is set with partition device name, not UUID. Yet the identification failed, because the device is not a link and readlink ${resume} returns nothing (or invalid argument when invoked with -v).

Got things working by assigning $resume into $DEV directly. This could be more universal approach:

DEV=$(readlink ${resume})
DEV="${DEV:-$resume}"
DEV=/sys/class/block/${DEV##*/}/dev

Revision history for this message
Emiliano (retorquere) wrote :

@Dmitry where would I set this resume= parameter?

tags: added: rls-ee-incoming
Changed in initramfs-tools (Ubuntu):
assignee: nobody → Dimitri John Ledkov (xnox)
Benjamin Drung (bdrung)
Changed in initramfs-tools (Ubuntu):
importance: Undecided → Medium
Benjamin Drung (bdrung)
summary: - resume from hibernation broken when resume image is autodetected
+ resume from hibernation broken when resume image is autodetected (UUID=
+ syntax used)
Revision history for this message
Benjamin Drung (bdrung) wrote :

This bug will be fixed in the next initramfs-tools upload.

Changed in initramfs-tools (Ubuntu):
assignee: Dimitri John Ledkov (xnox) → Benjamin Drung (bdrung)
status: Confirmed → In Progress
Changed in initramfs-tools (Ubuntu Noble):
importance: Undecided → Medium
Benjamin Drung (bdrung)
Changed in initramfs-tools (Ubuntu):
status: In Progress → Fix Committed
Benjamin Drung (bdrung)
description: updated
tags: removed: rls-ee-incoming
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package initramfs-tools - 0.142ubuntu29

---------------
initramfs-tools (0.142ubuntu29) oracular; urgency=medium

  [ Jeffery To ]
  * Fix resume failure due to resume=UUID=... in certain cases (LP: #1769297)

  [ Benjamin Drung ]
  * resume: always write valid resume device to /sys/power/resume (LP: #1769297)
  * fsck: Mention file system name in failed identification warning
    (LP: #2068077)

 -- Benjamin Drung <email address hidden> Wed, 03 Jul 2024 13:55:55 +0200

Changed in initramfs-tools (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Chris Halse Rogers (raof) wrote : Please test proposed package

Hello Dmitriy, or anyone else affected,

Accepted initramfs-tools into noble-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/initramfs-tools/0.142ubuntu25.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-noble to verification-done-noble. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-noble. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in initramfs-tools (Ubuntu Noble):
status: New → Fix Committed
tags: added: verification-needed verification-needed-noble
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (initramfs-tools/0.142ubuntu25.2)

All autopkgtests for the newly accepted initramfs-tools (0.142ubuntu25.2) for noble have finished running.
The following regressions have been reported in tests triggered by the package:

cryptsetup/unknown (s390x)
initramfs-tools/0.142ubuntu25.2 (s390x)
initramfs-tools/unknown (ppc64el)
kdump-tools/unknown (ppc64el)
mandos/unknown (ppc64el)
multipath-tools/0.9.4-5ubuntu8 (s390x)
multipath-tools/unknown (ppc64el)
zfs-linux/unknown (ppc64el, s390x)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/noble/update_excuses.html#initramfs-tools

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

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

Jeffery To, may I ask you to test initramfs-tools 0.142ubuntu25.2 on noble? I has all the hibernation fixes that you developed included.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.