On Mon, 2013-07-29 at 13:26 +0400, Askar Safin wrote: > > 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.
In this case, sure, you wouldn't want that. But that kind of multiboot configuration is not the *usual* case. We should try to make the usual case 'just work' without disruption. > > 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. [...] I agree this is currently needed, although the value is not used. I assume this is done to allow overriding resume with the 'noresume' boot parameter. I think uswsusp should be properly integrated with initramfs-tools handling of boot parameters by making the following changes: 1. In the initramfs build hook, write this to $DESTDIR/conf/conf.d/resume-uswsusp: RESUME=$(sed -rn 's/^resume device[[:space:]]+[:=][[:space:]]+// p' /etc/uswsusp.conf) resume_offset=$(sed -rn 's/^resume offset[[:space:]]+[:=][[:space:]]+// p' /etc/uswsusp.conf) Since this file name sorts after 'resume', it overrides the swsusp configuration. But it can still be overridden by boot parameters. 2. In the initramfs local-premount hook, do: /sbin/resume -r "$resume" -o "${resume_offset:-0}" Ben. -- Ben Hutchings I say we take off; nuke the site from orbit. It's the only way to be sure.
signature.asc
Description: This is a digitally signed message part