Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 131202 - swsusp2 hibernation won't work with EVMS & genkernel
Summary: swsusp2 hibernation won't work with EVMS & genkernel
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Lowest enhancement (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords: InVCS
: 132554 145798 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-04-25 04:23 UTC by -XoF-
Modified: 2006-09-16 03:56 UTC (History)
4 users (show)

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


Attachments
generic.diff (generic.diff,1.81 KB, patch)
2006-06-10 11:51 UTC, Alon Bar-Lev (RETIRED)
Details | Diff
suspend2_resume (suspend2_resume,982 bytes, text/plain)
2006-08-25 17:36 UTC, Alon Bar-Lev (RETIRED)
Details
suspend2_resume (suspend2_resume,975 bytes, text/plain)
2006-09-07 09:24 UTC, Alon Bar-Lev (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description -XoF- 2006-04-25 04:23:26 UTC
When having suspend2 to page out on a swap device located on an EVMS volume, hibernation (or better: resume) won't work if the initramfs has been built with "genkernel --evms initrd". I identified the reason within /usr/share/genkernel/generic/linuxrc, which does the resume stuff before anything else - and therefore before activating the evms-volumes. Just moving the suspend2-resume stuff near to the end of linuxrc worked great for me.
Here's the patch (for genkernel-3.3.11d):

--- linuxrc.orig	2006-04-23 11:02:49.000000000 +0200
+++ linuxrc	2006-04-25 10:14:18.000000000 +0200
@@ -25,13 +25,6 @@
 mount -o remount,rw /
 mount -t proc proc /proc
 
-# activate suspend2
-if [ -w /proc/suspend2/do_resume ]
-then
-	echo -e "${GOOD}>>${NORMAL}${BOLD} Activating suspend2 resume..."
-	echo > /proc/suspend2/do_resume
-fi
-
 # Set up symlinks
 if [ "$0" = '/init' ]
 then
@@ -231,6 +224,14 @@
 # Start EVMS
 startVolumes
 
+# activate suspend2
+if [ -w /proc/suspend2/do_resume ]
+then
+	echo -e "${GOOD}>>${NORMAL}${BOLD} Activating suspend2 resume..."
+	echo > /proc/suspend2/do_resume
+fi
+
+
 # Set up unionfs
 mkdir -p ${NEW_ROOT}
 setup_unionfs
Comment 1 Alon Bar-Lev (RETIRED) gentoo-dev 2006-04-30 05:35:12 UTC
Hello,

We can improve the suspend2 support with this simple routine, it allows using lzf as a module, and use suspend2ui if available at initramfs overlay.

This allow to specify in genkernel.conf lzf module as well.
AMODULES_SUSPEND2="lzf"

suspend2_resume() {
	if [ -d /proc/suspend2 ]; then
		local splash_theme=`cat /proc/cmdline | sed 's/.*splash=/splash=/' | sed 's/ .*//' | sed 's/.*theme://' | sed 's/,.*//'`

		modules_scan suspend2
		if [ -z "${splash_theme}" ]; then
			if which suspend2ui_text > /dev/null; then
				echo `which suspend2ui_text` > /proc/suspend2/userui_program
			fi
		else
			ln -s /etc/splash/${splash_theme} /etc/splash/suspend2
			echo `which suspend2ui_fbsplash` > /proc/suspend2/userui_program
		fi
		echo > /proc/suspend2/do_resume

		#not available now but will be nice
		#modules_remove suspend2
	fi
}
Comment 2 Tim Yamin (RETIRED) gentoo-dev 2006-05-07 10:50:59 UTC
*** Bug 132554 has been marked as a duplicate of this bug. ***
Comment 3 Chris Gianelloni (RETIRED) gentoo-dev 2006-06-09 07:38:40 UTC
OK.  I'm not sure I am following here.  Where would the suspend2_resume function be called?  After starting the evms volumes?  Also, where does the AMODULES_SUSPEND2="lzf" go?  It *looks* like it should be MODULES_SUSPEND2="lzf" and go into modules_load for each architecture, but it's a bit ambiguous.  The best solution would be to attach a patch to this bug, so there's nothing left to question.
Comment 4 Alon Bar-Lev (RETIRED) gentoo-dev 2006-06-09 09:34:45 UTC
(In reply to comment #3)
> Where would the suspend2_resume
> function be called?  After starting the evms volumes? 

Yes, since if you call it before, some configurations will not be able to access the swap or the suspend file resides on one of the volumes.

> AMODULES_SUSPEND2="lzf" go?  It *looks* like it should be
> MODULES_SUSPEND2="lzf" and go into modules_load for each architecture, 

Oh...
I did not think that it is required by you...
If the user wishes to use lzf as a module he will put:
AMODULES_SUSPEND2="lzf"
At /etc/genkernel.conf to create a new group for it... No patch is needed!
You have added this feature for me in bug#96357.

If there is no suspend2 group modules_scan will do nothing, right?
Comment 5 Tim Yamin (RETIRED) gentoo-dev 2006-06-10 05:17:24 UTC
(In reply to comment #4)
> Oh...
> I did not think that it is required by you...
> If the user wishes to use lzf as a module he will put:
> AMODULES_SUSPEND2="lzf"
> At /etc/genkernel.conf to create a new group for it... No patch is needed!
> You have added this feature for me in bug#96357.
> 
> If there is no suspend2 group modules_scan will do nothing, right?

So what needs doing? Does a modprobe need adding somewhere or do we just need to document this AMODULES_SUSPEND2 trick for swsusp2+evms? :)
Comment 6 Alon Bar-Lev (RETIRED) gentoo-dev 2006-06-10 06:40:10 UTC
(In reply to comment #5)
> So what needs doing? Does a modprobe need adding somewhere

Well... If you want to be on the safe side, modify modules_scan to check if the file exist or:
MODS=`cat /etc/modules/${1} 2> /dev/null`

It would also be great if you unload a group of modules as well... (reverse order...) I can do this if you like. so modules can be unloaded if not required.

> or do we just need
> to document this AMODULES_SUSPEND2 trick for swsusp2+evms? :)

Yes... This will be nice!
Comment 7 Chris Gianelloni (RETIRED) gentoo-dev 2006-06-10 08:06:55 UTC
Could you please provide this as a patch so there is no ambiguity?

Thanks...
Comment 8 Alon Bar-Lev (RETIRED) gentoo-dev 2006-06-10 11:49:05 UTC
Sure!
Aside of the patch, the user should do the followings:

1. If the lzf was compiled as a module, add the following to genkernel.conf:
AMODULES_SUSPEND2="lzf"

2. If the user wishes to use the suspend2-userui, he should create an initramfs overlay with:

/sbin/suspend2ui_fbsplash
/sbin/suspend2ui_text

And run genkernel with appropriate argument.
Comment 9 Alon Bar-Lev (RETIRED) gentoo-dev 2006-06-10 11:51:23 UTC
Created attachment 88853 [details, diff]
generic.diff

I did not understand why the modules_scan is so complicated, so I did not write modules_remove yet...
If you be kind enough to explain why you just don't load all modules in the list I will provide it also.
Although for most users having lzf around is OK.
Comment 10 Eddy Mulyono 2006-07-28 00:03:23 UTC
I followed the instructions in comment #8,  epatched genkernel-3.3.11d with attachment 88853 [details, diff], and got suspend2-sources-2.6.17-r2 to work with LVM.

Many thanx to Alon.
Comment 11 Eddy Mulyono 2006-08-18 19:16:20 UTC
patch works with genkernel-3.4.0-r1 and suspend2-sources-2.6.17-r4.
Comment 12 Chris Gianelloni (RETIRED) gentoo-dev 2006-08-22 12:24:10 UTC
I've added this to CVS
Comment 13 Alon Bar-Lev (RETIRED) gentoo-dev 2006-08-25 17:36:30 UTC
Created attachment 95090 [details]
suspend2_resume

This is an update for suspend2_resume routine that supports the upcoming suspend2 version (A move from /proc to /sys) with backward compatibility.
Comment 14 Jakub Moc (RETIRED) gentoo-dev 2006-09-01 01:45:32 UTC
*** Bug 145798 has been marked as a duplicate of this bug. ***
Comment 15 Alon Bar-Lev (RETIRED) gentoo-dev 2006-09-07 09:24:37 UTC
Created attachment 96285 [details]
suspend2_resume

Fixed to match suspend2-2.2.7.5 sys structure.
This supports all versions as well as new ones.
Comment 16 Chris Gianelloni (RETIRED) gentoo-dev 2006-09-12 06:33:44 UTC
Alright... I've updated this with the latest version of the function.
Comment 17 Tim Yamin (RETIRED) gentoo-dev 2006-09-16 03:56:03 UTC
Fixed in 3.4.1, thanks!