> But I wonder whether this configuration file is really needed for most
> system.  Couldn't we use blkid to find the swap partition automagically?
> (The configuration file would still be necessary if there are multiple
> swap partitions.)
Imagine the following: there is Debian on /dev/sda1, Debian on /dev/sda2 and 
swap on /dev/sda3.
Debian on sda2 configured to use sda3. Debian on sda1 doesn't use swap. Debian 
on sda2 suspends to sda3. Then user runs Debian on sda1.
Initramfs from sda1 looks at the sda3 and says: "Oh! There is swap. Let's wake 
up from it". And initramfs performs waking up from wrong partition.
So, don't search swap at the resume time.

> initramfs-tools has its own resume configuration file, but so far as I
> can see the uswsusp package does not use it. So there would be no
> reason for you to modify it - would there?
No, "resume" file is really used. It used by early userspace. I just created 
virtual machine with fresh jessie and without swap and performed the following 
test:
1. Installed uswsusp. uswsusp said to me that I have no swap and I should add 
it and run "dpkg-reconfigure uswsusp".
2. I added swap
3. Rebooted
4. I ran "dpkg-reconfigure uswsusp". uswsusp found my swap and it was happy. It 
asked me a lot of questions. Then uswsusp triggered initramfs rebuilding
5. Rebooted
6. I ran "s2disk" and I could not wake up. So, this is a bug.
7. I created "resume" file (there was no such file before) and I put 
"RESUME=UUID=..." to it.
8. I ran "s2disk" and it failed again (of course, because 
/etc/initramfs-tools/conf.d/resume alone is not enough, there should be 
/conf/conf.d/resume in initramfs).
9. I ran "dpkg-reconfigure uswsusp", it triggered initramfs (so, 
/conf/conf.d/resume was created)
10. I successfully performed "s2disk"

In fact, s2disk works (without manual editing configs) only if you created swap 
at installing of Debian.

> The uswsusp package can edit its own configuration file though I do not
> recommend it. I think it would be better to leave the resume device
> unspecified in /etc/uswsusp.conf by default, and then to select it
> automatically (both at suspend and resume time) if possible.
As I said, selecting automatically at resume time is bad idea.
At suspend time is probably, too, because two systems can have one swap.

Ideally, there should be some guarantee that if user didn't edit configs 
himself and it performed suspend then he guaranteed wakes up successfully.
Of course, such guarantee is very important because user can have a lot of 
opened programs, unsaved documents etc. Ideally, s2disk should perform some 
checks (for example, it can check configs) that all is OK, before doing real 
suspending.
If uswsusp detects swap automatically, then there was no such guarantee. For 
example, let's assume, uswsusp detects swap automatically, and let's assume 
this bug #632627 is fixed (i. e. "dpkg-reconfigure uswsusp" writes "resume"). 
User just added new swap and didn't run any "dpkg-reconfigure" yet. Then he ran 
"s2disk". "s2disk" detected his swap, suspended. And then this user cannot wake 
up, because "dpkg-reconfigure" is not done and "resume" is not written.

Askar Safin

Reply via email to