Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.kernel > #57615 > unrolled thread

[PATCH initramfs-tools 0/9] Fix resume device configuration

Started byBen Hutchings <ben@decadent.org.uk>
First post2017-04-21 05:40 +0200
Last post2017-04-26 05:40 +0200
Articles 14 — 4 participants

Back to article view | Back to linux.debian.kernel


Contents

  [PATCH initramfs-tools 0/9] Fix resume device configuration Ben Hutchings <ben@decadent.org.uk> - 2017-04-21 05:40 +0200
    [PATCH initramfs-tools 1/9] hooks/resume: Use correct sort options  to select the biggest swap partition Ben Hutchings <ben@decadent.org.uk> - 2017-04-21 05:40 +0200
    [PATCH initramfs-tools 3/9] Support setting of RESUME in  initramfs.conf or anywhere in conf.d/ Ben Hutchings <ben@decadent.org.uk> - 2017-04-21 05:40 +0200
    [PATCH initramfs-tools 6/9] Allow disabling resume from disk at  build time by setting RESUME=none Ben Hutchings <ben@decadent.org.uk> - 2017-04-21 05:40 +0200
    [PATCH initramfs-tools 5/9] hooks/resume: Check for chroot earlier Ben Hutchings <ben@decadent.org.uk> - 2017-04-21 05:40 +0200
    [PATCH initramfs-tools 9/9] NEWS: Add entry explaining the need for  RESUME=none on some systems Ben Hutchings <ben@decadent.org.uk> - 2017-04-21 05:40 +0200
    [PATCH initramfs-tools 2/9] initramfs.conf(5): Clean up split  between general and NFS variables Ben Hutchings <ben@decadent.org.uk> - 2017-04-21 05:40 +0200
    [PATCH initramfs-tools 7/9] Support requesting automatic selection  of resume device with RESUME=auto Ben Hutchings <ben@decadent.org.uk> - 2017-04-21 05:40 +0200
    [PATCH initramfs-tools 8/9] hooks/resume: Report when we might be  doing something surprising Ben Hutchings <ben@decadent.org.uk> - 2017-04-21 05:40 +0200
    Re: [PATCH initramfs-tools 0/9] Fix resume device configuration Martin Steigerwald <martin@lichtvoll.de> - 2017-04-21 11:10 +0200
      Re: [PATCH initramfs-tools 0/9] Fix resume device configuration Ben Hutchings <ben@decadent.org.uk> - 2017-04-21 17:20 +0200
    Re: [PATCH initramfs-tools 0/9] Fix resume device configuration Michael Prokop <mika@debian.org> - 2017-04-21 14:30 +0200
    Re: [PATCH initramfs-tools 0/9] Fix resume device configuration Bjørn Mork <bjorn@mork.no> - 2017-04-24 09:50 +0200
      Re: [PATCH initramfs-tools 0/9] Fix resume device configuration Ben Hutchings <ben@decadent.org.uk> - 2017-04-26 05:40 +0200

#57615 — [PATCH initramfs-tools 0/9] Fix resume device configuration

FromBen Hutchings <ben@decadent.org.uk>
Date2017-04-21 05:40 +0200
Subject[PATCH initramfs-tools 0/9] Fix resume device configuration
Message-ID<tyxAm-Ku-1@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

The change in version 0.128 to wait for the resume device to appear
uncovered a number of systems for which the resume device is not
properly configured.  In fact, systems with swap partitions that
are never available at boot could not be configured correctly,
other than by adding 'noresume' to the kernel command line!

While working on that, I found and fixed a couple of other
longstanding bugs in resume device selection.

This patch series:

- Fixes the sorting of swap partitions
- Makes the RESUME variable work like every other configuration
  variable, and documents it
- Adds support for RESUME=none (disable resume) and RESUME=auto
  (explicitly request automatic selection)
- Adds warning and informational messages where the resume device
  configuration is automatically fixed-up

I'm stil not entirely happy with the automatic resume device
selection.  I would prefer to read the kernel's selection from
/sys/power/resume, but I found experimentally that this isn't set on a
fresh boot under older kernel versions.  Secondly I would like to
automatically filter out device types that we know won't be
available at boot (e.g. zram).  But I think this may have to do.

If no-one finds issues with this these changes then I'm hoping
to make one more release for "stretch" with just these.

Ben.

Ben Hutchings (9):
  hooks/resume: Use correct sort options to select the biggest swap
    partition
  initramfs.conf(5): Clean up split between general and NFS variables
  Support setting of RESUME in initramfs.conf or anywhere in conf.d/
  initramfs.conf(5): Document the RESUME variable
  hooks/resume: Check for chroot earlier
  Allow disabling resume from disk at build time by setting RESUME=none
  Support requesting automatic selection of resume device with
    RESUME=auto
  hooks/resume: Report when we might be doing something surprising
  NEWS: Add entry explaining the need for RESUME=none on some systems

 debian/NEWS      | 21 +++++++++++++++++++++
 hooks/resume     | 54 ++++++++++++++++++++++++++++++++++++------------------
 init             |  4 ++--
 initramfs.conf.5 | 12 +++++++++++-
 mkinitramfs      |  1 +
 5 files changed, 71 insertions(+), 21 deletions(-)

[toc] | [next] | [standalone]


#57616 — [PATCH initramfs-tools 1/9] hooks/resume: Use correct sort options to select the biggest swap partition

FromBen Hutchings <ben@decadent.org.uk>
Date2017-04-21 05:40 +0200
Subject[PATCH initramfs-tools 1/9] hooks/resume: Use correct sort options to select the biggest swap partition
Message-ID<tyxAm-Ku-7@gated-at.bofh.it>
In reply to#57615

[Multipart message — attachments visible in raw view] — view raw

We need a reverse *numeric* sort.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 hooks/resume | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hooks/resume b/hooks/resume
index 657775e4a465..c43badd03f71 100755
--- a/hooks/resume
+++ b/hooks/resume
@@ -29,7 +29,7 @@ if [ ! -r /proc/swaps ]; then
 fi
 
 # Try to autodetect the RESUME partition, using biggest swap?
-RESUME=$(grep ^/dev/ /proc/swaps | sort -rk3 | head -n 1 | cut -d " " -f 1)
+RESUME=$(grep ^/dev/ /proc/swaps | sort -rnk3 | head -n 1 | cut -d " " -f 1)
 if [ -n "$RESUME" ]; then
 	UUID=$(blkid -s UUID -o value "$RESUME" || true)
 	if [ -n "$UUID" ]; then

[toc] | [prev] | [next] | [standalone]


#57617 — [PATCH initramfs-tools 3/9] Support setting of RESUME in initramfs.conf or anywhere in conf.d/

FromBen Hutchings <ben@decadent.org.uk>
Date2017-04-21 05:40 +0200
Subject[PATCH initramfs-tools 3/9] Support setting of RESUME in initramfs.conf or anywhere in conf.d/
Message-ID<tyxAm-Ku-11@gated-at.bofh.it>
In reply to#57615

[Multipart message — attachments visible in raw view] — view raw

Currently hooks/resume only reads /etc/initramfs-tools/conf.d/resume,
whereas at boot time it can be set by any configuration file.
Instead, export RESUME from mkinitramfs, which reads all the
configuration files.

When writing an auto-selected resume device, use a filename that
should sort later than user configuration files (zz-resume-auto).

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 hooks/resume | 6 ++----
 mkinitramfs  | 1 +
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/hooks/resume b/hooks/resume
index c43badd03f71..d5a987602787 100755
--- a/hooks/resume
+++ b/hooks/resume
@@ -16,8 +16,6 @@ prereqs)
 esac
 
 # First check if a location is set and is a valid swap partition
-test -r /etc/initramfs-tools/conf.d/resume \
-	&& . /etc/initramfs-tools/conf.d/resume
 if [ -n "$RESUME" ] && blkid -p -n swap $RESUME >/dev/null 2>&1; then
 	# As mkinitramfs copies the config file nothing to do.
 	exit 0
@@ -37,7 +35,7 @@ if [ -n "$RESUME" ]; then
 	fi
 fi
 
-# Write detected resume to intramfs conf.d/resume if not in a chroot
+# Write detected resume to intramfs conf.d if not in a chroot
 if [ -n "${RESUME}" ] && ! ischroot; then
-	echo "RESUME=${RESUME}" > ${DESTDIR}/conf/conf.d/resume
+	echo "RESUME=${RESUME}" > ${DESTDIR}/conf/conf.d/zz-resume-auto
 fi
diff --git a/mkinitramfs b/mkinitramfs
index 9f207a0a00df..24715d5e5287 100755
--- a/mkinitramfs
+++ b/mkinitramfs
@@ -205,6 +205,7 @@ export verbose
 export KEYMAP
 export MODULES
 export BUSYBOX
+export RESUME
 
 # Private, used by 'catenate_cpiogz'.
 export __TMPCPIOGZ

[toc] | [prev] | [next] | [standalone]


#57618 — [PATCH initramfs-tools 6/9] Allow disabling resume from disk at build time by setting RESUME=none

FromBen Hutchings <ben@decadent.org.uk>
Date2017-04-21 05:40 +0200
Subject[PATCH initramfs-tools 6/9] Allow disabling resume from disk at build time by setting RESUME=none
Message-ID<tyxAm-Ku-9@gated-at.bofh.it>
In reply to#57615

[Multipart message — attachments visible in raw view] — view raw

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 hooks/resume     | 3 ++-
 init             | 4 ++--
 initramfs.conf.5 | 1 +
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/hooks/resume b/hooks/resume
index e8a49124c3f9..3e3f6dbbc3b6 100755
--- a/hooks/resume
+++ b/hooks/resume
@@ -16,7 +16,8 @@ prereqs)
 esac
 
 # First check if a location is set and is a valid swap partition
-if [ -n "$RESUME" ] && blkid -p -n swap $RESUME >/dev/null 2>&1; then
+if [ -n "$RESUME" ] && \
+   { [ "$RESUME" = none ] || blkid -p -n swap $RESUME >/dev/null 2>&1; }; then
 	# As mkinitramfs copies the config file nothing to do.
 	exit 0
 fi
diff --git a/init b/init
index 9552e5cab9c0..1334dca6a99d 100755
--- a/init
+++ b/init
@@ -189,8 +189,8 @@ if [ -z "${BOOT}" ]; then
 	BOOT=local
 fi
 
-if [ -n "${noresume}" ]; then
-	export noresume
+if [ -n "${noresume}" ] || [ "$RESUME" = none ]; then
+	export noresume=y
 	unset resume
 else
 	resume=${RESUME:-}
diff --git a/initramfs.conf.5 b/initramfs.conf.5
index 4d142dd0950a..c0d778ca1928 100644
--- a/initramfs.conf.5
+++ b/initramfs.conf.5
@@ -81,6 +81,7 @@ Specifies the device used for suspend-to-disk (hibernation), which the
 initramfs code should attempt to resume from.  If this is not defined,
 .B mkinitramfs
 will automatically select the largest available swap partition.
+Set it to \fInone\fP to disable resume from disk.
 
 .SH VARIABLES FOR NFS BOOT
 .TP

[toc] | [prev] | [next] | [standalone]


#57619 — [PATCH initramfs-tools 5/9] hooks/resume: Check for chroot earlier

FromBen Hutchings <ben@decadent.org.uk>
Date2017-04-21 05:40 +0200
Subject[PATCH initramfs-tools 5/9] hooks/resume: Check for chroot earlier
Message-ID<tyxAm-Ku-13@gated-at.bofh.it>
In reply to#57615

[Multipart message — attachments visible in raw view] — view raw

Avoid doing unnecessary work.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 hooks/resume | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/hooks/resume b/hooks/resume
index d5a987602787..e8a49124c3f9 100755
--- a/hooks/resume
+++ b/hooks/resume
@@ -22,20 +22,17 @@ if [ -n "$RESUME" ] && blkid -p -n swap $RESUME >/dev/null 2>&1; then
 fi
 
 # We need to be able to read the listed swap partitions
-if [ ! -r /proc/swaps ]; then
+if ischroot || [ ! -r /proc/swaps ]; then
 	exit 0
 fi
 
 # Try to autodetect the RESUME partition, using biggest swap?
+# Write detected resume to intramfs conf.d
 RESUME=$(grep ^/dev/ /proc/swaps | sort -rnk3 | head -n 1 | cut -d " " -f 1)
 if [ -n "$RESUME" ]; then
 	UUID=$(blkid -s UUID -o value "$RESUME" || true)
 	if [ -n "$UUID" ]; then
 			RESUME="UUID=$UUID"
 	fi
-fi
-
-# Write detected resume to intramfs conf.d if not in a chroot
-if [ -n "${RESUME}" ] && ! ischroot; then
 	echo "RESUME=${RESUME}" > ${DESTDIR}/conf/conf.d/zz-resume-auto
 fi

[toc] | [prev] | [next] | [standalone]


#57620 — [PATCH initramfs-tools 9/9] NEWS: Add entry explaining the need for RESUME=none on some systems

FromBen Hutchings <ben@decadent.org.uk>
Date2017-04-21 05:40 +0200
Subject[PATCH initramfs-tools 9/9] NEWS: Add entry explaining the need for RESUME=none on some systems
Message-ID<tyxAm-Ku-17@gated-at.bofh.it>
In reply to#57615

[Multipart message — attachments visible in raw view] — view raw

Closes: #860403
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 debian/NEWS | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/debian/NEWS b/debian/NEWS
index e862c6144ba9..78a0c6856edc 100644
--- a/debian/NEWS
+++ b/debian/NEWS
@@ -1,3 +1,24 @@
+initramfs-tools (0.129) unstable; urgency=medium
+
+  * Some systems that do not support suspend-to-disk (hibernation) will
+    require a configuration change to explicitly disable this.
+
+    From version 0.128, the boot code waits for a suspend/resume device
+    to appear, rather than checking just once.  If the configured or
+    automatically selected resume device is not available at boot time,
+    this results in a roughly 30 second delay.
+
+    You should set the RESUME variable in
+    /etc/initramfs-tools/conf.d/resume or
+    /etc/initramfs-tools/initramfs.conf to one of:
+
+    - auto - select the resume device automatically
+    - none - disable use of a resume device
+    - UUID=<uuid> - use a specific resume device (by UUID)
+    - /dev/<name> - use a specific resume device (by kernel name)
+
+ -- Ben Hutchings <ben@decadent.org.uk>  Thu, 20 Apr 2017 23:21:32 +0100
+
 initramfs-tools (0.121~rc1) unstable; urgency=medium
 
   * If initramfs-tools is configured to use busybox but it is not

[toc] | [prev] | [next] | [standalone]


#57621 — [PATCH initramfs-tools 2/9] initramfs.conf(5): Clean up split between general and NFS variables

FromBen Hutchings <ben@decadent.org.uk>
Date2017-04-21 05:40 +0200
Subject[PATCH initramfs-tools 2/9] initramfs.conf(5): Clean up split between general and NFS variables
Message-ID<tyxAm-Ku-19@gated-at.bofh.it>
In reply to#57615

[Multipart message — attachments visible in raw view] — view raw

The BOOT variable selects between local and NFS mode, so it's not
really an NFS-specific variable.

Also reword the section heading.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 initramfs.conf.5 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/initramfs.conf.5 b/initramfs.conf.5
index 7eee859897bf..184001ca98c2 100644
--- a/initramfs.conf.5
+++ b/initramfs.conf.5
@@ -68,13 +68,13 @@ corresponding userspace utility is not present.
 Set the umask value of the generated initramfs file.
 Useful to not disclose eventual keys.
 
-.SH NFS VARIABLES
 .TP
 \fB BOOT
 Allows one to use an nfs drive as the root of the drive.
 The default is to boot from \fIlocal\fP media (hard drive, USB stick).
 Set to \fInfs\fP for an NFS root share.
 
+.SH VARIABLES FOR NFS BOOT
 .TP
 \fB DEVICE
 Specifies the network interface, like eth0.

[toc] | [prev] | [next] | [standalone]


#57622 — [PATCH initramfs-tools 7/9] Support requesting automatic selection of resume device with RESUME=auto

FromBen Hutchings <ben@decadent.org.uk>
Date2017-04-21 05:40 +0200
Subject[PATCH initramfs-tools 7/9] Support requesting automatic selection of resume device with RESUME=auto
Message-ID<tyxAm-Ku-21@gated-at.bofh.it>
In reply to#57615

[Multipart message — attachments visible in raw view] — view raw

For now, this is effectively the same as setting RESUME to empty or
not setting it.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 hooks/resume     | 25 ++++++++++++++-----------
 initramfs.conf.5 |  3 ++-
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/hooks/resume b/hooks/resume
index 3e3f6dbbc3b6..43eb146b1f42 100755
--- a/hooks/resume
+++ b/hooks/resume
@@ -16,7 +16,7 @@ prereqs)
 esac
 
 # First check if a location is set and is a valid swap partition
-if [ -n "$RESUME" ] && \
+if [ -n "$RESUME" ] && [ "$RESUME" != auto ] && \
    { [ "$RESUME" = none ] || blkid -p -n swap $RESUME >/dev/null 2>&1; }; then
 	# As mkinitramfs copies the config file nothing to do.
 	exit 0
@@ -24,16 +24,19 @@ fi
 
 # We need to be able to read the listed swap partitions
 if ischroot || [ ! -r /proc/swaps ]; then
-	exit 0
+	resume_auto=
+else
+	# Try to autodetect the RESUME partition, using biggest swap?
+	resume_auto=$(grep ^/dev/ /proc/swaps | sort -rnk3 | head -n 1 | cut -d " " -f 1)
+	if [ -n "$resume_auto" ]; then
+		UUID=$(blkid -s UUID -o value "$resume_auto" || true)
+		if [ -n "$UUID" ]; then
+			resume_auto="UUID=$UUID"
+		fi
+	fi
 fi
 
-# Try to autodetect the RESUME partition, using biggest swap?
-# Write detected resume to intramfs conf.d
-RESUME=$(grep ^/dev/ /proc/swaps | sort -rnk3 | head -n 1 | cut -d " " -f 1)
-if [ -n "$RESUME" ]; then
-	UUID=$(blkid -s UUID -o value "$RESUME" || true)
-	if [ -n "$UUID" ]; then
-			RESUME="UUID=$UUID"
-	fi
-	echo "RESUME=${RESUME}" > ${DESTDIR}/conf/conf.d/zz-resume-auto
+# Write selected resume device to intramfs conf.d
+if [ "$RESUME" = auto ] || [ -n "$resume_auto" ]; then
+	echo "RESUME=${resume_auto}" > ${DESTDIR}/conf/conf.d/zz-resume-auto
 fi
diff --git a/initramfs.conf.5 b/initramfs.conf.5
index c0d778ca1928..b4eea705016f 100644
--- a/initramfs.conf.5
+++ b/initramfs.conf.5
@@ -78,7 +78,8 @@ Set to \fInfs\fP for an NFS root share.
 .TP
 \fB RESUME
 Specifies the device used for suspend-to-disk (hibernation), which the
-initramfs code should attempt to resume from.  If this is not defined,
+initramfs code should attempt to resume from.  If this is not defined
+or is set to \fIauto\fP,
 .B mkinitramfs
 will automatically select the largest available swap partition.
 Set it to \fInone\fP to disable resume from disk.

[toc] | [prev] | [next] | [standalone]


#57623 — [PATCH initramfs-tools 8/9] hooks/resume: Report when we might be doing something surprising

FromBen Hutchings <ben@decadent.org.uk>
Date2017-04-21 05:40 +0200
Subject[PATCH initramfs-tools 8/9] hooks/resume: Report when we might be doing something surprising
Message-ID<tyxAn-Ku-23@gated-at.bofh.it>
In reply to#57615

[Multipart message — attachments visible in raw view] — view raw

Some systems have swap devices that aren't available at boot, but are
still selected as resume devices.  There used to be no way to disable
this at build time, but it also used to be quite harmless.  Now that
we wait for the resume device to appear, this is a real problem and
users of such systems will need to set RESUME=none.  Therefore:

- If RESUME is invalid, warn about this
- If RESUME is unset or invalid, and we automatically set a resume device,
  report this

Also:

- If RESUME=auto and we we fail to select a resume device, warn about
  this

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
 hooks/resume | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/hooks/resume b/hooks/resume
index 43eb146b1f42..06ff62af3f3c 100755
--- a/hooks/resume
+++ b/hooks/resume
@@ -16,12 +16,23 @@ prereqs)
 esac
 
 # First check if a location is set and is a valid swap partition
-if [ -n "$RESUME" ] && [ "$RESUME" != auto ] && \
-   { [ "$RESUME" = none ] || blkid -p -n swap $RESUME >/dev/null 2>&1; }; then
-	# As mkinitramfs copies the config file nothing to do.
-	exit 0
+if [ -n "$RESUME" ] && [ "$RESUME" != auto ]; then
+	if [ "$RESUME" = none ] || blkid -p -n swap $RESUME >/dev/null 2>&1; then
+		# As mkinitramfs copies the config file nothing to do.
+		exit 0
+	fi
+
+	echo >&2 "W: initramfs-tools configuration sets RESUME=$RESUME"
+	echo >&2 "W: but no matching swap device is available."
 fi
 
+# If we were not explicitly requested to select a device, report that we
+# are doing so
+report_auto()
+{
+	test "$RESUME" = auto || echo >&2 "I: $*"
+}
+
 # We need to be able to read the listed swap partitions
 if ischroot || [ ! -r /proc/swaps ]; then
 	resume_auto=
@@ -30,13 +41,21 @@ else
 	resume_auto=$(grep ^/dev/ /proc/swaps | sort -rnk3 | head -n 1 | cut -d " " -f 1)
 	if [ -n "$resume_auto" ]; then
 		UUID=$(blkid -s UUID -o value "$resume_auto" || true)
+		report_auto "The initramfs will attempt to resume from $resume_auto"
 		if [ -n "$UUID" ]; then
+			report_auto "(UUID=$UUID)"
 			resume_auto="UUID=$UUID"
 		fi
+		report_auto "Set the RESUME variable to override this."
 	fi
 fi
 
 # Write selected resume device to intramfs conf.d
 if [ "$RESUME" = auto ] || [ -n "$resume_auto" ]; then
+	# If we were explicitly requested to select a device, and we failed,
+	# report that
+	if [ -z "$resume_auto" ]; then
+		echo >&2 "W: initramfs-tools failed to select a resume device"
+	fi
 	echo "RESUME=${resume_auto}" > ${DESTDIR}/conf/conf.d/zz-resume-auto
 fi

[toc] | [prev] | [next] | [standalone]


#57624

FromMartin Steigerwald <martin@lichtvoll.de>
Date2017-04-21 11:10 +0200
Message-ID<tyCJI-3ZL-15@gated-at.bofh.it>
In reply to#57615

[Multipart message — attachments visible in raw view] — view raw

Dear Ben.

Ben Hutchings - 21.04.17, 04:33:
> The change in version 0.128 to wait for the resume device to appear
> uncovered a number of systems for which the resume device is not
> properly configured.  In fact, systems with swap partitions that
> are never available at boot could not be configured correctly,
> other than by adding 'noresume' to the kernel command line!
> 
> While working on that, I found and fixed a couple of other
> longstanding bugs in resume device selection.
> 
> This patch series:
> 
> - Fixes the sorting of swap partitions
> - Makes the RESUME variable work like every other configuration
>   variable, and documents it
> - Adds support for RESUME=none (disable resume) and RESUME=auto
>   (explicitly request automatic selection)
> - Adds warning and informational messages where the resume device
>   configuration is automatically fixed-up

Thats interesting. I have an old ThinkPad T42 above my hi-fi equipment as a 
media player and it stopped resuming from hibernation after some update quite 
some time ago.  But instead it just boots as if there would be no hibernation 
image. On hibernation it actually does write the hibernation image – I use in 
kernel hibernation, not userspace software suspend, but I think I tried using 
that one as well. Currently I don´t have uswsusp installed, but pm-utils is 
still there. I am not sure whether systemd uses it or does it all by itself 
tough. I configured in-kernel suspend there as well:

shambhala:/etc/pm> cat ./config.d/sleepmodule.conf
SLEEP_MODULE=kernel

Currently initramfs-tools is at 0.127 on this not so regularily updated 
laptop.


I never managed to get around actually looking whats going on here, but I now 
found that I do not have any resume setting in

shambhala:/etc/initramfs-tools> grep -ir "RESUME" .
shambhala:/etc/initramfs-tools#1>

Instead I have it here:

shambhala:/etc/default> grep -i resume grub
GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/sda2 init=/bin/systemd"


shambhala:~> swapon -s
Dateiname                               Typ             Größe   Benutzt 
Priorität
/dev/sda2                               partition       4000180 0       -1

shambhala:~> lsblk /dev/sda2
NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda2   8:2    0  3,8G  0 part [SWAP]
shambhala:~> LANG=C swapon -s
Filename                                Type            Size    Used    
Priority
/dev/sda2                               partition       4000180 0       -1


Okay, I will upgrade to the new initramfs-tools and look whether it fixes the 
issue. If not, I may try setting RESUME var to first "auto" and if not working 
still then the device in question to see whether that helps. I welcome any 
other ideas and I am willing to report back what I find.

Ciao,
-- 
Martin

[toc] | [prev] | [next] | [standalone]


#57630

FromBen Hutchings <ben@decadent.org.uk>
Date2017-04-21 17:20 +0200
Message-ID<tyIvM-7o5-5@gated-at.bofh.it>
In reply to#57624

[Multipart message — attachments visible in raw view] — view raw

On Fri, 2017-04-21 at 11:02 +0200, Martin Steigerwald wrote:
[...]
> Currently I don´t have uswsusp installed, but pm-utils is 
> still there. I am not sure whether systemd uses it or does it all by itself 
> tough.

I think 'systemctl hibernate' invokes in-kernel swsusp by default.  I
don't know what pm-utils does.

[...]
> I never managed to get around actually looking whats going on here, but I now 
> found that I do not have any resume setting in
> 
> shambhala:/etc/initramfs-tools> grep -ir "RESUME" .
> shambhala:/etc/initramfs-tools#1>

So initramfs-tools will automatically select a swap partition and put
its UUID in the initramfs...

> Instead I have it here:
> 
> shambhala:/etc/default> grep -i resume grub
> GRUB_CMDLINE_LINUX_DEFAULT="resume=/dev/sda2 init=/bin/systemd"

...but the command line parameter overrides that configuration, anyway.

> shambhala:~> swapon -s
> Dateiname                               Typ             Größe   Benutzt 
> Priorität
> /dev/sda2                               partition       4000180 0       -1
> 
> shambhala:~> lsblk /dev/sda2
> NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
> sda2   8:2    0  3,8G  0 part [SWAP]
> shambhala:~> LANG=C swapon -s
> Filename                                Type            Size    Used    
> Priority
> /dev/sda2                               partition       4000180 0       -1
> 
> 
> Okay, I will upgrade to the new initramfs-tools and look whether it fixes the 
> issue.

I think that the changes in 0.128 - to wait for the resume device to
appear - may fix this problem.  The changes I've posted here shouldn't
make any difference for your configuration.

> If not, I may try setting RESUME var to first "auto" and if not working 
> still then the device in question to see whether that helps. I welcome any 
> other ideas and I am willing to report back what I find.

RESUME=auto isn't supported in a released version.

Ben.

-- 
Ben Hutchings
I'm not a reverse psychological virus.  Please don't copy me into your
sig.

[toc] | [prev] | [next] | [standalone]


#57627

FromMichael Prokop <mika@debian.org>
Date2017-04-21 14:30 +0200
Message-ID<tyFRg-5KO-17@gated-at.bofh.it>
In reply to#57615

[Multipart message — attachments visible in raw view] — view raw

* Ben Hutchings [Fri Apr 21, 2017 at 04:33:09AM +0100]:

> The change in version 0.128 to wait for the resume device to appear
> uncovered a number of systems for which the resume device is not
> properly configured.  In fact, systems with swap partitions that
> are never available at boot could not be configured correctly,
> other than by adding 'noresume' to the kernel command line!

> While working on that, I found and fixed a couple of other
> longstanding bugs in resume device selection.
[...]
> If no-one finds issues with this these changes then I'm hoping
> to make one more release for "stretch" with just these.

The changes LGTM (I didn't test/verify them though).
Thanks, Ben.

regards,
-mika-

[toc] | [prev] | [next] | [standalone]


#57653

FromBjørn Mork <bjorn@mork.no>
Date2017-04-24 09:50 +0200
Message-ID<tzGUV-48t-3@gated-at.bofh.it>
In reply to#57615
Ben Hutchings <ben@decadent.org.uk> writes:

> The change in version 0.128 to wait for the resume device to appear
> uncovered a number of systems for which the resume device is not
> properly configured.  In fact, systems with swap partitions that
> are never available at boot could not be configured correctly,
> other than by adding 'noresume' to the kernel command line!
>
> While working on that, I found and fixed a couple of other
> longstanding bugs in resume device selection.
>
> This patch series:
>
> - Fixes the sorting of swap partitions
> - Makes the RESUME variable work like every other configuration
>   variable, and documents it
> - Adds support for RESUME=none (disable resume) and RESUME=auto
>   (explicitly request automatic selection)
> - Adds warning and informational messages where the resume device
>   configuration is automatically fixed-up

Hmm, I got this warning, which seems harmless but unexpected:

Processing triggers for initramfs-tools (0.129) ...
update-initramfs: Generating /boot/initrd.img-4.9.0-2-amd64
W: initramfs-tools configuration sets RESUME=UUID=30db89e8-91f2-44ee-a8fa-61e5855ead41
W: but no matching swap device is available.
I: The initramfs will attempt to resume from /dev/nvme0n1p4
I: (UUID=30db89e8-91f2-44ee-a8fa-61e5855ead41)
I: Set the RESUME variable to override this.



My swap/resume settings are:


bjorn@miraculix:~$ cat /proc/swaps 
Filename                                Type            Size    Used    Priority
/dev/nvme0n1p4                          partition       16424956        1119612 -1
bjorn@miraculix:~$ cat /etc/initramfs-tools/conf.d/resume 
RESUME=UUID=30db89e8-91f2-44ee-a8fa-61e5855ead41
bjorn@miraculix:~$ file -s /dev/nvme0n1p4
/dev/nvme0n1p4: no read permission
bjorn@miraculix:~$ ls -l /dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 15 Mar 23 19:22 30db89e8-91f2-44ee-a8fa-61e5855ead41 -> ../../nvme0n1p4
lrwxrwxrwx 1 root root 15 Mar 23 19:22 71507198-90f4-4c25-be41-efc47d2dedd1 -> ../../nvme0n1p3
lrwxrwxrwx 1 root root 15 Mar 23 19:22 DA5D-17DD -> ../../nvme0n1p1



Bjørn

[toc] | [prev] | [next] | [standalone]


#57683

FromBen Hutchings <ben@decadent.org.uk>
Date2017-04-26 05:40 +0200
Message-ID<tAlY5-5aN-5@gated-at.bofh.it>
In reply to#57653

[Multipart message — attachments visible in raw view] — view raw

On Mon, 2017-04-24 at 09:27 +0200, Bjørn Mork wrote:
> Ben Hutchings <ben@decadent.org.uk> writes:
> 
> > The change in version 0.128 to wait for the resume device to appear
> > uncovered a number of systems for which the resume device is not
> > properly configured.  In fact, systems with swap partitions that
> > are never available at boot could not be configured correctly,
> > other than by adding 'noresume' to the kernel command line!
> > 
> > While working on that, I found and fixed a couple of other
> > longstanding bugs in resume device selection.
> > 
> > This patch series:
> > 
> > - Fixes the sorting of swap partitions
> > - Makes the RESUME variable work like every other configuration
> >   variable, and documents it
> > - Adds support for RESUME=none (disable resume) and RESUME=auto
> >   (explicitly request automatic selection)
> > - Adds warning and informational messages where the resume device
> >   configuration is automatically fixed-up
> 
> Hmm, I got this warning, which seems harmless but unexpected:
> 
> Processing triggers for initramfs-tools (0.129) ...
> update-initramfs: Generating /boot/initrd.img-4.9.0-2-amd64
> W: initramfs-tools configuration sets RESUME=UUID=30db89e8-91f2-44ee-
> a8fa-61e5855ead41
> W: but no matching swap device is available.
> I: The initramfs will attempt to resume from /dev/nvme0n1p4
> I: (UUID=30db89e8-91f2-44ee-a8fa-61e5855ead41)
> I: Set the RESUME variable to override this.
[...]

This is bug #861057 which should be fixed now.

Ben.

-- 
Ben Hutchings
All extremists should be taken out and shot.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.kernel


csiph-web