Enhance genkernel's linuxrc to support suspend2. Checking for /proc/suspend2/do_resume and echoing to it if it exists should not hurt anyone. Sample: # activate suspend2 if [ -w /proc/suspend2/do_resume ] then echo "${GOOD}>>${NORMAL}${BOLD} Activating suspend2 resume..." echo > /proc/suspend2/do_resume fi Reproducible: Always Steps to Reproduce: Enhancement Actual Results: Does not activate suspend2 Expected Results: Activate suspend2 It would be nice if the standard genkernel linuxrc would support suspend2 automatically if it finds /proc/suspend2/do_resume.
When would be the best time to do this?
If you mail me the current linuxrc file (I can't seem to locate it in CVS) I'll be happy to provide a patch for this functionality.
Created attachment 74105 [details, diff] Patch to linuxrc This is how i did it. I have suspend2 not yet running, so i'm not sure it's the correct place to add it, since the root filesystem already is mounted at that time and the documentation says that one has to do it _before_ mounting filesystems.
Documentation is at: http://www.suspend2.net/HOWTO-2.html#ss2.3 It says: > Using an initrd with Suspend2 is possible. To use this, you MUST edit your > linuxrc (or init) script to contain the line > > echo > /proc/suspend2/do_resume > > BEFORE the script mounts your filesystem. If the line is missing, your system > will not resume. If the line comes after mounting file systems, you will most > likely suffer from filesystem corruption. You have been warned.
gentoo/src/genkernel_bradmssw/generic in CVS
plasmaroo: did you test the patch before committing it?
No, I don't use suspend2 and thought amir did. If you want to give it a test that would be appreciated :)
(In reply to comment #7) > No, I don't use suspend2 and thought amir did. If you want to give it a test > that would be appreciated :) Amir explicitly noted that he thought the proposed patch was wrong. I offered to provide another patch. May I suggest you back out the patch until we have established that it works and doesn't cause filesystem corruption?
I think when using sys-kernel/genkernel it's the one at /usr/share/genkernel/generic/linuxrc. It gets installed by the genkernel package. You can find it in http://dev.gentoo.org/~rocket/genkernel/genkernel-3.3.6.tar.gz , it's quite different from the one in cvs at gentoo/src/genkernel_bradmssw/generic .
And yes, please back out the patch. It was never meant to get merged!
> And yes, please back out the patch. It was never meant to get merged! Done as requested. I see no reason for any FS issues to arise however, since the operation is performed /way/ before the FS mounts... Amir, the latest genkernel version is also 3.3.8, not 3.3.6 by the way :]
Yep, you're right.
Brix, any idea why my b44 ethernet driver just timeouts with suspend2-sources? It worked under gentoo-sources without fuss... I was able to boot a suspend2-sources kernel generated with genkernel with the above patch. I will test tomorrow what happens when I suspend the thingy. No filesystem corruption till now... ;)
Created attachment 74640 [details, diff] suspend2 linuxrc patch with fbsplash support This is my patch, it needs some adjustment (adding checks and so on) but it works well for me ;) Imho the "echo > /proc/suspend2/do_resume" command must be immediately before "# Determine root device" and after udev start; otherwise using LVM2+filewriter (my case) suspend2 doesn't work (can't access device). I use it with an initramfs overlay (merged using the genkernel feature) like this: . |-- etc | `-- splash | `-- suspend2 -> livecd-2005.1 `-- sbin |-- suspend2ui_fbsplash `-- suspend2ui_text created with: # quickpkg sys-apps/suspend2-userui # tar xvjf /usr/portage/packages/All/suspend2-userui-0.6.1.tbz2 # rm -rf usr # mkdir -p etc/splash # ln -s etc/splash/livecd-2005.1 etc/splash/suspend2 With this the first 2 suspend2 messages (reading... and copy kernel...) are wrote using slash theme instead of simple text messages ;)
Amir, brix: Is this good to go in - i.e. the initial patch you guys posted on this bug?
Plasmaroo, I was not yet able to get my suspend2-sources kernel to correctly use my b44 ethernet driver. Since playing with Gentoo without network is not much fun and since I did not yet find the time to explore this further I have not been able to use suspend2. I'm not in a position to say it works or it does not. Brix should know more...
The above patch works fine for me (https://bugs.gentoo.org/attachment.cgi?id=74105), resume now works for kernels built with genkernel. I have however a related problem, with the LZF compression algorithm. If it is compiled in-kernel, resume works fine. If it's modular, resume doesn't work. I suspect genkernel for not including that module in the created initrd. How can I check this? And if I am right about it, should I file another bug for this?
(In reply to comment #17) > The above patch works fine for me > (https://bugs.gentoo.org/attachment.cgi?id=74105), resume now works for kernels > built with genkernel. Great. Thank you for testing this. > I have however a related problem, with the LZF compression algorithm. If it is > compiled in-kernel, resume works fine. If it's modular, resume doesn't work. I > suspect genkernel for not including that module in the created initrd. How can > I check this? And if I am right about it, should I file another bug for this? Even if genkernel includes the LZF module in the initrd, it would not know if it needed loading or not before calling resume. I suggest always compiling in the LZF module when using it for suspend compression. Tim, looks like this patch is good to be included in genkernel :)
I've uncommented this code in CVS... I'll resolve this bug once a version of genkernel with this support is released.
This should be fixed in 3.3.11c, which is now in portage.