resume from hibernation broken when resume image is autodetected

Bug #1769297 reported by Dmitriy Geels
62
This bug affects 10 people
Affects Status Importance Assigned to Milestone
initramfs-tools (Ubuntu)
Confirmed
Undecided
Dimitri John Ledkov

Bug Description

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.

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)

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)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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