Slashdot: News for Nerds


Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Longer Laptop Battery Life under Linux

Hemos posted more than 8 years ago | from the making-it-work-better dept.

Power 45

ThinkingInBinary writes "Want easier power management and better battery life on your Linux laptop? Try powermgr, a daemon that automatically (or manually, if you choose) switches your system between power "profiles". It has support for ACPI (of course) as well as Asus, Dell, IBM, Omnibook, and Toshiba extensions. It can control CPU governor, screen brightness, wireless card, laptop mode (via services), runlevel, services, and more, and can switch based on AC adapter and battery state, load average, temperature, running processes, and more. Tests indicate that it can prolong battery life by 20 minutes to almost two hours, depending on what the system is doing. Try it out!"

cancel ×


I'm Running Gentoo... (2, Funny)

repruhsent (672799) | more than 8 years ago | (#14651199) this obviously doesn't do much for me since my laptop is under a constant 100% CPU load due to constant recompiling.

Re:I'm Running Gentoo... (1)

ThinkingInBinary (899485) | more than 8 years ago | (#14659003)

my laptop is under a constant 100% CPU load due to constant recompiling.

Oh, you're not the only one! ;-)

Personally I prefer to run compiles overnight while it's plugged in, but... to each his own. BTW, powermgr is great at minimizing the impact of compilation to your battery life. Just set PORTAGE_NICENESS to a positive value and then select a CPU governor that ignores nice time. Then compiles won't make your CPU run faster, but your own processes will.

Not Just Laptops (5, Insightful)

Bad to the Ben (871357) | more than 8 years ago | (#14651231)

Why just the emphasis on laptops?

Wasted energy from a wall outlet is still wasted energy. Transferring the energy-saving mindset to the desktop would likely have some positive results, especially for all those people using a 3GHz machine to play Freecell and send a few emails.

Re:Not Just Laptops (4, Insightful)

cnelzie (451984) | more than 8 years ago | (#14651253)

Since when do desktop PCs feature throttle capable PCs, adjustable brigthness Flatpanels and other software adjustable power settings? (Besides putting the PC into the ever energy wasting "Sleep" mode.)

Re:Not Just Laptops (1)

MightyYar (622222) | more than 8 years ago | (#14651273)

Seriously, even trying to turn on "spin down hard drives" crashes my old Thunderbird machine.

Re:Not Just Laptops (4, Informative)

Bad to the Ben (871357) | more than 8 years ago | (#14651323)

AMD's Cool 'n' Quiet [] technology supposedly intelligently scales.

In addition, you can already do things such as underclock video cards, and disable certain boards such as NICs and sound cards via software. I can't see why it couldn't be added to a power management function.

You are correct about the flatpanel one AFAIK.

Re:Not Just Laptops (3, Informative)

ThinkingInBinary (899485) | more than 8 years ago | (#14652196)

I'd be glad to add features to do such things to powermgr; just tell me what package is required and the command to execute, and I'll add support for it. Personally, I only have an Asus laptop, so the Dell, IBM, Omnibook, and Toshiba features were mostly added by reading the man pages for the respective tools. Thus I would need a good description of how to activate a feature before I can implement it.

Once you know how, post it in the tracker, or, if you can't, email it to me at thomastuttle(at)

Re:Not Just Laptops (1)

Bad to the Ben (871357) | more than 8 years ago | (#14657739)

Email sent. Thanks for the reply :) .

Re:Not Just Laptops (1)

Sensible Clod (771142) | more than 8 years ago | (#14652984)

Yes, Athlon64's do scale, but...

I have an Athlon64 (desktop) with C&Q, and it didn't do that on its own. I had to set up cpuspeed daemon to do that. It is quite effective. When idling at 1GHz, the CPU draws about 21W, as opposed to 67 when running at 2GHz.

Furthermore, it seems to me that C&Q is more about the CPU fan speed than just scaling. My system does automatically slow the fan when the CPU is cool (~3400-4000 RPM), and it speeds it up when the chip heats up (up to ~5500 RPM, very very noisy).

As far as I can tell, scaling is controlled in software, but C&Q appears to be handled by the BIOS (although you can use the Windows-only C&Q utility to change settings on-the-fly).

Re:Not Just Laptops (1)

Jonner (189691) | more than 8 years ago | (#14653317)

Cool'n Quiet is basically CPU frequency scaling. It works quite well on my desktop machine. I just use Linux's ondemand cpu governor and the CPU stays at 1GHz most of time. Whenever it needs it, it bumps itself up to 2GHz. The motherboard can keep the CPU fan spinning more slowly (because the CPU is cooler) and I never notice the difference in performance.

Re:Not Just Laptops (1)

ottothecow (600101) | more than 8 years ago | (#14653434)

I love my cool and quiet combined with the Asus Speedfan and a zalman cooler on my windows box. With cool and quiet, it both underclocks AND undervolts the CPU down to 800mhz at ~1.3v (as opposed to 2000mhz at 1.5V). With Speedfan enabled, the fan only spins when the CPU reaches a certain temp threshold which happens less often when it is throttled down and with the zalman cooler, it is fairly good at cooling with only the case airflow so the fan has to spin up even less often. Overall this saves electricity and creates a quieter computer.

Re:Not Just Laptops (1)

The Other White Boy (626206) | more than 8 years ago | (#14651332)

check out the Cool'n'Quiet [] technology in the AMD64 processor line.

Re:Not Just Laptops (1)

barawn (25691) | more than 8 years ago | (#14652115)

Er? Most computers have a slew of power-saving features on each chip. Unfortunately ACPI can be a bit buggy due to lack of information available on the chips themselves.

At the very least, users concerned about power management should make sure that the idle loop uses HLT (if that works, which it should on most modern PCs), and a little poking around like here for old Athlons [] and you can usually find ways to kick your computer into a much lower-power state.

And I cannot understand why people think Sleep mode is wasteful. Plenty of people leave their computers on all the time. I'd rather have them put them in Sleep when they're not used than leave them on. Sure, I'd rather them turn them off, but I'd like a million dollars, too.

Re:Not Just Laptops (1)

dstone (191334) | more than 8 years ago | (#14652125)

Since when do desktop PCs feature throttle capable PCs

Since at least last fall. Motherboard/chipset combos from several manufacturers support CPU clock throttling for Pentium M on the desktop. A couple of examples are DFI's 855GME-MGF and AOpen's i915GMm-HFS. There's another AOpen model (name escapes me) that also supports independent FSB clock throttling.

Re:Not Just Laptops (1)

riflemann (190895) | more than 8 years ago | (#14652340)

I have a P4 2.4GHz machine (Asus T2 machine) and its cpu will happily throttle down to 300MHz. The kernel 'ondemand' governor does wonders. And my LCD supports DPMS power saving modes, plus disks can be spun down. That's gotta be a good amount of savings in that bunch.

Shame that sleep mode (suspend to ram) doesn't work for me.

Re:Not Just Laptops (2, Interesting)

arivanov (12034) | more than 8 years ago | (#14654224)

Every Pentium 4 ever shipped has it. All Intel chipsets for Pentium 4 have it as well.

Same for Pentium 4 derived Xeons.

Same for Via though it really starts to play from Nehemia core upwards. That is if you are interested in dropping your power consumption from 7W to 1W.

Same for Opteron, but there is no proper SMP support in most motherboards. Dunno about Duron. Do not smoke that...

I run it on everything even servers. Drops idle power consumption by up to 75-80W per CPU.

Re:Not Just Laptops (1)

borggraefe (221491) | more than 8 years ago | (#14651472)

I had great success with athcool ( ares.html [] , but it is also included in many distributions) on my Athlon 1800 XP+ desktop system. The temperature of my processor did go down from 65C to 45C which also indicates a great amount of saved power.

So if you use an Athlon or Duron system I suggest to give this tool a try.


Re:Not Just Laptops (1)

ThinkingInBinary (899485) | more than 8 years ago | (#14652091)

Why just the emphasis on laptops?

There's no particular emphasis on laptops; it's just that laptops are the main use for it. It would probably work just as well on a desktop, but it would be less useful, because its main "feature" is the ability to automatically select profiles. If you just want to set up a CPU governor in the kernel to keep your CPU cooler when idle, you don't need powermgr. Also, more laptops have proprietary (non-ACPI and non-cpufreq) systems with nonstandard driver interfaces, and powermgr allows you to use, for example, the Dell laptop extensions, in the same way you would use the regular ACPI features.

Re:Not Just Laptops (1)

TheCreeep (794716) | more than 8 years ago | (#14653240)

I play Minesweeper you insensitive clod!!

Re:Not Just Laptops (0)

Anonymous Coward | more than 8 years ago | (#14653540)

And on that note, let me just say that it pisses me off that all I have is an old PIII, 500Mhz that is used for compiling, mysql, jabber, ldap, a general desktop while other people are using those 2 and 3Ghz machines to check out "teh internets" and send some emails. I used to work at a place that had 3Ghz machines just to run a simple cash register program.

Woooh! 20 minutes more time for Slashdot... (1, Troll)

What the Frag (951841) | more than 8 years ago | (#14651238)

... but d'oh, I'm using Gentoo. Must compile faster!

Not so great... (5, Interesting)

FunnyLookinHat (718270) | more than 8 years ago | (#14651269)

It still has some issues with it being set to run or not. I run this on my ubuntu setup for my IBM T43 and if you unplug the laptop and plug it back in, it thinks it is still unplugged. Thus, the screen turns off after set ammount of time, etc. etc. (which I prefer to be always on if it's plugged in). And changing it's settings are buggy.

It does get me over 3 hours of battery life, however, with my centrino processor which I really can't complain about. And with full brightness I still get 2 hours so long as I'm not doing any gaming or anything (DVD = over 2 hours low brightness)

Re:Not so great... (-1, Troll)

Gothmolly (148874) | more than 8 years ago | (#14651555)

OMFG, Ubuntu has a problem? Say it isn't so!!1! You must be a Mandrake Troll! Nothing is wrong with Ubuntu!

Re:Not so great... (2, Informative)

ThinkingInBinary (899485) | more than 8 years ago | (#14652133)

This is probably due to a timing issue where powermgr is still checking the system when you plug it back in the second time; I'll take a look at it. Please post bug reports on the tracker or, if you don't have a login, email them to thomastuttle(at) I'd be glad to try to fix any problems you have.

Random comments (2)

belg4mit (152620) | more than 8 years ago | (#14651293)

No laptop to try it on, but the code seems to be not awful (though a file named
"include" for a few subs out in its own place on the drive is questionable). A
direct link on the sf site instead of a hlaf-dozen clicks would be nice. The
biggest thing of note is that it seems to be slightly Gentoo specific:
#!/sbin/runscript in powermgr, and the use of an external binary named osd_cat.

Re:Random comments (1)

ThinkingInBinary (899485) | more than 8 years ago | (#14652157)

Thanks. ;-) The code is pretty good, given that it was my first attempt at a not-tiny, not-CGI project in Perl. Sorry about the linkage, but it saves me from having to update the link on the homepage ( every time I put out a new release.

I'll take a look at the Gentoo-specific issues; if you could file a bug report on the tracker or, in lieu of that, send me an email at thomastuttle(at), I'll probably get to it sooner.

hard drive problems and pm (2, Interesting)

Anonymous Coward | more than 8 years ago | (#14651386)

One of the issues I see coming up on the debian/gnome planets is developers whose notebook hard drives are dying prematurely because of all the parking/unparking of the heads etc. I have seen recommendations to disable power management on notebook hard drives for this reason and have done so on my own. The constant sound of the hard drive parking and unparking is annoying and on another thinkpad, i hear a regular soft beep every couple of seconds which is supposedly related.

due to these issues (and slashdot stories of burned cd's and dvd's expiring prematurely) i have bought some USB flash keys and an external usb hard drive (which i keep off except when i use it) for backups!

Not only laptops (4, Informative)

ggambett (611421) | more than 8 years ago | (#14651414)

I've recently went through this, but not for a laptop, but a Pentium 100 with 64 MB, running FC3 acting as an ADSL router and Subversion server (!).

Essentially I activated the "laptop mode" kernel variable (/proc/sys/vm/laptop_mode or similar), set the hard drives to spin down after 30 seconds using hdparm, killed all the unneeded services, and cleaned up the crontab; sa in particular was causing the hard disks to spin up every 10 minutes, which I wanted to avoid. This took me a while to figure out.

Now I have a very silent, very cool (as in temperature) "server".

Re:Not only laptops (1)

trafik (707566) | more than 8 years ago | (#14651663)

What is "sa"?

Re:Not only laptops (1)

ggambett (611421) | more than 8 years ago | (#14651927)

I meant sysstat ( [] ). The log directory is /var/log/sa. Sorry for the confusion.

Re:Not only laptops (0)

Anonymous Coward | more than 8 years ago | (#14657086)

One trick is to mount /var/log as a ramdisk, making sure the size is large enough for the time period between purges.

Re:Not only laptops (1)

orkysoft (93727) | more than 8 years ago | (#14651673)

Ah, you regard your harddisk as an unnecessary service as well?

Re:Not only laptops (2, Informative)

ars (79600) | more than 8 years ago | (#14651713)

"set the hard drives to spin down after 30 seconds"

You better have good backups. Desktop hard disks aren't designed to spin up/down that often. Remember each spin up and down means contact and rubbing on the head surface.

I'd be suprised if the hd lasted more then a year.

Laptop hd's are (hopefully) designed with loading technology that move the heads aways from any contact at all with the surface. They do that a: for spin up/down and also b: so you minimize the risk of a head slap, what with laptops moving so much.

Also, with a 3.5inch disk, the energy used just to spin it up is more then the energy used in letting it spin. Approxmiately a spin up costs as much as 30 seconds of spin time. 2.5 inch disks are much lighter, and they are designed to read data before it's fully spun up.

Re:Not only laptops (1)

lkeagle (519176) | more than 8 years ago | (#14651805)

I don't understand... Since when does a head ever come in contact with a platter surface?

In my experience, that usually creates a truly frightening sound and an extreme amount of data loss...

Re:Not only laptops (2, Informative)

ars (79600) | more than 8 years ago | (#14651911)

"I don't understand... Since when does a head ever come in contact with a platter surface?"

Every time you turn it on and off. Really. It rubs on the surface until the platter spins fast enough to provide lift (like a wing) for the head. That's why I keep mine on 24x7. IBM patented a head load unload safety ramp to stop this from happening. But as far as I know no one else uses it.

"In my experience, that usually creates a truly frightening sound and an extreme amount of data loss..."

No, the noise (if you hear one) is bearings that died.

Also, the hd parks it's heads before letting them touch the surface, so they touch a special area of the platter that has no data on it.

Re:Not only laptops (1)

ggambett (611421) | more than 8 years ago | (#14651861)

30 secs is not "that often", but "that fast". Since I disabled every service I don't need, the hard disk rarely spins up now; when it does, it's a batch of activity (usually svn commit or svn checkout) and then it remains unused for several hours more. The 30 seconds rule (I have it at 1 minute, actually) makes it spin down quickly after I used it, not spin down every minute.

Re:Not only laptops (1)

Nimey (114278) | more than 8 years ago | (#14651960)

Modern hard drives (at least since the early '90s) automatically park their heads in a safe area that doesn't hold data.

The heads could still stick to the safe area, but a good whack should unstick them.

noatime (1)

ggambett (611421) | more than 8 years ago | (#14652001)

I forgot another trick to avoid useless hard disk spinups : remount your filesystems with the noatime option.

Re:noatime (1)

ThinkingInBinary (899485) | more than 8 years ago | (#14652266)

remount your filesystems with the noatime option.

The laptop-mode-tools script that powermgr calls (or that you use, without powermgr) can and should do this automatically.

Re:Not only laptops (1)

rrohbeck (944847) | more than 8 years ago | (#14655951)

Just note that, while they are spec'd at 30,000 to 50,000 start/stop cycles, non-laptop drives are not designed for this kind of stress (and, believe me, it's a lot of stress for the head without ramp load.)

Since very few people run desktop and server drives with frequent start/stops, manufacturers have little experience with it. It's one of those specs like MTBF that's pretty theoretical, and, worse, impossible to prove unless you run a large population with frequent start/stops, since there's no field data. Yes, manufacturers run CSS tests in the lab, but those are not under real life conditions (e.g. they are run with one CSS per minute to get the test over with.) Hence it is quite possible that there are skeletons in the closet that nobody has found.

I wouldn't do it. Assuming 10% of the spec (3,000 or 5,000) is a safe bet, you would get there pretty soon. I've seen more problems with start/stop than I care to remember.


Written in perl? (-1, Flamebait)

Anonymous Coward | more than 8 years ago | (#14651766)

Written in Perl and not Ruby.. :( Maybe someone will port the app to a readable language.

Re:Written in perl? (1)

voxel (70407) | more than 8 years ago | (#14652005)

You can't read perl? I could read perl when I was 6. I could speak perl when I was 4.

Ruby?! Now thats a foriegn language to us all.

better use powersave (1, Interesting)

Anonymous Coward | more than 8 years ago | (#14653013) []

it has a nice front end - namely kpowersave.

1. Auto suspend when inactive after x minutes
2. hard disk settings
3. all CPU governors are derived from kernel

Nifty idea (1)

memco (721915) | more than 8 years ago | (#14658240)

Sounds a lot like what apple has done on their laptops with being able to choose (auto or manually) different profiles based on power needs and plugged vs. wireless.
Check for New Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Create a Slashdot Account