Bug#944777: initramfs-tools-core: Resume fails when UUID= syntax used in conf.d/resume.
Package: initramfs-tools-core
Version: 0.130ubuntu3.9
Severity: normal
Tags: newcomer
Dear Maintainer,
Resume from hibernation will fail when /etc/initramfs-tools/conf.d/resume
contains "RESUME=UUID=<UUID of hibernation image>". According to NEWS this
should work. The reason is does not is because UUID= processing is only done
for the resume kernel parameter (see init lines 123-128). No processing is done
for the RESUME shell variable included from conf.d. Recognizing that
conf.d/resume is being sourced as a script in init, I've created a hack to fix
by adding the processing in the resume file. My resume file looks like this:
"""
RESUME=UUID=deadbeef-cafe-dead-beef-cafedeadbeef
case $RESUME in
UUID=*)
RESUME="/dev/disk/by-uuid/${RESUME#UUID=}"
esac
"""
Incidentally, I believe this is the issue in #872664. I chose to create a new
bug because that one is unnecessarily specific. The bug applies to all versions
on all platforms.
I suggest that the case be moved out of the resume= kernel param handling and
added just after line 206, before the "resume" variable is set. Actually, I see
no reason to use the RESUME variable aside from the fact that its what you're
supposed to use in the conf.d/resume file. But its confusing and inconsistent
to provide "resume=UUID=" as the kernel parameter and "RESUME=UUID=" in the
conf.d/resume file.
Attached is a patch exemplifying my proposed changes (not tested). The patch
should allow for documentation to notify about the depreciation of RESUME= in
conf.d/resume and to start using resume= instead, but to continue being
backwards compatible with the old syntax. The hooks scripts would need to be
updated to account for the new variable (pretty trivial change, something like
"RESUME=${RESUME:-$resume}").
Glenn
diff --git a/init b/init
index 1cc96c3..11788fb 100755
--- a/init
+++ b/init
@@ -121,11 +121,7 @@ for x in $(cat /proc/cmdline); do
UBIMTD=${x#ubi.mtd=}
;;
resume=*)
- RESUME="${x#resume=}"
- case $RESUME in
- UUID=*)
- RESUME="/dev/disk/by-uuid/${RESUME#UUID=}"
- esac
+ resume="${x#resume=}"
;;
resume_offset=*)
resume_offset="${x#resume_offset=}"
@@ -201,10 +197,15 @@ if [ -z "${BOOT}" ]; then
BOOT=local
fi
-if [ -n "${noresume}" ] || [ "$RESUME" = none ]; then
+if [ -n "${noresume}" ] || [ "${resume:-$RESUME}" = none ]; then
noresume=y
+ unset resume
else
- resume=${RESUME:-}
+ resume=${resume:-$RESUME}
+ case $resume in
+ UUID=*)
+ resume="/dev/disk/by-uuid/${resume#UUID=}"
+ esac
fi
mount -t tmpfs -o "nodev,noexec,nosuid,size=${RUNSIZE:-10%},mode=0755" tmpfs /run
Reply to: