Hi,

I got bitten by this bug as well, similarly to Michael Conner above:
I installed uswsusp to be able to hibernate/resume.
s2disk worked flawlessly, but on booting the system simply did not
bother to resume, booting normally instead.

My analysis:

After digging through the initramfs scripts, I discovered that this is
because on booting resume is only triggered if $resume is set.

As far as I understand, the initramfs takes $resume from the kernel
command line (if set), and from /etc/initramfs-tools/conf.d/resume
otherwise.

In my case /etc/initramfs-tools/conf.d/resume did not exist.
It should have been created by the preinst of initramfs-tools; however
the preinst ( /var/lib/dpkg/info/initramfs-tools.preinst ) uses vol_id:
---snip----
                # First time install.  Can we autodetect the RESUME partition?
                if [ -r /proc/swaps ]; then
                        RESUME=$(tail -n $(($(wc -l /proc/swaps | awk ' { print 
$1 } ') - 1)) /proc/swaps | sort -rk3 | head -n 1 | awk ' { print $1 } ')
                        if command -v vol_id >/dev/null 2>&1; then
                                UUID=$(vol_id -u "$RESUME" || true)
                        elif [ -x /lib/udev/vol_id ]; then
                                UUID=$(/lib/udev/vol_id -u "$RESUME" || true)
                        fi
                        if [ -n "$UUID" ]; then
                                RESUME="UUID=$UUID"
                        fi
                fi
---snap---

This will always fail, because vol_id is no longer part of Debian (it was
removed from udev for version 146-1, see 
/usr/share/doc/udev/changelog.Debian.gz ).

In summary:

* Resume from hibernation will only work if /etc/initramfs-tools/conf.d/resume
  sets RESUME
* However, there is no (working) code to write
  /etc/initramfs-tools/conf.d/resume, and no documentation explaining that it
  needs to be set manually to make resume work

Thus, resume will probably fail to work in most cases.

I believe there are actually several bugs here:

1) The code in the preinst of initramfs-tools to detect the swap partition does
   not work, because it uses vol_id.
2) Even if 1) were fixed, there may be cases where the swap partition is
   incorrectly detected at installation time, or later changes. So fixing
   preinst is not enough.
   I agree with bug submitter jidanni that the swap partition should be detected
   when building the initramfs, not during preinst.
3) Additionally, I don't quite understand why uswsusp refuses to resume if
   $resume is not set (in 
/usr/share/initramfs-tools/scripts/local-premount/uswsusp ). 
   The script does not actually use the value of $resume, it just aborts if it 
is not set :-(.
   I guess this could be considered a bug in uswsusp; I can report it against
   uswsusp if discussion of this bug indicates that this makes sense.


To fix this, I would propose the following:

* Drop the code in initramfs-tools.preinst which tries to write RESUME to
  /etc/initramfs-tools/conf.d/resume , which does not work anyway.
* Document (e.g. in /usr/share/doc/initramfs-tools/README.Debian ) that
  /etc/initramfs-tools/conf.d/resume can be used to set the resume device.
* When building the initramfs, use the value from 
/etc/initramfs-tools/conf.d/resume
  if it exists; otherwise try to find it yourself:
  - if /etc/uswsusp.conf exists, it probably makes sense to read it ("resume 
device =")
  - otherwise grab the current swap device (the "config" script from uswsusp
    already has code for that)
  This is still problematic if there is >1 swap device. Even better probably
  would be to use debconf to prompt for the resume device, if this is 
practical...

I am willing to help implement / test this, but first I'll wait for some
feedback if I'm even on the right track :-).

Greetings,

S.Leske



-- 
To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20101129003821.gb15...@localhost

Reply via email to