You are not logged in.

#1 2007-08-27 03:19:38

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

http://wiki.archlinux.org/index.php/Pm-utils
http://wiki.archlinux.org/index.php/Cpufrequtils
http://wiki.archlinux.org/index.php/Acpid

I'm working on 3 new wikis that will hopefully cover all of the core power management features commonly sought after by users.  When all three are finalized, I'll put together a general wiki explaining the three tools at a glance and how they relate to each other.

These wikis will help you configure:
* Suspend/hibernate
* CPU frequency scaling (aka speedstepping)
* Daemonized ACPI functions such as laptop lid closures and power/sleep button customizations

To help clear up some commonly asked questions....
* Powersave is no longer available, it has been replaced by pm-utils, a project led by the OpenSUSE community
* pm-utils does not provide CPU frequency scaling, unlike powersave...use cpufrequtils instead
* Triggered events (e.g. suspend-on-lid-closure) can be easily configured with the acpid daemon

Comments are welcome, and if anyone would like to add anything, please do.

Last edited by thayer.w (2007-08-29 18:00:11)


thayer williams ~ cinderwick.ca

Offline

#2 2007-08-29 08:08:47

innkeeper
Member
Registered: 2006-07-06
Posts: 11

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

Both pm-suspend and pm-hibernate are usually called from HAL, initiated by desktop applets as gnome-power-manager or kpowersave.

I'm using neither kde nor gnome and will hate to do this. How I can use pm-utils then? With powersave I was able to suspend my laptop without any WM by just closing it. What so great with pm-utils, if it replaces powersave without the same functionality?

Last edited by innkeeper (2007-08-29 08:09:48)

Offline

#3 2007-08-29 10:56:31

awagner
Member
From: Mainz, Germany
Registered: 2007-08-24
Posts: 189

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

innkeeper wrote:

Both pm-suspend and pm-hibernate are usually called from HAL, initiated by desktop applets as gnome-power-manager or kpowersave.

I'm using neither kde nor gnome and will hate to do this. How I can use pm-utils then? With powersave I was able to suspend my laptop without any WM by just closing it. What so great with pm-utils, if it replaces powersave without the same functionality?

I'm currently struggling with getting my suspending and cpufreq'ing set up as well. I have not tried it, but I could imagine a solution to your problem could look like the one in this thread, only with /usr/sbin/pm-hibernate instead of poweroff/whatever. And of course, one would have to first make sure that hibernating with pm-hibernate works at all (by running it as root).

HTH,
Andreas

Last edited by awagner (2007-08-29 11:08:38)

Offline

#4 2007-08-29 11:39:29

Allan
Developer
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,432
Website

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

I have been reading these wiki entries as they were bing created/adjusted over the last few days.

From my research into pm-utils, you are correct in that it does not do cpu scaling.

I have a question regarding pm-utils though.  I have gnome-power-manager installed and it does suspend/hibernate OK without installing pm-utils.  There are a couple of issues that I think I could fix but adding hooks with pm-utils (screen not turning back on and networkmanger requiring a restart).  If I don't have pm-utils installed, what is HAL using to control suspend an can I adjust the config for that somehow?  (Also don't have hibernate script, laptop-mode-tools etc installed).

Offline

#5 2007-08-29 15:29:10

cheer
Member
From: Russia, St. Petersburg
Registered: 2006-08-02
Posts: 131

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

I simply run pm-hibernate and pm-suspend, from konsole. I don't have HAL. It works flawlessly.

Offline

#6 2007-08-29 15:30:44

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

innkeeper:  I believe you will need the acpid daemon running in order for that to work.  You can specific the command to run when the laptop lid is closed by editing /etc/acpi/handler.sh.  For example, to lock the screen (with xscreensaver) when the lid is closed you would add this to the appropriate section:
    button/lid)
        #echo "LID switched!">/dev/tty5
        /usr/bin/xscreensaver-command -lock
        ;;

To trigger a pm-utils scripts you would instead specify /usr/sbin/pm-suspend for suspend2ram, or /usr/sbin/pm-hibernate for suspend2disk functionality.  You'll need to restart the daemon after making these changes to /etc/acpi/handler.sh

Allen: I believe acpi (and/or acpid?) is managing your events if you have nothing else installed.  I could be wrong, but it would seem the only logical conclusion.


thayer williams ~ cinderwick.ca

Offline

#7 2007-08-29 16:48:02

harlekin
Member
From: Germany
Registered: 2006-07-13
Posts: 408

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

Great work!
I will test both of the wikis as I am quite interested in those features.

Right now I don't have enough time, to test it and so I just overflew the articles. I didn't find anything mentioned about encryption. Does this method work with an encrypted swap partition? Or if not, are there other possibilities?


Hail to the thief!

Offline

#8 2007-08-29 18:31:43

innkeeper
Member
Registered: 2006-07-06
Posts: 11

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

Thanks guys. With acpi it works even faster (or it's just new kernel works faster :-) )

now I'm happy again!

thayer.w it would be great if you add this how-to in the wiki ;-) thanks a lot

Offline

#9 2007-08-29 19:12:44

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

Glad it worked, innkeeper... The how-to will be added to the acpid wiki as soon as I have the time smile


thayer williams ~ cinderwick.ca

Offline

#10 2007-08-30 06:39:45

innkeeper
Member
Registered: 2006-07-06
Posts: 11

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

ac_test=$(/bin/cat /proc/acpi/ac_adapter/ACAD/state | /bin/grep off)
[ ! "$ac_test" = "" ] && /usr/sbin/pm-suspend

With code above you will have behavior similar to Vista. Your laptop will suspend only if AC is not plugged.

Offline

#11 2007-08-30 13:14:18

Allan
Developer
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,432
Website

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

thayer.w wrote:

Allen: I believe acpi (and/or acpid?) is managing your events if you have nothing else installed.  I could be wrong, but it would seem the only logical conclusion.

Thats what I thought, but I have neither acpi or acpid installed.  I have no idea what is doing the suspend!

Offline

#12 2007-08-30 13:18:07

cheer
Member
From: Russia, St. Petersburg
Registered: 2006-08-02
Posts: 131

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

Acpid, d stands for daemon. pm-utils are doing the suspend, while acpid is only managing your events.

Offline

#13 2007-08-30 13:32:58

Allan
Developer
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,432
Website

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

Right, but I have neither acpi(d) or pm-utils installed...  just gnome-power-manager.  I am just trying to find out where I should adjust the settings of whatever gpm is using to suspend.

Last edited by Allan (2007-08-30 13:33:53)

Offline

#14 2007-08-30 13:38:39

innkeeper
Member
Registered: 2006-07-06
Posts: 11

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

Now I come to situation when I want my laptop to suspend when battery is low :-)

So, acpid catches events. Is there any place where I can find what events are exists? If event "low battery" exists, then it's good. If it's not, then who emits events, and how to make it emit "low battery" event?

P.S. it's also possible to write your daemon, which will poll battery and suspend you laptop if needed. But I don't think it's a correct way.

P.P.S. Also gnome and kde shouldn't do these by themselves. In my opinion there must be a low level utility for power stuff, which works independently. And gnome or kde should only be able to configure this low level utility

Last edited by innkeeper (2007-08-30 13:39:46)

Offline

#15 2007-08-30 14:59:21

innkeeper
Member
Registered: 2006-07-06
Posts: 11

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

I've read a little about acpi and found out about acpi and acpitool utilities. Both available in arch repositories. I've read acpitool's man page and it seems quite similar to powersave (except it's only monitoring tool but not a daemon). I can do suspend with acpitool too. And it works as good as pm-suspend (pm-suspend-hybrid is not working yet, rigth?). Allan gnome-power-manager might use acpitool or libacpi. Here is written that you eve can suspend that way echo -n "x" > /sys/power/state (where "x" is sleep state) but it doesn't work for me.

I tried to find smt. about PM-utils in the internet to learn why people using it, but failed. Is there any special web-page about pm-utils?

http://lists.freedesktop.org/mailman/listinfo/pm-utils

Does not depend on HAL, although HAL will depend on it.

What does it mean?

Last edited by innkeeper (2007-08-30 15:12:46)

Offline

#16 2007-08-30 15:35:36

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

I believe we'll see pm-utils rolling into more distros over the coming months.  It is meant to replace the mash of scripts that various distros use for hibernate and suspend functions.  Pm-utils is, at the core, just a framework for these operations, however it has been designed to allow for modular scripts (see /usr/lib/pm-utils) which can apply common fixes to quirky hardware, allowing suspend/hibernate to work where other tools would not--e.g. hibernate-scripts, acpid.

I think the project is led by OpenSUSE community developers, and it appears to be endorsed by freedesktop.org, the same group that sets the bar for projects like Openbox and Xfce.

Acpid could do the same thing I suppose, however it appears to leave the advanced scripting up to the user.  I suppose you could customize acpid scripts to your hearts content, but then only you would have that configuration, whereas pm-utils is meant to have the more universal "It just works" design model.

I'm not sure what the statement about HAL is supposed to mean, but I do know that the hal daemon automatically loads the acpid daemon smile

Last edited by thayer.w (2007-08-30 15:39:09)


thayer williams ~ cinderwick.ca

Offline

#17 2007-08-30 16:14:44

innkeeper
Member
Registered: 2006-07-06
Posts: 11

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

Ok. If pm-utils is the framework which is more flexible and will help to implement better power management, I don't mind. pm-utils supports HAL - very good! I like all freedesktop.org's stuff, this is really good project! Their ideas are absolutely compatible to mine views :-) So if they somehow encourage us to use pm-utils, I would definitely try.

BUT. I still doesn't have the same functionality as powersave gives me. I understand that pm-utils alone will never give me that and I need additional software for that. Allan says that he can suspend his laptop without pm-utils, which means that gnome-power-manager doesn't use pm-utils (at least his version, I hope it's up-to-date). So what bundle of utilities will give me the same functionality as powersave gives me? If there is none, why I can't install powersave instead of pm-utils? Why pacman will insist on replacing powersave to pm-utils, but not to pm-utils + cpufrequtils + "some daemon to make it all work as it should"?

To whom I can complain ?-) Maybe to Jan de Groot? thayer.w do you know this guy ?-)

Last edited by innkeeper (2007-08-30 16:16:06)

Offline

#18 2007-08-30 16:53:33

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

Those are all good questions, innkeeper.  Unfortunately, I can only answer one... I do not know Jan de Groot smile

What I can say is that, as far as I know, pm-utils is only intended to be a universal solution for hibernate and suspend functions.  I believe they do not intend to include CPU frequency scaling, or ACPI events... but I could be wrong.

For the record though, the powersave package didn't control acpi events either.  Things like lid closure and sleep buttons have always been controlled by acpid and/or GUI tools like kpowersave and gnome-power-manager.  As I use neither KDE nor GNOME, I'm glad that acpid exists as a standalone option because it works great with my Openbox installation.

I don't know who made the call to completely replace powersave with pm-utils, but I agree it would be nice to have a choice.  I don't see why both can't be available from the repos.


thayer williams ~ cinderwick.ca

Offline

#19 2007-08-30 20:21:33

awagner
Member
From: Mainz, Germany
Registered: 2007-08-24
Posts: 189

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

I have one more set of utilities to throw into the mix. yikes

innkeeper wrote:

Now I come to situation when I want my laptop to suspend when battery is low :-)

extra/laptop-mode-tools
this handles events in coordination with kernel (laptop-mode being a kernel feature since 2.6.6) and acpid (it inserts events and actions that are executed additionally to what acpi's handler.sh specifies). Therefore maybe it would be cool to have it integrated on the acpid page. Based on battery level threshold it can - sync your hdd, switch to a more powerfriendly cpu frequency, hibernate/suspend, and more.

references: laptop-mode-tools homepage, Linux Journal Article and a forum thread.

When I get to it, I will try to add something about it in the three wiki pages you mentioned, thayer.w -- if you agree, that is.

HTH,
Andreas

PS. Innkeeper, could you try to make a list of what features there are that you expect from a powersave-replacement?
laptop-mode and software suspend are two examples of features where the heavy lifting is provided by the kernel, and you only need something to trigger the right thing - can be a daemon (like acpid, cpufreq, powersave) or a userspace resident program that does the polling or subscribes to some kernel notification and triggers whatever it thinks appropriate (such as kpowersave, gnome-power-manager). I am not sure into what category falls the original powersave.

Offline

#20 2007-08-30 20:28:45

awagner
Member
From: Mainz, Germany
Registered: 2007-08-24
Posts: 189

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

BTW, as for powersave, pm-utils, kpowersave and stuff, I really recommend to have a look at the pages and blogs of Holger Macht (blog), Stefan Seyfried (blog) and Danny Kukawka (blog) from openSuSE Mobile Devices Team.

Offline

#21 2007-09-02 10:44:09

Allan
Developer
From: Brisbane, AU
Registered: 2007-06-09
Posts: 10,432
Website

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

I installed pm-utils and from the log files gnome-power-manager will use that for suspend when it is there.  I have no idea what was doing the suspend beforehand (probably something in the "echo -n mem > /sys/power/state" style).

Anyway I added this to /etc/pm/sleep.d/000hacks to get my screen coming back and networkmanager to reconnect to wireless (ipw3945 clash - a known issue).

#!/bin/bash
case $1 in
    suspend)
        chvt 1
        vbetool vbestate save > /tmp/vbe
        ;;
    resume)
        vbetool post
        vbetool vbestate restore < /tmp/vbe
        /etc/rc.d/networkmanager restart
        chvt 7
        ;;
esac

Note that I didn't include hibernate/thaw because I only use suspend-to-ram.

Last edited by Allan (2007-09-02 10:45:38)

Offline

#22 2007-09-19 18:11:30

john_schaf
Member
From: France
Registered: 2007-02-24
Posts: 103

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

Hi there,

There is something confusing in the wiki (and also in the original suse one)

In section "Creating your own hooks" there is mention of a directory /etc/pm/hooks
but I don't think this is correct, or did I miss something ?
Should be /etc/pm/sleep.d as mentionned later

Same error again in "restarting the mouse" ???

Hope somebody can make that point clear.

Offline

#23 2007-09-19 20:54:32

eyolf
Member
From: Copenhagen
Registered: 2005-11-29
Posts: 334
Website

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

I followed the excellent guides, and ran into the following problem with the cpu scaling:
before, with powersaved, the cpu (dual core) usually was down at around 200Mz at moderate, non-powerconsuming use. Now, cpufreq-info reports that my hardware limits are 1-1.6 GHz, and sure enough,  with the powersave governor on, both processors are stuck at 1Ghz -- and the fans are kicking in every 30 seconds. Unbearable. Can I underclock it? Force a minimum value of 200 Mhz? (yes, I'm really sensitive to fan noise)

Offline

#24 2007-09-19 21:25:02

pelle.k
Member
From: Åre, Sweden (EU)
Registered: 2006-04-30
Posts: 667

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

Allan says that he can suspend his laptop without pm-utils, which means that gnome-power-manager doesn't use pm-utils

You are too rigid in your thinking. This is a snip of the HAL script that do "suspend" (from gpm), and as you can see it's as flexible as you make it. By default it supports powersave, pmi, pm-utils and regular kernel suspend;

/usr/lib/hal/scripts/linux/hal-system-power-suspend-linux

#Other distros just need to have *any* tools installed
else
        if [ -x "/usr/bin/powersave" ] ; then
            $POWERSAVED_SUSPEND2RAM
            RET=$?
        elif [ -x "/usr/sbin/pmi" ] ; then
            /usr/sbin/pmi action suspend force
            RET=$?
        elif [ -x "/usr/sbin/pm-suspend" ] ; then
                /usr/sbin/pm-suspend $QUIRKS
                RET=$?
        elif [ -w "/sys/power/state" ] ; then
            # Use the raw kernel sysfs interface
            echo "mem" > /sys/power/state
            RET=$?
        else
            # TODO: add other scripts support
            unsupported
            fi
        fi

"Your beliefs can be like fences that surround you.
You must first see them or you will not even realize that you are not free, simply because you will not see beyond the fences.
They will represent the boundaries of your experience."

SETH / Jane Roberts

Offline

#25 2007-09-19 21:59:14

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: Wikis: pm-utils, cpufrequtils, acpid (Core Power Management Tools)

eyolf wrote:

I followed the excellent guides, and ran into the following problem with the cpu scaling:
before, with powersaved, the cpu (dual core) usually was down at around 200Mz at moderate, non-powerconsuming use. Now, cpufreq-info reports that my hardware limits are 1-1.6 GHz, and sure enough,  with the powersave governor on, both processors are stuck at 1Ghz -- and the fans are kicking in every 30 seconds. Unbearable. Can I underclock it? Force a minimum value of 200 Mhz? (yes, I'm really sensitive to fan noise)

It might be the cpu scaling module you're using.  Different modules result in different min/max values.  For example, the acpi_cpufreq module appears to default to 1GHz as the minimum (at least on my machine), whereas the p4-clockmod module clocks the minimum at 250MHz for my CPU (a 2GHz Core Duo).


thayer williams ~ cinderwick.ca

Offline

Board footer

Powered by FluxBB