Home
Home Blogs k4tz's blog
    • Blog
    • Clinic
    • Contact
    • Download
    • Video
    • Login

Poll

Favourite console text editor in Ubuntu:

LXer -- Linux and Open Source News

  • Striping Across Four Storage Nodes With GlusterFS On Fedora 12
  • CrossOver Linux 9: Run Windows apps without Windows
  • Ex-Sun man Bray takes on paranoid Android role at Google
  • Will a Linux Pad Ever Exist?
  • LXer Weekly Roundup for 14-Mar-2010
more

Linux Today

  • Get the Most Out of Your Open-Source Software With Redirection in Bash
  • Help Desk: Sudden But Inevitable Betrayal
  • 10 Annoying Habits of a Geeky Spouse (GeekDad Wayback Machine)
  • Introducing the PyPy 1.2 release
  • 10 Great Linux Apps You Might Not Have Discovered Yet
more

Linux Insider

  • North Korea's 'Red Star' Linux, and Is FOSS an Enemy of the State?
more

The simple & effective power management guide in Ubuntu (how to save battery power)

Submitted by k4tz on Thu, 11/19/2009 - 13:39
  • Blog
  • Hardware

Source: http://ubuntuforums.org/showthread.php?t=1326333

v 0.2 - This guide is written for Ubuntu 9.10 Karmic Koala

This guide is focused on how to implement most common power management tips, taken from the community and powertop suggestions, in the simplest way. Its aim is to be rock stable and quite effective without putting notebooks at risks. It has been tested by me on a Lenovo Thinkpad X60s with almost exclusively Intel hardware.

Hard disks
In Karmic hard drives are managed by a script and gnome-power-manager (g-p-m). The settings are very safe and probably there could still be some power to save but I prefer to play on the safe side with my hard disk.

I decided not to enable laptop-mode and not to play with the values in /usr/lib/pm-utils/power.d/95hdparm-apm or the seconds2sleep in gnome-power-manager.

Probably buying a good solid state drive could get much better results, but they are still very expensive.

Screen brightness
In karmic it is handled again by g-p-m, the standard values can be played with though.
Press alt+F2 and type

Code:
gconf-editor

scroll the "apps" section and open gnome-power-manager. The related part is "backlight". The "brightness_dim_battery" key is defaulted at 50, that means 50% reduction.

Personally I'm fine with the lowest brightness on my screen. Double click on the key name and instead of 50 write 99. Try different values to see which one is better for you, of course higher value, lower brightness, lower power consumption.

link power management policy
This is a tip among the ones suggested by running the powertop program (software center > powertop).
Run gedit (applications>accessories) and paste the following text in the empty document

Code:
#!/bin/sh

path_host0="/sys/class/scsi_host/host0/link_power_management_policy"
path_host1="/sys/class/scsi_host/host1/link_power_management_policy"
path_host2="/sys/class/scsi_host/host2/link_power_management_policy"
path_host3="/sys/class/scsi_host/host3/link_power_management_policy"
val=max_performance

case "$1" in
true)
echo "**lpm policy powersave ON"
val=min_power
;;
false)
echo "**lpm policy powersave OFF"
val=max_performance
;;
esac

# max_performance on AC min_power on battery

if [ -w "$path_host0" ] ; then
echo $val > $path_host0
fi

if [ -w "$path_host1" ] ; then
echo $val > $path_host1
fi

if [ -w "$path_host2" ] ; then
echo $val > $path_host2
fi

if [ -w "$path_host3" ] ; then
echo $val > $path_host3
fi

exit 0

close and save (in your home directory) calling it

Code:
link_pm_policy

Run a terminal (applications>accessories) and paste the following lines one at a time pressing return after each one

Code:
chmod 755 link_pm_policy
sudo su
install link_pm_policy /usr/lib/pm-utils/power.d/
exit

you WILL be asked for your password, just type it in and press return.

virtual machine dirty writeback
Again as suggested by powertop.
Run gedit (applications>accessories) and paste the following text in the empty document

Code:
#!/bin/sh

path_dwc="/proc/sys/vm/dirty_writeback_centisecs"
val=500

case "$1" in
true)
echo "**VM dirty writeback 15 seconds"
val=1500
;;
false)
echo "**VM dirty writeback 5 seconds"
val=500
;;
esac

# 5 seconds on AC, 15 seconds on battery

if [ -w "$path_dwc" ] ; then
echo $val > $path_dwc
fi

exit 0

close and save (in your home directory) calling it

Code:
vm_dirty_writeback

Run a terminal (applications>accessories) and paste the following lines one at a time pressing return after each one

Code:
chmod 755 vm_dirty_writeback
sudo su
install vm_dirty_writeback /usr/lib/pm-utils/power.d/
exit

you WILL be asked for your password, just type it in and press return.

Scheduling policy powersave
This is managed by a default script that comes with Karmic.

Usb auto suspend
This is a key issue for failure of power saving in Linux.
Run gedit (applications>accessories) and paste the following text in the empty document

Code:
#!/bin/bash
if [ "$1" = "true" ]; then

for i in /sys/bus/usb/devices/*/power/level; do
[ "$(cat $i)" = "auto" ] && continue
echo "auto" > $i
done

for i in /sys/bus/usb/devices/*/power/autosuspend; do
[ "$(cat $i)" -ge 0 2>/dev/null ] && continue
echo "2" > $i
done

fi

close and save (in your home directory) calling it

Code:
usb_autosuspend

Run a terminal (applications>accessories) and paste the following lines one at a time pressing return after each one

Code:
chmod 755 usb_autosuspend
sudo su
install usb_autosuspend /usr/lib/pm-utils/power.d/
exit

you WILL be asked for your password, just type it in and press return.

When starting the notebook with AC on this script doesn't do anything, it is automatically run when going from AC to Battery and it sets usb to autosuspend after 2 secs. NOTE that this could turn off some old usb devices plugged to the computer. To avoid any problem (and save the most battery) DON'T leave usb devices plugged when going from AC to Battery, even better, don't use usb devices when running on battery at all. When using AC there is absolutely no problems at all.

Intel HD audio
Karmic has finally added a line to alsa configuration files that turn off the card after few second of inactivity. HDA cards can be named Intel, Nvidia, Ati and others but all should have this power saving active.

Intel wireless cards
Since kernel 2.6.30 the behavior of such cards has changed, there is no possibility of tuning the power consumption.

Results
Running the powertop program

Code:
sudo powertop -d -t 60

these are my results after unplugging the cable

Quote:
Cn permanenza media
C0 (cpu occupata) ( 0,7%)
C0 0,0 ms ( 0,0%)
C1 halt 0,0 ms ( 0,0%)
C2 0,2 ms ( 0,0%)
C3 28,4 ms (99,3%)

P-state (frequenze)
1,67 Ghz 0,6%
1333 Mhz 0,0%
1000 Mhz 99,4%

Wakeup-da-idle al secondo: 35,5 intervallo: 60,0s
Utilizzo energetico (stima ACPI): 11,3W (1,9 ore)

Cause principali di wakeup:
27,2% ( 12,6) <interrupt> : iwl3945
22,2% ( 10,3) <core del kernel> : hrtimer_start_range_ns (tick_sched_timer)
16,0% ( 7,4) <IPI kernel> : Rescheduling interrupts
6,4% ( 3,0) <interrupt> : acpi
4,4% ( 2,0) <core del kernel> : hrtimer_start (tick_sched_timer)
4,2% ( 1,9) gnome-terminal : hrtimer_start_range_ns (hrtimer_wakeup)
3,0% ( 1,4) <interrupt> : uhci_hcd:usb2, i915
2,1% ( 1,0) python : hrtimer_start_range_ns (hrtimer_wakeup)

Suggestion: Enable laptop-mode by executing the following command:
echo 5 > /proc/sys/vm/laptop_mode

The program is still suggesting me to run laptop-mode which is another way to handle the hard drive (and other variables) but I still prefer to avoid it as it's not recommended by Ubuntu.

Known issues & things to do
The guide could be simplified, creating a package for the scripts but I don't know how to do it.

  • k4tz's blog
  • Add new comment
Visitor's picture

iwl3945

Submitted by Visitor on Tue, 12/08/2009 - 00:18.

disabling iwl3945 will help a little bit more but you won't have wireless network afterwards.

rmmod iwl3945 (to disable)
modprobe iwl3945 (to enable)

  • reply

Recent blog posts

  • Configure ThinkPad laptop trackpoint on Ubuntu
  • How to make WPA connection in Ubuntu on demand
  • Review: Sabily 9.10 - Linux Ubuntu for Muslims
  • How to Install 64bit flash on Ubuntu
  • How to get Wireless LAN (Broadcom) on Acer Aspire 4720Z working with Ubuntu 9.10
  • Quick loot at Ubuntu 10.04 Lucid Lynx Alpha 3
  • System testing and benchmarking under Ubuntu 9.10
  • How to PXE booting Ubuntu Installer
  • How to Install Debian onto your Nexus One using Ubuntu
  • (Re) Install a Linux Kernel
more

Linux World

  • Microsoft's Internet Driving Licence: stupid, unworkable and unenforceable
  • Making a videoloop with Kino and Audacity
  • So is ChromeOS a desktop winner? I think not
  • Firefogg: Transcoding videos to open web standards with Mozilla Firefox
  • The Morevna Project: Anime with Synfig and Blender
Archive Syndicate content

Recent comments

  • Re
    10 weeks 11 hours ago
  • Re
    10 weeks 13 hours ago
  • Re
    11 weeks 7 hours ago
  • Re
    11 weeks 3 days ago
  • Re
    12 weeks 1 day ago
  • Re
    12 weeks 1 day ago
  • Re
    12 weeks 2 days ago
  • iwl3945
    14 weeks 3 hours ago
  • HomeBank
    26 weeks 1 day ago
  • KMyMoney and direct connect to banks
    30 weeks 2 days ago
All contents copyright © 2008, Dhuha Net. All rights reserved
Ubuntudoctor® is a member of the Dhuha Network. Privacy Policy
RoopleTheme