You are not logged in.
@josec89
You may take a look at this
http://www.techytalk.info/linux-kernel- … #more-1972
Offline
@hadran
What do you think of adding cpufreq-utils to the mix? It might go something like this, though I've never scrpited in my life 
#!/bin/sh
# A script to enable laptop power saving features for #! & Debian GNU+linux.
# [url]http://crunchbanglinux.org/forums/topic/11954[/url]
...
case "$1" in
true)
# Enable some power saving settings while on battery
...
cpufreq-set -g powersave
...
false)
...
cpufreq-set -g ondemand
;;
esac
exit 0Last edited by el_koraco (2011-11-03 10:50:48)
Offline
Enable/disable compositing under Xfce :
> true
env DISPLAY=:0 sudo -u youruser -H xfconf-query -c xfwm4 -p /general/use_compositing -t bool -s false
> false
env DISPLAY=:0 sudo -u youruser -H xfconf-query -c xfwm4 -p /general/use_compositing -t bool -s true
Insert theese lines in the according part of the powersave script, and spare some more milliwatts.
Last edited by Istvan (2011-11-29 19:01:10)
Ha ezt el tudod olvasni, biztosan nem vagy rövidlátó.
Offline
Hmm I edited it and put the backlight on 10% but it still has the battery at about full brightness.
Thank you everyone for being helpful and answering my questions.
Machinae Supremacy fan for life \m/_(^_^)_\m/
Offline
jelloir wrote:Igneo676 wrote:Hmm, I'm noticing power gains whenever I run after I boot up the system.
I know it's in the right spot and I know I made it executable, shouldn't that mean it runs on startup and gives me power savings right away, or does that mean that I gotta be charging it and then unplug it on startup? Maybe I'm doing something wrong...?
The script is executed when the power state changes (when you unplug/plug your AC). You can check what state the power is running in via:
cat /proc/sys/vm/laptop_mode0 = disabled, 1 = enabled.
You typically need a power manager like gnome-power-manager running which in turn executes /usr/sbin/pm-powersave true|false.
pmutils then executes the various powersaving scripts in /usr/lib/pm-utils/power.d/ and /etc/pm/power.d/
Are you sure it works only with a power manager as the backend?
I did not use any and running the powersave script during the session and at start up always worked out of the box. However, since some time it only works after suspend/hibernation.
I'm not sure what causes this change.
Unfortunately I'm not using Debian but Arch.
pm-utils 1.4.1-3
linux 3.0.7-1
upower 0.9.14-1Acpi is not installed.
cat /proc/sys/vm/laptop_mode when AC is unplugged gives me 5 as result.
Regards
Related to my problem I came up with a solution to run 'upower -e' at startup of Openbox which is required to detect changed ac stages.
Offline
@hadran
What do you think of adding cpufreq-utils to the mix? It might go something like this, though I've never scrpited in my life#!/bin/sh # A script to enable laptop power saving features for #! & Debian GNU+linux. # [url]http://crunchbanglinux.org/forums/topic/11954[/url] ... case "$1" in true) # Enable some power saving settings while on battery ... cpufreq-set -g powersave ... false) ... cpufreq-set -g ondemand ;; esac exit 0
Great idea. I tried and it works.
I use cpufreq-set -r -g powersave and cpufreq-set -r -g ondemand
Last edited by Tunafish (2012-02-19 14:09:48)
sed 's/stress/relaxation/g'
Privacy & Security on #!
Offline
will I be able to make use of this script even though I always have my laptop plugged in and not on battery?
It''s just that it would still be handy to use as the computer would run cooler.
Troll = not a fanatic
Offline
Recently, there's been a thread on this on the Arch boards. I have edited this script to suit my own setup (e.g. hard disk drives, laptop screen brightness, cpu governors...) and made it suitable to use with pm-powersave (the same as the first post here). For those interested, you can find it here:
https://github.com/Unia/Powersave
All credit should go to Taylorchu who made the initial Powerdown script, on which mine is very heavily based.
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Github || Deviantart
Offline
Could this script be modified to auto-unload modules while running on AC power without the battery plugged in?
Thank you everyone for being helpful and answering my questions.
Machinae Supremacy fan for life \m/_(^_^)_\m/
Offline
Could this script be modified to auto-unload modules while running on AC power without the battery plugged in?
Which script? The one Hardran3 posted in the first post here does that already.
If you're using mine, it can definitely be modified to do so. Just take a look at Hardran3's script in the first post on how to do it 
Last edited by Unia (2012-08-24 15:00:50)
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Github || Deviantart
Offline
MarioMaster100 wrote:Could this script be modified to auto-unload modules while running on AC power without the battery plugged in?
Which script? The one Hardran3 posted in the first post here does that already.
If you're using mine, it can definitely be modified to do so. Just take a look at Hardran3's script in the first post on how to do it
Well I use Hardran3's script and it only unloads the module when running from battery, if you start off with no battery plugged in and just run off AC it doesn't auto-unload the module.
Thank you everyone for being helpful and answering my questions.
Machinae Supremacy fan for life \m/_(^_^)_\m/
Offline
Unia wrote:MarioMaster100 wrote:Could this script be modified to auto-unload modules while running on AC power without the battery plugged in?
Which script? The one Hardran3 posted in the first post here does that already.
If you're using mine, it can definitely be modified to do so. Just take a look at Hardran3's script in the first post on how to do it
Well I use Hardran3's script and it only unloads the module when running from battery, if you start off with no battery plugged in and just run off AC it doesn't auto-unload the module.
Why would you want to unload a module for powersaving, when you are running on AC? In that case you should look into blacklisting modules
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Github || Deviantart
Offline
MarioMaster100 wrote:Unia wrote:Which script? The one Hardran3 posted in the first post here does that already.
If you're using mine, it can definitely be modified to do so. Just take a look at Hardran3's script in the first post on how to do it
Well I use Hardran3's script and it only unloads the module when running from battery, if you start off with no battery plugged in and just run off AC it doesn't auto-unload the module.
Why would you want to unload a module for powersaving, when you are running on AC? In that case you should look into blacklisting modules
I have but unfortunately to do that I'd have to blacklist other stuff that uses it and then I won't have usb stuff working 
Thank you everyone for being helpful and answering my questions.
Machinae Supremacy fan for life \m/_(^_^)_\m/
Offline
Send me a PM and we might figure it out
Lets keep this topic clean
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Github || Deviantart
Offline
I have made some changes to the way my script works. Before, it'd be copied to /etc/pm/power.d and be run through pm-utils' pm-powersave function.
Now that I switched to systemd, I can't use pm-powersave anymore so my script wouldn't get run. To make it work with systemd, I've made two udev rules that get placed in /etc/udev/rules.d and my script will now go to /usr/bin.
The udev rules detect changes in the power state (charging|discharging) and run /usr/bin/powersave {true|false} accordingly.
Note that the script itself hasn't changed, so you can still copy it and place it in /etc/pm/power.d and use it with pm-powersave.
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Github || Deviantart
Offline
Like the OP, I was disappointed with initial power consumption, after installing Waldorf AMD64 to my ThinkPad x121e. However, I have had exactly the same issue with other distributions using the 3.2x kernel.
I have used TLP, powertop, and installed Hardran's script. Most importantly I entered the following to grub:
pcie_aspm=force i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1 i915.semaphores=1
This final addition reduced the watt consumption by a full 50%!!!!!!!
Maybe still a tad too high, but is running at 9.5 when busy doing lots.
Very happy. I was considering distro-hopping, but sticking with CrunchBang----and enjoying the self management of issues rather than losing savoire faire as it is abstracted by a more strategic order.
Thankyou. For other thinkpad users with similar issue I suggest looking at: https://wiki.archlinux.org/index.php/Le … kPad_x121e
And: http://linrunner.de/en/tlp/docs/tlp-configuration.html
And these forums of course.
Daniel
Offline
There was, on inspection, while running on battery, a clicking sound while on battery. Every second (I checked a few times it wasn't my watch).
The dirty writeback, apparently.
I turned off this script as being executable.
Clicking disappears. Power consumption drops dramatically again - to 5w on idle!! Amazing. Better than Linux Mint 11, better than Windows that was on it initially. Astonishing. Happiness. Elation. New found crunchiness.
Daniel
Last edited by dura (2012-09-15 20:31:13)
Offline
Were you able to use scripts that hardran3 posted along with tlp? I know they are redundant, but I was trying to run something else in the powersave script, but it is not working. Does pm-power manager get disabled by tlp? Since I am not familiar with how these scripts are activated, I hope to get some schooling here. Any pointers would be helpful. The following is the script I am trying to run. It runs fine if I invoke it manually.
#!/bin/sh
tag=pmpersonal
case $1 in
true) # on battery power
# do nothing
logger -t $tag "on battery"
# sudo -k tee /proc/acpi/bbswitch <<<OFF
/home/john/.screenlayout/laptoponly.sh
;;
false) # on a/c power
logger -t $tag "on A/C"
# sudo tee /proc/acpi/bbswitch <<<ON
sleep 2
/home/john/.screenlayout/1920monitor_right.sh
;;
esac
exit 0Last edited by prometheus (2012-11-28 20:06:36)
He's Got The Whole World in His Hands
Offline
I have both tlp and hardrans script running. I can remember about some clashing but don't think it applied to my machine, as laptop mode isn't running....or something. It's just running from power.d, in bin, as executable. You can fiddle with tlp config to not make them clash. Hardran's script is executed whenever battery is unplugged.
Offline
Hi, so I'm very new here, but actively reading your posts. Running Crunchbang 10 on Dell D600 1.71 Ghz Pentium M, 1256 Ram, radeon 9000 32mb Vram, Hdd Hitachi 20Gb @ 4200rpm with 2.6.39.-4.dmz.1-liquorix-686 kernel.
So i've managed to undervolt the CPU to the max and have a stable system and running little tweaked by me script from the first page. I'm happy with all but something isn't right for me. When i'm running powertop it is telling me this...
2.48 W 0.0 pkts/s Device Network interface: eth1 (ipw2200)
1.51 W 0.0 pkts/s Device Network interface: eth0 (tg3)And here is the question: How can I stop eth0 (lan port) from running without killing the wifi? I don't want to blacklist it, because some day I might use it. 
Here is my version of the script from the first page:
#!/bin/sh
# A script to enable laptop power saving features for #! & Debian GNU+linux.
# http://crunchbanglinux.org/forums/topic/11954
# List of modules to unload, space seperated. Edit depending on your hardware and preferences.
#modlist="uvcvideo"
# Bus list for runtime pm. Probably shouldn't touch this.
buslist="pci spi i2c"
case "$1" in
true)
# Enable some power saving settings while on battery
# Enable laptop mode
echo 5 > /proc/sys/vm/laptop_mode
#--------------------------------------------------------------------------------------
# Less VM disk activity. Suggested by powertop
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
#--------------------------------------------------------------------------------------
# Intel power saving
#echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller
#echo 1 > /sys/module/snd_hda_intel/parameters/power_save
#--------------------------------------------------------------------------------------
# Set backlight brightness to 10%
echo 1 > /sys/class/backlight/radeon_bl/brightness
#--------------------------------------------------------------------------------------
# USB powersaving
for i in /sys/bus/usb/devices/*/power/autosuspend; do
echo 1 > $i
done
#--------------------------------------------------------------------------------------
# SATA power saving
#for i in /sys/class/scsi_host/host*/link_power_management_policy; do
#echo min_power > $i
#done
#--------------------------------------------------------------------------------------
# Disable hardware modules to save power
for mod in $modlist; do
grep $mod /proc/modules >/dev/null || continue
modprobe -r $mod 2>/dev/null
done
#--------------------------------------------------------------------------------------
# Enable runtime power management. Suggested by powertop.
#for bus in $buslist; do
#for i in /sys/bus/$bus/devices/*/power/control; do
# echo auto > $i
#done
#ipw2000 eth1 powersave
iwpriv eth1 set_power 5
;;
#--------------------------------------------------------------------------------------
false)
#Return settings to default on AC power
echo 0 > /proc/sys/vm/laptop_mode
echo 500 > /proc/sys/vm/dirty_writeback_centisecs
#echo N > /sys/module/snd_hda_intel/parameters/power_save_controller
#echo 0 > /sys/module/snd_hda_intel/parameters/power_save
echo 10 > /sys/class/backlight/radeon_bl/brightness
for i in /sys/bus/usb/devices/*/power/autosuspend; do
echo 2 > $i
done
#for i in /sys/class/scsi_host/host*/link_power_management_policy
#do echo max_performance > $i
#done
for mod in $modlist; do
if ! lsmod | grep $mod; then
modprobe $mod 2>/dev/null
fi
done
#for bus in $buslist; do
#for i in /sys/bus/$bus/devices/*/power/control; do
#done
iwpriv eth1 set_power 6
;;
esac
exit 0And pm-powersave.log
/usr/lib/pm-utils/power.d/anacron true:success.
/etc/pm/power.d/powersave true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/etc/pm/power.d/powersave false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.Offline
ifconfig eth0 downYou could make a script and put it in /bin so eth0 is turned off at boot. Make it executable:
#!/bin/sh
ifconfig eth0 downLast edited by dura (2012-12-19 12:43:43)
Offline
ifconfig eth0 downYou could make a script and put it in /bin so eth0 is turned off at boot. Make it executable:
#!/bin/sh ifconfig eth0 down
Thanks I've put this command in my script and it works. But it is weird because with or without eth0 the wat usage is the same. Maybe there is no consumption and powertop is showing some false data. Will leave it this way anyway. 
Edit:
Hi, I have another question. When I'm booting the laptop without AC adapter the script is not starting. Why is that?
Last edited by zubcho81 (2013-01-09 08:34:18)
Offline
bump
Please delete this 
Last edited by zubcho81 (2013-01-09 08:36:18)
Offline
I'm on a ASUS U31SG and got a problem using hardran's script: When the powersave mode was true (ie. running on battery) then it couldn't power off on it's own. It simply sat at "Will now halt" all the way until the battery died (or me forcibly powering down by holding down the power button). It worked fine to reboot, was only shutting down that was the problem. Has anyone else had this issue?
Anyway, by experimenting with the script a bit I in the found that removing 'pci' from the buslist variable solved the problem.
EDIT: I managed to find that the pci device causing this was:
USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 05)By leaving that one to "on" and setting the rest of the pci power control to auto I am able to power down the laptop properly.
Oh, and thanks for a great script!
Last edited by p950tes (2013-01-12 17:14:43)
Offline
This is what I'm getting for cat /var/log/pm-powersave.log
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/etc/pm/power.d/powersave true:not executable.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.
/usr/lib/pm-utils/power.d/anacron false:success.
/etc/pm/power.d/powersave false:not executable.
/usr/lib/pm-utils/power.d/sched-powersave false:**sched policy powersave OFF
success.
/usr/lib/pm-utils/power.d/anacron true:success.
/etc/pm/power.d/powersave true:not executable.
/usr/lib/pm-utils/power.d/sched-powersave true:**sched policy powersave ON
success.What are the two "not executables" referring to? How can I pinpoint this? Also, aren't all the powersave options supposed to be ON?
Also, I'm contemplating running noflushd along with this script. Is it a good idea, or does it clash with anything related to this script?
Thanks in advance for any help. And to OP for script.
Avid #! learner.
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.