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

2017-04-25 Thread Ben Hutchings
On Mon, 2017-04-24 at 09:27 +0200, Bjørn Mork wrote:
> Ben Hutchings  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.


signature.asc
Description: This is a digitally signed message part


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

2017-04-24 Thread Bjørn Mork
Ben Hutchings  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 
FilenameTypeSizeUsedPriority
/dev/nvme0n1p4  partition   164249561119612 
-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



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

2017-04-21 Thread Ben Hutchings
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:20  3,8G  0 part [SWAP]
> shambhala:~> LANG=C swapon -s
> FilenameTypeSizeUsed
> 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.



signature.asc
Description: This is a digitally signed message part


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

2017-04-21 Thread Michael Prokop
* 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-


signature.asc
Description: Digital signature


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

2017-04-21 Thread Martin Steigerwald
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:20  3,8G  0 part [SWAP]
shambhala:~> LANG=C swapon -s
FilenameTypeSizeUsed
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

signature.asc
Description: This is a digitally signed message part.


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

2017-04-20 Thread Ben Hutchings
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(-)



signature.asc
Description: Digital signature