View previous topic :: View next topic |
Author |
Message |
fau n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/20087032334d41d67acd348.jpg)
Joined: 01 Apr 2010 Posts: 74
|
Posted: Tue Apr 27, 2010 6:20 pm Post subject: tuxonice and suspend to file |
|
|
Hello,
I ran into some problems trying to set up hibernating to file on my laptop. I have 2.6.30 tuxonice-sources kernel with default tuxonice configuration. When I enter "FilewriterLocation /suspend_file 2048" tuxonice creates the file and I can use it to suspend during that session. However after reboot it doesn't recognize it and prints following error:
Code: |
Starting suspend at wto, 27 kwi 2010, 20:12:08 CEST
hibernate: [01] Executing CheckLastResume ...
hibernate: [01] Executing CheckRunlevel ...
hibernate: [01] Executing LockFileGet ...
hibernate: [01] Executing NewKernelFileCheck ...
hibernate: [10] Executing EnsureTuxOnIceCapable ...
hibernate: [11] Executing TuxOnIceSetupFilewriter ...
hibernate: Filewriter image (/suspend_file) is unrecognised.
hibernate: I'm not even going to attempt to use this file to hibernate to.
hibernate: Please erase the contents of the existing file if you believe it
hibernate: to be safe, otherwise, please specify a new file.
hibernate: TuxOnIceSetupFilewriter refuses to let us continue.
hibernate: Aborting.
hibernate: [11] Executing TuxOnIceCleanupFilewriter ...
hibernate: [01] Executing NoteLastResume ...
hibernate: [01] Executing LockFilePut ...
hibernate: [00] Executing RemoveTuxOnIceProcCruft ...
Resumed at wto, 27 kwi 2010, 20:12:08 CEST
|
Just let me know and i'll post any additional info. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
MotivatedTea Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/13442286474c0d7dbae91d0.jpg)
Joined: 06 Nov 2006 Posts: 269 Location: Toronto, Canada
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Paczesiowa Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 06 Mar 2006 Posts: 593 Location: Oborniki Śląskie, Poland
|
Posted: Wed Apr 28, 2010 8:27 am Post subject: |
|
|
it's a known bug in tuxonice (2 years?), kernel part uses different signature than hibernate script (you can check first 10 bytes of that file, it's supposed to be 'tuxonice' and it usually is garbage). it was supposed to be fixed with newer hibernate-script, but nobody knows when it will come out. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
fau n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/20087032334d41d67acd348.jpg)
Joined: 01 Apr 2010 Posts: 74
|
Posted: Wed Apr 28, 2010 3:07 pm Post subject: |
|
|
When I manually add "TuxOnIce" to my suspend file I get "no storage avaible" error. I guess that this time kernel doesn't recognise his header so it breaks. Is there any way to suspend to file using tuxonice then? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Paczesiowa Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 06 Mar 2006 Posts: 593 Location: Oborniki Śląskie, Poland
|
Posted: Thu Apr 29, 2010 9:33 am Post subject: |
|
|
how do you add that? "echo tuxonice > suspend_file"? that puts ONLY that word in the file, so it's too small. you have to create as as big as it must be (e.g. using hibernate script) and then overwrite first word, I don't know how to do that from bash, but it's easy to do in C, iirc I have that code on my laptop so if you want I could get it for you. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
MotivatedTea Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/13442286474c0d7dbae91d0.jpg)
Joined: 06 Nov 2006 Posts: 269 Location: Toronto, Canada
|
Posted: Thu Apr 29, 2010 7:19 pm Post subject: |
|
|
You can put the header in the file like this:
Code: | # echo -n "TuxOnIce" > header.tmp
# dd if=header.tmp of=suspend_file conv=notrunc
# rm header.tmp |
You could also use something like app-editors/hexedit to edit the file directly.
I thought the hibernate script was supposed to do that for you, though? I have used hibernation files before, but I switched to using swap files a while ago. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
fau n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/20087032334d41d67acd348.jpg)
Joined: 01 Apr 2010 Posts: 74
|
Posted: Mon May 03, 2010 12:29 am Post subject: |
|
|
@MotivatedTea:
It works, but I don't know why hibernate-cleanup doesn't do it - suspend file's header is broken after every reboot.
This is my hibernate-cleanup script:
Code: |
HIBERNATE_FILEWRITER_TRAIL="/var/run/TuxOnIce_filewriter_image_exists"
clear_swap() {
local where wason
where=$1
wason=
swapoff $where 2>/dev/null && wason=yes
mkswap $where > /dev/null || msg_status " (failed: $?)"
[ -n "$wason" ] && swapon $where
}
check_swap_sig() {
local where what type rest p c
while read where what type rest ; do
test "$type" = "swap" || continue
case "$(dd if=$where bs=1 count=6 skip=4086 2>/dev/null)" in
S1SUSP|S2SUSP|ULSUSP|pmdisk|[zZ]*)
msg_status "$where"
clear_swap $where
msg_status ", "
esac
done < /etc/fstab
}
check_filewriter_sig() {
local target
[ -f "$HIBERNATE_FILEWRITER_TRAIL" ] || return 0
read target < $HIBERNATE_FILEWRITER_TRAIL
[ -f "$target" ] || return
case "`dd \"if=$target\" bs=8 count=1 2>/dev/null`" in
HaveImag)
/bin/echo -ne "TuxOnIce\n\0\0" | dd "of=$target" bs=11 count=1 conv=notrunc 2>/dev/null
msg_status -n "$target, "
rm -f $HIBERNATE_FILEWRITER_TRAIL
esac
}
do_start() {
check_swap_sig
check_filewriter_sig
}
do_stop() {
:
}
do_reload() {
:
}
|
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
MotivatedTea Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/13442286474c0d7dbae91d0.jpg)
Joined: 06 Nov 2006 Posts: 269 Location: Toronto, Canada
|
Posted: Mon May 03, 2010 2:43 am Post subject: |
|
|
That's the same as mine, but I'm using swapfiles now, not hibernation files. However, it looks like the hibernate-cleanup script won't do anything unless "/var/run/TuxOnIce_filewriter_image_exists" exists:
Code: | [ -f "$HIBERNATE_FILEWRITER_TRAIL" ] || return 0 |
I don't know what is supposed to create that file. I can't seem to find any other references to it. Does that file exist on your computer? If it's not getting created, then that explains why hibernate-cleanup isn't doing anything. It looks like it's supposed to hold the location if your swapfile.
If that file exists, the check_filewriter_sig reads it and stores its contents in $target. It then checks to see if $target starts with "HaveImag". If it does, it overwrites the start of $target with "TuxOnIce". Finally, it deletes /var/run/TuxOnIce_filewriter_image_exists. So it looks like your problem would be solved if /var/run/TuxOnIce_filewriter_image_exists were created properly. I don't know where that's supposed to happen, though. I'd try to reproduce the problem, but I don't have a computer running Gentoo that I can switch to hibernation files on at the moment. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
fau n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/20087032334d41d67acd348.jpg)
Joined: 01 Apr 2010 Posts: 74
|
Posted: Mon May 03, 2010 8:36 am Post subject: |
|
|
I've removed error stream's redirection from script and now it prints:
Code: | dd: opening `#/dev/SWAP' no such file or directory'
|
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
MotivatedTea Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/13442286474c0d7dbae91d0.jpg)
Joined: 06 Nov 2006 Posts: 269 Location: Toronto, Canada
|
Posted: Mon May 03, 2010 2:30 pm Post subject: |
|
|
That's coming from check_swap_sig, and you're not using the swap writer. That error message just indicates that it didn't find a hibernation image in what it thought might be a swap file (but wasn't). As I said before, if you're using a hibernation file, then the hibernate-cleanup script isn't going to do anything unless the file "/var/run/TuxOnIce_filewriter_image_exists" exists. Have you checked to see if it does? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
fau n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/20087032334d41d67acd348.jpg)
Joined: 01 Apr 2010 Posts: 74
|
Posted: Mon May 03, 2010 7:02 pm Post subject: |
|
|
Ach I forgot - it doesn't exist. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
MotivatedTea Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/13442286474c0d7dbae91d0.jpg)
Joined: 06 Nov 2006 Posts: 269 Location: Toronto, Canada
|
Posted: Mon May 03, 2010 9:31 pm Post subject: |
|
|
I'm not sure what it is that is supposed to create that file, but that explains why the hibernate-cleanup script isn't doing anything. At this point, you could try to figure out where that's supposed to be coming from (maybe file a bug report when you do), or you could hack it so that it works. You could modify the hibernate-cleanup script, but you might have to re-do the modifications when the scripts get updated. Or, since you have the right command to run, you could put it in "/etc/conf.d/local.start" for now until the problem gets solved.
Or, you could switch to using a swapfile. (You can use swap files, not just partitions.) Tuxonice allows you to specify scripts that get run during the hibernation process and on resuming. What I played around with in the past was making a swapfile, but not setting it to mount automatically in /etc/fstab. I would only mount it just before hibernation, and then unmount it just after. That means it has pretty much the same effect as a hibernation file. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
fau n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/20087032334d41d67acd348.jpg)
Joined: 01 Apr 2010 Posts: 74
|
Posted: Wed May 05, 2010 10:10 am Post subject: |
|
|
OK, I'll do one of these. Thank you for helping me ![Smile :)](images/smiles/icon_smile.gif) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|