Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 114266 - enhance genkernel's linuxrc to support suspend2
Summary: enhance genkernel's linuxrc to support suspend2
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2005-12-02 06:37 UTC by Amir Guindehi (RETIRED)
Modified: 2006-04-13 12:36 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to linuxrc (linuxrc.diff,417 bytes, patch)
2005-12-05 09:49 UTC, Amir Guindehi (RETIRED)
Details | Diff
suspend2 linuxrc patch with fbsplash support (suspend2.patch,365 bytes, patch)
2005-12-13 04:49 UTC, Laurento Frittella (mrfree)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Amir Guindehi (RETIRED) gentoo-dev 2005-12-02 06:37:17 UTC
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.
Comment 1 Chris Gianelloni (RETIRED) gentoo-dev 2005-12-05 08:36:14 UTC
When would be the best time to do this?
Comment 2 Henrik Brix Andersen 2005-12-05 09:29:37 UTC
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.
Comment 3 Amir Guindehi (RETIRED) gentoo-dev 2005-12-05 09:49:14 UTC
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.
Comment 4 Amir Guindehi (RETIRED) gentoo-dev 2005-12-05 09:49:59 UTC
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.
Comment 5 Chris Gianelloni (RETIRED) gentoo-dev 2005-12-05 09:50:51 UTC
gentoo/src/genkernel_bradmssw/generic in CVS
Comment 6 Henrik Brix Andersen 2005-12-05 14:20:31 UTC
plasmaroo: did you test the patch before committing it?
Comment 7 Tim Yamin (RETIRED) gentoo-dev 2005-12-05 14:29:47 UTC
No, I don't use suspend2 and thought amir did. If you want to give it a test
that would be appreciated :)
Comment 8 Henrik Brix Andersen 2005-12-05 14:36:20 UTC
(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?
Comment 9 Amir Guindehi (RETIRED) gentoo-dev 2005-12-05 14:54:31 UTC
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 .
Comment 10 Amir Guindehi (RETIRED) gentoo-dev 2005-12-05 14:56:38 UTC
And yes, please back out the patch. It was never meant to get merged!
Comment 11 Tim Yamin (RETIRED) gentoo-dev 2005-12-05 15:20:45 UTC
> 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 :]
Comment 12 Amir Guindehi (RETIRED) gentoo-dev 2005-12-05 15:26:15 UTC
Yep, you're right.
Comment 13 Amir Guindehi (RETIRED) gentoo-dev 2005-12-05 16:28:56 UTC
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... ;)
Comment 14 Laurento Frittella (mrfree) 2005-12-13 04:49:48 UTC
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 ;)
Comment 15 Tim Yamin (RETIRED) gentoo-dev 2005-12-29 14:45:17 UTC
Amir, brix: Is this good to go in - i.e. the initial patch you guys posted on this bug?
Comment 16 Amir Guindehi (RETIRED) gentoo-dev 2006-01-03 05:57:13 UTC
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...
Comment 17 Stijn Tintel 2006-02-12 19:06:40 UTC
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?
Comment 18 Henrik Brix Andersen 2006-02-19 11:53:21 UTC
(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 :)

Comment 19 Chris Gianelloni (RETIRED) gentoo-dev 2006-04-13 08:41:59 UTC
I've uncommented this code in CVS... I'll resolve this bug once a version of genkernel with this support is released.
Comment 20 Chris Gianelloni (RETIRED) gentoo-dev 2006-04-13 12:36:26 UTC
This should be fixed in 3.3.11c, which is now in portage.