Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] uswsusp doesn't resume, always boots normally
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
solamour
Guru
Guru


Joined: 21 Dec 2004
Posts: 491
Location: San Diego, CA

PostPosted: Tue Sep 14, 2010 8:36 pm    Post subject: [Solved] uswsusp doesn't resume, always boots normally Reply with quote

I've been using TuxOnIce successfully for a while. Then I suddenly wanted to try uswsusp, so I installed "gentoo-sources" (linux-2.6.35-gentoo-r4 to be exact) and followed the instructions at http://en.gentoo-wiki.com/wiki/Userspace_software_suspend.

Issuing "hibernate" saves the current state to a disk and powers off the computer. But when I turn it on, resume doesn't work; it always starts normally. During the booting, I see something like the following.
Code:
software suspend data detected "rewriting the swap signature"

I'm not sure how to proceed from here. I'd appreciate any suggestions.
__
sol


Last edited by solamour on Thu Sep 23, 2010 12:17 am; edited 2 times in total
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8855

PostPosted: Wed Sep 15, 2010 3:20 am    Post subject: Reply with quote

What is the error message when the initramfs rejects your hibernated image? This should appear before the Gentoo initscripts take control.
Back to top
View user's profile Send private message
solamour
Guru
Guru


Joined: 21 Dec 2004
Posts: 491
Location: San Diego, CA

PostPosted: Wed Sep 15, 2010 6:59 am    Post subject: Reply with quote

I believe I'm not using initramfs, because when I followed Gentoo Handbook, I didn't use genkernel.

/boot/grub/menu.lst
Code:
title Gentoo 2.6.35-r4
root (hd0,0)
kernel /boot/kernel-2.6.35-gentoo-r4 root=/dev/sda1

__
sol
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8855

PostPosted: Thu Sep 16, 2010 2:15 am    Post subject: Reply with quote

If you do not use an initramfs, how do you expect to execute the userspace resume part of uswsusp? ;) You need to call /sbin/resume from the resuming kernel before it mounts any filesystems used by the hibernated image. This means either use an initramfs or have a mini-system stored in an otherwise unmounted partition. The initramfs is considerably less work, and can be quite small.
Back to top
View user's profile Send private message
solamour
Guru
Guru


Joined: 21 Dec 2004
Posts: 491
Location: San Diego, CA

PostPosted: Sat Sep 18, 2010 11:14 pm    Post subject: Reply with quote

I guess I won't be able to use uswsusp without initramfs, so to make things easier for me, I tried genkernel, but it looks like genkernel doesn't support uswsusp (yet).

Summary: Add support to genkernel for userspace suspend/resume (uswsusp)
http://bugs.gentoo.org/show_bug.cgi?id=156445

I'll stick with TuxOnIce until 1) genkernel supports uswsusp, 2) I figure out what to do with initramfs, or 3) someone shows me steps in layperson's terms. Thank you for taking time to respond.
__
sol
Back to top
View user's profile Send private message
fau
n00b
n00b


Joined: 01 Apr 2010
Posts: 72

PostPosted: Sun Sep 19, 2010 1:20 am    Post subject: Reply with quote

I've just set it up and it wasn't that hard, although I got stuck once, when I forgot to compile sandbox with "static" use flag.
Just follow gentoo wiki guide omitting parts about encryption. Later you can edit /etc/hibernate/common.conf file and hibernate by hibernate-script.

Here is my initramfs layout and init file if it is going to help you.

Code:

.:
total 8
drwxr-xr-x 2 root root  32 Sep 18 22:58 bin
drwxr-xr-x 2 root root  48 Sep 19 03:05 dev
drwxr-xr-x 2 root root   8 Sep 18 18:48 etc
-rwxr-xr-x 1 root root 301 Sep 18 23:31 init
-rwxr-xr-x 1 root root 189 Sep 18 18:50 install
drwxr-xr-x 3 root root   8 Sep 18 20:07 mnt
drwxr-xr-x 2 root root   1 Sep 18 18:46 proc
drwxr-xr-x 2 root root   1 Sep 18 20:06 sys

./bin:
total 3992
-rwxr-xr-x 1 root root 1814068 Sep 18 22:58 busybox
-rwxr-xr-x 1 root root 2261780 Sep 18 22:58 resume
lrwxrwxrwx 1 root root       7 Sep 18 22:58 sh -> busybox

./dev:
total 0
crw------- 1 root root  5,   1 Sep 18 16:48 console
brw-rw---- 1 root disk  8,   5 Sep 18 20:23 sda5
brw-rw---- 1 root disk  8,   7 Sep 18 18:27 sda7
crw-rw---- 1 root root 10, 231 Sep 18 18:48 snapshot
crw-rw-rw- 1 root tty   5,   0 Sep 18 22:23 tty

./etc:
total 4
-rw-r--r-- 1 root root 176 Sep 18 18:48 suspend.conf

./mnt:
total 0
drwxr-xr-x 2 root root 1 Sep 18 20:07 root

./mnt/root:
total 0

./proc:
total 0

./sys:
total 0


Code:
#!/bin/sh

mount -t proc proc /proc
mount -t sysfs sysfs /sys
sleep 2

if [ -z "$noresume" ]
then
resume
fi

mount -o ro /dev/sda5 /mnt/root || rescue_shell

#Clean up
umount /sys /proc

exec switch_root /mnt/root /sbin/init

rescue_shell() {
    echo "Rescue Shell"
    busybox --instal -s
    exec /bin/sh
}
Back to top
View user's profile Send private message
solamour
Guru
Guru


Joined: 21 Dec 2004
Posts: 491
Location: San Diego, CA

PostPosted: Thu Sep 23, 2010 12:17 am    Post subject: Reply with quote

I should have spent time learning how to create initramfs on my own, but I'm lazy, so I shamelessly stole someone else's work at http://lunaryorn.de/articles/initramfs_gentoo.html.

1) Download "init.sh", "makefile.tmpl", and "makeinitramfs.py".

2) Build busybox as static.
Code:
USE="static" emerge -ptv busybox


3) The scripts might work with little or no modifications, but because I don't need fbcondecor, cryptsetup, or LVM, I commented out the parts that are not relevant to me in "init.sh" and "makefile.tmpl". The only thing that needs to be checked is "ROOT" (where the root file system is) in "init.sh".
Code:
init.sh

export ROOT="/dev/sda1"


4) Create "initramfs" file and put it in "/boot" directory.
Code:
python makeinitramfs.py -z -i


5) Update GRUB.
Code:
/boot/grub/grub.conf
title Gentoo 2.6.34-r6
root (hd0,0)
kernel ...
initrd /boot/initramfs   <-- Add This Line.


Now uswsusp works as expected. Thank you everyone for taking time to respond.
__
sol
Back to top
View user's profile Send private message
rh1
Guru
Guru


Joined: 10 Apr 2010
Posts: 501

PostPosted: Thu Sep 23, 2010 12:52 am    Post subject: Reply with quote

Quote:
If you do not use an initramfs, how do you expect to execute the userspace resume part of uswsusp? ;) You need to call /sbin/resume from the resuming kernel before it mounts any filesystems used by the hibernated image. This means either use an initramfs or have a mini-system stored in an otherwise unmounted partition. The initramfs is considerably less work, and can be quite small.


I've only tried tux so far but I thought adding resume=/dev/blah to the kernel line in grub.conf took care of this regardless? It's even in the wiki:
Quote:
Make sure your kernel has suspend support enabled. You can probably leave "Default resume partition" blank if you're using an initramfs. Otherwise, you might (???) have to set it to the path of your swap/resume device (or, alternatively, pass the resume=/dev/YOUR_SWAP_PATH parameter on the kernel command line).
Back to top
View user's profile Send private message
solamour
Guru
Guru


Joined: 21 Dec 2004
Posts: 491
Location: San Diego, CA

PostPosted: Thu Sep 23, 2010 1:20 am    Post subject: Reply with quote

Quote:
I've only tried tux so far but I thought adding resume=/dev/blah to the kernel line in grub.conf took care of this regardless?

If I understand correctly, TuxOnIce does things inside kernel, so "resume=/dev/blah" in grub.conf is enough, but uswsusp requires initramfs in order to work properly.
__
sol
Back to top
View user's profile Send private message
roothorick
Tux's lil' helper
Tux's lil' helper


Joined: 30 May 2004
Posts: 83
Location: Menasha, WI

PostPosted: Sat Sep 25, 2010 9:57 pm    Post subject: Reply with quote

Hu wrote:
If you do not use an initramfs, how do you expect to execute the userspace resume part of uswsusp? ;) You need to call /sbin/resume from the resuming kernel before it mounts any filesystems used by the hibernated image. This means either use an initramfs or have a mini-system stored in an otherwise unmounted partition. The initramfs is considerably less work, and can be quite small.


That doesn't jive with the wikipage:

Quote:
If you use an initramfs (initrd) -- either homemade or generated by genkernel -- you will likely have to configure your initramfs to support uswsusp. If you're not sure whether you use an initramfs, check for an initrd line in your bootloader configuration (/boot/grub/grub.conf or /boot/lilo/lilo.conf).


That strongly implies that you don't need one. Big oversight.
_________________
Note: This user has been arrested under the DMCA for copyright infringement based on a complaint from The Inernational Cliche Company. He is also facing charges for violating US patents describing the encoding of text in digital form.
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8855

PostPosted: Sat Sep 25, 2010 10:43 pm    Post subject: Reply with quote

roothorick wrote:
That doesn't jive with the wikipage:
Wikis are notoriously subject to modification by users, not all of whom are adequately informed or necessarily excellent writers.
roothorick wrote:
Quote:
If you use an initramfs (initrd) -- either homemade or generated by genkernel -- you will likely have to configure your initramfs to support uswsusp. If you're not sure whether you use an initramfs, check for an initrd line in your bootloader configuration (/boot/grub/grub.conf or /boot/lilo/lilo.conf).
That strongly implies that you don't need one. Big oversight.
Please fix the wording to something more accurate. Also, you may wish to send a strongly worded e-mail to whoever wrote the original document to inform them of their big oversight. Finally, please note that though forum regulars may cite the Wiki, we are not necessarily the authors of the content on it, nor are we capable of preventing the upload of inaccurate information.
Back to top
View user's profile Send private message
solamour
Guru
Guru


Joined: 21 Dec 2004
Posts: 491
Location: San Diego, CA

PostPosted: Thu Oct 17, 2013 3:57 pm    Post subject: Reply with quote

Looks like the site I stole the script from (http://lunaryorn.de/articles/initramfs_gentoo.html) is no longer maintained. But I found dracut (http://wiki.gentoo.org/wiki/Dracut) vastly simpler to use. I just installed it, and hibernation worked right out of the box.

Hibernation and genkernel still don't play well yet.
__
sol
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum