WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: hibernate kit for TC  (Read 11105 times)

Offline dentonlt

  • Sr. Member
  • ****
  • Posts: 307
    • the trombone analog
hibernate kit for TC
« on: December 04, 2009, 10:51:16 PM »
Tools to patch Tiny Core 2.6 to support suspend-to-disk.

[EDIT: see replies for updates (2.7, 2.8, 2.9, then none until 4.0.1 and beyond)]

Works for me, but use at your own risk! Only for the courageous - I'm a very average programmer, and this may well eat your data.

REQUIREMENTS

  • ACPI Support - look for /proc/acpi
  • Suspend-to-disk support - look for s3 when you run cat /proc/acpi/sleep
  • suspend.tcz
  • tinycore.gz from Tiny Core 2.6
  • You must be running Tiny Core 2.6 when you invoke the scripts

CONTENTS

  • README.txt
  • [extract-tinycore.sh
  • inittab.patch-2.6
  • pack-tinycore.sh
  • patch-hibernate.sh
  • tc-config.patch-2.6

USAGE

Read the README file. In short: check for compatibility, put everything in one place, then use sudo patch-hibernate.sh. Finally, move the new tinycore image to your boot directory, and edit your GRUB menu. RTM.

SUPPORT

Check out these threads on using s2disk and s2ram:
http://forum.tinycorelinux.net/index.php?topic=455.0
http://forum.tinycorelinux.net/index.php?topic=447.0

or run a forum search for 'suspend' or 'hibernate.'

CMA

Plan for the worst and back up your data. Not my fault if you didn't!

EDIT 12/12/2009: Added a little hibernate icon, 48x48 png. Created on inkscape, public use.
« Last Edit: October 06, 2011, 11:39:29 PM by dentonlt »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 11066
Re: hibernate kit for TC 2.6
« Reply #1 on: December 05, 2009, 12:35:54 AM »

There's a suspend extension in the repository?

Offline dentonlt

  • Sr. Member
  • ****
  • Posts: 307
    • the trombone analog
Re: hibernate kit for TC 2.6
« Reply #2 on: December 05, 2009, 01:13:18 AM »
Juanito: of course, you're correct! Your extension includes the resume binary & suspend.conf - I hadn't found them.

[oops]  ;D

I'll correct that above.

EDIT: changed file list, README, and replaced the .tar.gz.
« Last Edit: December 05, 2009, 01:19:26 AM by dentonlt »

Offline dentonlt

  • Sr. Member
  • ****
  • Posts: 307
    • the trombone analog
Re: hibernate kit for TC 2.6 / 2.6.1
« Reply #3 on: December 12, 2009, 10:12:18 PM »
Tested on 2.6.1 - works for me. Changes:

* tests for running 2.6 or 2.6.1
* corrected advdef check
* new md5sum

Posted .tar.gz and md5.txt. Login to download.

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: hibernate kit for TC 2.6
« Reply #4 on: December 13, 2009, 08:34:29 AM »
Tested on 2.6.1 - works for me. Changes:

* tests for running 2.6 or 2.6.1
* corrected advdef check
* new md5sum

Posted .tar.gz and md5.txt. Login to download.

What performance are you getting? How long does shutdown and bootup take?
big pc man

Offline dentonlt

  • Sr. Member
  • ****
  • Posts: 307
    • the trombone analog
Re: hibernate kit for TC 2.6
« Reply #5 on: December 13, 2009, 01:14:15 PM »
Suspend: basically immediate up/down time - less than 5 sec each.
Hibernate: about 10 seconds down, then 20 or so up (rough guess).

I'll time these and get specific answers. I assume timings will vary dependent upon hardware and what is running.

I sync and clear the cache just before hibernating, and that works for me. May not be for everyone, though.

Offline dentonlt

  • Sr. Member
  • ****
  • Posts: 307
    • the trombone analog
Re: hibernate kit for TC 2.6
« Reply #6 on: December 13, 2009, 02:36:22 PM »
Timings on 2.6.1. One time through each, me sitting with a physical stop watch.

Normal shutdown: 10 sec
Normal boot: 34 sec

Suspend down: 2 sec
Suspend up: 4 sec

Nothing running:
Hibernate down: 12 sec
Hibernate up: 32 sec

Running firefox, leafpad, pcmanfm
Hibernate down: 12 sec
Hibernate up: 32 sec

Nothing special - go figure! Good if you want to leave things running.

I've been using hibernate when carrying around my netbook during the day (at work). Good for traveling on the train, squeezing in work b/t meetings, etc.

At home, when I have a random set of extensions loaded, it's nice to keep them there rather than having to manually re-apply the set. I'm trying to tackle the same problem with the extension profiler script thing.

Offline dentonlt

  • Sr. Member
  • ****
  • Posts: 307
    • the trombone analog
Re: hibernate kit for TC 2.6
« Reply #7 on: December 22, 2009, 06:53:22 AM »
Script works for 2.7 ok. Updates:

* no longer need to dig up resume binary
* simplified dependency checking
* corrected error on advdef prompt

I'm trying to get the splash to work. We'll see what happens.

Offline dentonlt

  • Sr. Member
  • ****
  • Posts: 307
    • the trombone analog
Re: hibernate kit for TC
« Reply #8 on: February 16, 2010, 12:00:12 PM »
Updated for TC 2.8
Tested/running on HP Mini 1001

I am using my Mini more often as I travel/work, so I needed auto-suspend and auto-hibernate. To auto-magically call suspend, use xautolock (see the repository for extension). Easy to chain them together using a script/wrapper and setting a wake alarm at /proc/acpi/alarm.

Happy hibernating.

Offline dentonlt

  • Sr. Member
  • ****
  • Posts: 307
    • the trombone analog
Re: hibernate kit for TC
« Reply #9 on: March 07, 2010, 06:49:51 PM »
Hibernate Kit for TC 2.9
Log in to see attached tar.gz.

* updated patches for 2.9 version of etc/init.d/tc-config
* now checks whether patches were successfully applied

As usual, tested and running on my HP Mini 1001.


Offline jawaharpeter

  • WikiUser
  • *
  • Posts: 2
Re: hibernate kit for TC
« Reply #10 on: August 05, 2011, 11:19:21 PM »
i need this kit for latest tc 3.8 .pl help

Offline dentonlt

  • Sr. Member
  • ****
  • Posts: 307
    • the trombone analog
Re: hibernate kit for TC
« Reply #11 on: August 05, 2011, 11:29:29 PM »
Hi, jp. Sorry, I actually haven't made any since those above (2.9).

Before you jump at doing it ... you might conclude (as I did) that hibernate is not all that useful in a TC environment. The more extensions you have loaded, the longer "wake up" takes. Generally, that time frame is near/similar the amount of time it takes to boot cold, re-installing all those extensions. Or at least that's been my experience. For quite awhile, I've just been using the suspend extension.

If you're gung-ho to do it yourself, follow the details above. You'll find all the info you need to figure it out. Read the scripts, the other thread posts, etc.

DLT

Offline dentonlt

  • Sr. Member
  • ****
  • Posts: 307
    • the trombone analog
Re: hibernate kit for TC
« Reply #12 on: October 06, 2011, 11:46:05 PM »
Ok, since jp asked, it's been on my mind ... and I've decided to try it out again (!).

Attached, hibernate kit for TC 4.0.1. Tested and working on an HP Mini 1001 netbook.

You might want to wrap your s2disk call in a script to hold/restore your settings. I've attached mine as a sample - it will -not- work out of the box (it calls some other original scripts ...). Mine:
(1) chvt to a text terminal before s2disk, then back to GUI after
(2) drop network connections, restore after resume
(3) restore video settings after resume (my 915resolution settings get lost, so I reset those)

Happy hibernating.

Offline netnomad

  • Hero Member
  • *****
  • Posts: 1027
Re: hibernate kit for TC
« Reply #13 on: October 07, 2011, 12:35:44 AM »
hi dentonit,

in what kind of modes of operation, booting, installation did you use that script?
do you think it works on a usb-stick, mount mode: tcz/install, mount-loop under /tmp/tcloop?
what kind of swap does it need, is it possible with a swap file on the booted usb-stick or even in the zramswap?

that's a great field, thank you for your digging.

Offline dentonlt

  • Sr. Member
  • ****
  • Posts: 307
    • the trombone analog
Re: hibernate kit for TC
« Reply #14 on: October 07, 2011, 06:28:32 AM »
Good ideas, netnomad - I hadn't really considered these! In short: I think it should work on any boot/mount modes, I don't believe zram will help, and USB boot/hibernate is a great idea.

Mount Modes and boot modes: As long as the kernel and initrd are consistent, I don't think mount and boot modes will matter (knock on wood). On the other hand, I've only used/tested it on frugal. Right now I use frugal + persistent home + persistent opt; some extensions are looped, others installed. I tested the 2.x patches on frugal install with base/norestore.

Swap: this is storage for the system snapshot - it has to be non-volatile (stable during power off). Otherwise, I believe it is possible to boot off of just about anything, hibernate onto any [non-volatile] partition, and resume.

From what I remember, the resume binary/program doesn't actually have OS-managed access to the drive because resume is running before the OS is up. Since the storage media isn't actually "mounted", s2disk looks for the hibernate image by physical location, not file name. To avoid some problems (like overwriting useful data), I ask s2disk to hibernate onto an unused partition: my linux swap partition.

From what I understand, zRAM is a compression/algorithm for using RAM as swap space during normal operations? If that's right, I'm pretty certain zswap won't/can't be useful in the hibernate process (without some major coding).

Swap/hibernate using USB: really cool idea, though access to the USB drive (and hub) may not be available during resume. I would expect it to vary amongst hardware - just gotta test to find out. I'll put that on the todo list.

Thanks for asking - glad somebody is considering it.

DLT