Tiny Core Linux

Tiny Core Extensions => TCE Talk => Extension requests => Topic started by: emninger on November 18, 2015, 01:48:12 PM

Title: pm-utils and/or uswsusp
Post by: emninger on November 18, 2015, 01:48:12 PM
I do not find nothing in the extensions regard powermanagement, exception made for the xfce power manager. I'd like to have pm-utils to be able to do s2ram.
Title: Re: pm-utils and/or uswsusp
Post by: Misalf on November 18, 2015, 02:32:17 PM
You can set your box to Suspend to RAM like so:
Code: [Select]
sudo su "root" -c "echo -n mem > /sys/power/state"

If you have a swap partition or a swap file you can use Suspend to DISK:
Code: [Select]
sudo su "root" -c "echo -n disk > /sys/power/state"

I didn't play with these two yet...
Code: [Select]
sudo su "root" -c "echo -n standby > /sys/power/state"
Code: [Select]
sudo su "root" -c "echo -n freeze > /sys/power/state"
Title: Re: pm-utils and/or uswsusp
Post by: emninger on November 18, 2015, 05:23:43 PM
You can set your box to Suspend to RAM like so:
Code: [Select]
sudo su "root" -c "echo -n mem > /sys/power/state"

If you have a swap partition or a swap file you can use Suspend to DISK:
Code: [Select]
sudo su "root" -c "echo -n disk > /sys/power/state"

I didn't play with these two yet...
Code: [Select]
sudo su "root" -c "echo -n standby > /sys/power/state"
Code: [Select]
sudo su "root" -c "echo -n freeze > /sys/power/state"

Wow, great! Thanks a lot!
Title: Re: pm-utils and/or uswsusp
Post by: hiro on November 18, 2015, 05:40:31 PM
sudo su is redundant. su "root" is also redundant.
use sudo sh -c instead.
Title: Re: pm-utils and/or uswsusp
Post by: Misalf on November 18, 2015, 06:00:08 PM
True. Not sure why I had these entries in my WM for so long.
Adjusted. Thanks.
Title: Re: pm-utils and/or uswsusp
Post by: emninger on November 18, 2015, 07:09:41 PM
Just a question: I created a shell script with the command (corrected ;) ). Now i'd like to find the way how to make it executed on close_lid. But i do not see how.

What i did is to execute it by a fluxbox shortcut (key).
Title: Re: pm-utils and/or uswsusp
Post by: hiro on November 19, 2015, 03:56:56 AM
I run it from /usr/local/etc/acpi/actions/lm_lid.sh, but acpid needs to be running and there needs to be the right /usr/local/etc/acpi/events/lm_lid pointing to the action
Title: Re: pm-utils and/or uswsusp
Post by: emninger on November 27, 2015, 05:56:23 PM
....
If you have a swap partition or a swap file you can use Suspend to DISK:
Code: [Select]
sudo su "root" -c "echo -n disk > /sys/power/state"
....

You're sure it works also with a swapfile (not partition!)? And what would happen, if the swapfile has not enough space? (i set a swapfile of 1 gig which is the same as the ram on the netbook. To not loose too much of disposable space of the internal sata flashdisk, which is pretty fast though. But i see, sometimes there are used for swap 100/200 mb).
Title: Re: pm-utils and/or uswsusp
Post by: Misalf on November 28, 2015, 01:50:01 PM
In theory yes.
https://www.kernel.org/doc/Documentation/power/swsusp-and-swap-files.txt

I couldn't get it to work though.
Code: [Select]
sudo sh -c "echo -n shutdown > /sys/power/disk" ; sudo sh -c "echo -n disk > /sys/power/state"
sh: write error: No such device

Swap file / partition needs to be larger than RAM.

In addition to the boot code  resume=/dev/sdXY , also  resume_offset=  is needed.
e2fsprogs.tcz  contains  filefrag  which can be used to get the file header offset of the swap file.
Code: [Select]
sudo filefrag -v /mnt/sda3/tc.swp | grep -m1 "0:"

filefrag  doesn't seem to work for a swap file stored on a FAT formatted partition.
Title: Re: pm-utils and/or uswsusp
Post by: emninger on December 02, 2015, 05:21:31 PM
Ok. Practically, i can live with STR only. It's more a matter of perfectionism to get working STD as well.

In any case, my situation is this: Netbook with 1 gig ram, and 16 gig internal sata flash disk. Since i'm encountering trouble with the zram-swap option and the sata flash is decently fast i thought a swapfile might be an option. Since you're saying it should be larger than the ram: By how much? I'd prefer to waste as little as possible of the storing space ;)

Thanks a lot in advance!