Can Puppy 'hibernate'...?

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

Can Puppy 'hibernate'...?

#1 Post by Mike Walsh »

Evening, kiddiwinks.

A question for y'all.....and some of you may know the answer to this already.

I know many newer Puppies come with the ability to 'suspend' built-in.....or can have that ability added. I believe radky's PupShutDown can add this.

I've added the ability to do this to many of my own Pups. I can't find the thread off-hand, but I do remember it was frenchiveruti who posted about the code that enabled this to happen:-

Code: Select all

echo -n mem > /sys/power/state
I've modified the 'ShutDown' GUI of the newer Puppies to incorporate a suspend button, and modified the commands in /etc/xdg/templates/_root_jwmrc to point to the wee script I put together to add the above command:-


Image


And it all works very well.

---------------------------------------------

The difference between 'suspend' and 'hibernate', it would seem, is that the former saves the current 'state of play' to RAM, then cuts power to everything else. RAM does, however, need a continuous low-power supply to the sticks to maintain that 'storage', since it's what's known as 'volatile'.

Thus, with suspend, the machine is never really powered-off, and is better for 'short-term' use.

Hibernate, on the other hand, saves the state-of-play to main storage, instead.....then shuts everything down as normal. So; if you're popping out for an hour or so, it's OK to use 'suspend'....whereas if you want to enable a rapid start the following morning (but want the machine powered-off completely overnight), you would use 'hibernate', instead.

So; question-time, boys & girls. Can Puppy "DO" hibernation, in addition to merely "suspending"?

Any info on this point will, as always, be very much appreciated.

TIA.


Mike. :wink:

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#2 Post by nic007 »

As far as I know there is not an equivalent for hibernation the Windows way. The options are limited to suspend to ram or suspend to hard disk (none of which cuts the power completely off like hibernation in Windows). My computer has only two power states, ie. S1 and S3. Hibernation is apparently S4 but I'm pretty sure I can put this machine into hibernation when using Windows because Windows can create a special "hibernation file" when you choose the hibernation option. BTW - I had to dig up one of my old posts to remember what I did to suspend automatically after a period of mouse inactivity: http://murga-linux.com/puppy/viewtopic. ... 295#951295
Last edited by nic007 on Wed 08 Jan 2020, 06:15, edited 2 times in total.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#3 Post by musher0 »

In answer to M_W's question:
NO. A puppy is not a bear! :lol: :lol:
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
paulh177
Posts: 975
Joined: Tue 22 Aug 2006, 20:41

#4 Post by paulh177 »

I've been niggling away at this for years, on and off, and I've never found a way to make it work.

Other Linuxes manage it, of course.

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#5 Post by Mike Walsh »

Mm.

See, I'm wondering, now. If you're wanting to 'save-to-disk' as opposed to 'save-to-RAM', would I be right in thinking that you would probably need to:-

a ) Save the current state of the initrd.gz, and
b ) The contents of all the various pup_ro layers?

Anybody have any idea as to what the contents of the

Code: Select all

/sys/power/state
.....file refers to? What does

Code: Select all

freeze standby mem disk
.....actually mean? I suspect this should provide a clue, though I'm not quite certain where to go from there....

Personally, I would have no issues with leaving the box in 'suspend' for longer periods, since I'm not exactly concerned with saving power as such. But if other Linux distros are capable of 'hibernating', then I see no reason why Pup shouldn't be capable of doing so.

Thoughts?


Mike. :wink:

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#6 Post by Mike Walsh »

Well; after some more research, it appears Nic was barking up the right tree, so to speak..!

Those power states, apparently, refer to 'actions' which the kernel in use is able to support.....so, in theory, at least, my box could hibernate. So far as the kernel is concerned,

Code: Select all

echo -n mem /sys/power/state
.....will 'suspend-to-RAM', and

Code: Select all

echo -n disk /sys/power/state
.....would 'hibernate' the contents of RAM. However, this particular 'action' must be supported by a specific BIOS setting; in this case, the one known as S2.

Like Nic, the big old Compaq's BIOS just supports S1 and S3. Which, when it boils right down to it, means that with the current BIOS, at least, this box would never 'hibernate' in a month of Sundays.....not even under Windows. The hardware won't permit it.

It's no use my attempting to find a newer BIOS. Although this BIOS is dated 2006, it's the very newest one available for this particular combination of MSI mobo & AMD CPU. Keisha & I did a lot of research a few years ago, back when I was upgrading the original single-core Athlon64 to the dual-core X2 version, since we 'flashed' the BIOS ROM chip here in Puppy; perfectly possible with the availability of the 'flashrom' utility, and the extensive instructions available on the Arch Linux wiki.

Anyways, at least I know there's no point pursuing this any further for myself. But for anybody wishing to pursue this further, for those whose BIOS supports the S2 power-state, I did find the following thread on the Linux Mint Forum from nearly a decade ago:-

https://forums.linuxmint.com/viewtopic.php?f=47&t=74010

Makes for very interesting reading, given that apparently Linux hibernates into your existing 'swap' space, rather than creating the special 'hiberfil.sys' file that Windows uses.....and then saving RAM state into that. And the 'suspend' action has been one of the ACPI 'states' supported by the mainline Linux kernel for a very long time.....


Mike. :wink:
Last edited by Mike Walsh on Wed 08 Jan 2020, 21:24, edited 1 time in total.

Dry Falls
Posts: 616
Joined: Tue 16 Dec 2014, 23:37
Location: Upper Columbia

#7 Post by Dry Falls »

Hybernation works, at least in lighthouse. To recover, use boot kernel parameter <resume=/dev/sdx> where sdx is the name of your swap partition/drive. The kernel (I presume) relabels the partition from "linux swap", so you'll be without a swap drive. Not sure the merge is complete after switch-root. All I know is it can be accomodated in the init script.

HerrBert
Posts: 152
Joined: Thu 03 Nov 2016, 15:11
Location: NRW, Germany

#8 Post by HerrBert »

Hibernation works if kernel is configured with CONFIG_HIBERNATION=y. Some older Puppy's kernels are not configured to allow hibernation.

From Kernel config help:
Hibernation (aka 'suspend to disk')

CONFIG_HIBERNATION:

Enable the suspend to disk (STD) functionality, which is usually
called "hibernation" in user interfaces. STD checkpoints the
system and powers it off; and restores that checkpoint on reboot.

You can suspend your machine with 'echo disk > /sys/power/state'
after placing resume=/dev/swappartition on the kernel command line
in your bootloader's configuration file.

Alternatively, you can use the additional userland tools available
from <http://suspend.sf.net>.

In principle it does not require ACPI or APM, although for example
ACPI will be used for the final steps when it is available. One
of the reasons to use software suspend is that the firmware hooks
for suspend states like suspend-to-RAM (STR) often don't work very
well with Linux.

It creates an image which is saved in your active swap. Upon the next
boot, pass the 'resume=/dev/swappartition' argument to the kernel to
have it detect the saved image, restore memory state from it, and
continue to run as before. If you do not want the previous state to
be reloaded, then use the 'noresume' kernel command line argument.
Note, however, that fsck will be run on your filesystems and you will
need to run mkswap against the swap partition used for the suspend.

It also works with swap files to a limited extent (for details see
<file:Documentation/power/swsusp-and-swap-files.txt>).

Right now you may boot without resuming and resume later but in the
meantime you cannot use the swap partition(s)/file(s) involved in
suspending. Also in this case you must not use the filesystems
that were mounted before the suspend. In particular, you MUST NOT
MOUNT any journaled filesystems mounted before the suspend or they
will get corrupted in a nasty way.

For more information take a look at <file:Documentation/power/swsusp.txt>.

Symbol: HIBERNATION [=y]
Type : boolean
Prompt: Hibernation (aka 'suspend to disk')
Location:
-> Power management and ACPI options
Defined at kernel/power/Kconfig:24
Depends on: SWAP [=y] && ARCH_HIBERNATION_POSSIBLE [=y]
Selects: HIBERNATE_CALLBACKS [=y] && LZO_COMPRESS [=y] && LZO_DECOMPRESS [=y] && CRC32 [=y]
I discarded my testing of hibernation in Puppy because resuming is quite slow (at least on my machine...) and in case of accidentially booting without boot parameter resume=/dev/yourswap your data on (previously) mounted drives will be corrupted as mentioned before.

Post Reply