WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: pm-utils and/or uswsusp  (Read 2649 times)

Offline emninger

  • Sr. Member
  • ****
  • Posts: 267
pm-utils and/or uswsusp
« on: November 18, 2015, 10:48:12 AM »
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.

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: pm-utils and/or uswsusp
« Reply #1 on: November 18, 2015, 11:32:17 AM »
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"
Download a copy and keep it handy: Core book ;)

Offline emninger

  • Sr. Member
  • ****
  • Posts: 267
Re: pm-utils and/or uswsusp
« Reply #2 on: November 18, 2015, 02: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!

Offline hiro

  • Hero Member
  • *****
  • Posts: 1217
Re: pm-utils and/or uswsusp
« Reply #3 on: November 18, 2015, 02:40:31 PM »
sudo su is redundant. su "root" is also redundant.
use sudo sh -c instead.

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: pm-utils and/or uswsusp
« Reply #4 on: November 18, 2015, 03:00:08 PM »
True. Not sure why I had these entries in my WM for so long.
Adjusted. Thanks.
Download a copy and keep it handy: Core book ;)

Offline emninger

  • Sr. Member
  • ****
  • Posts: 267
Re: pm-utils and/or uswsusp
« Reply #5 on: November 18, 2015, 04: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).

Offline hiro

  • Hero Member
  • *****
  • Posts: 1217
Re: pm-utils and/or uswsusp
« Reply #6 on: November 19, 2015, 12: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

Offline emninger

  • Sr. Member
  • ****
  • Posts: 267
Re: pm-utils and/or uswsusp
« Reply #7 on: November 27, 2015, 02: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).
« Last Edit: November 27, 2015, 03:02:03 PM by emninger »

Offline Misalf

  • Hero Member
  • *****
  • Posts: 1702
Re: pm-utils and/or uswsusp
« Reply #8 on: November 28, 2015, 10:50:01 AM »
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.
Download a copy and keep it handy: Core book ;)

Offline emninger

  • Sr. Member
  • ****
  • Posts: 267
Re: pm-utils and/or uswsusp
« Reply #9 on: December 02, 2015, 02: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!