Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] battery drain while laptop is off
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
freifunk_connewitz
Apprentice
Apprentice


Joined: 08 Feb 2006
Posts: 231

PostPosted: Fri Mar 20, 2015 11:09 am    Post subject: [SOLVED] battery drain while laptop is off Reply with quote

hi,

my laptop (that has been running on gentoo for four years now) suddendly begun to loose 10-12% battery charge per day when switched OFF. I'm pretty sure it is caused by some software update last fall but I fail to find the reason.

here's what I did to find explanations:

  • It is a real shutdown I'm talking about, not suspend or hibernate.
  • It is the OS and not a hardware issue like the battery: When taking out the battery after shutdown it only loses its normal 1-2% charge per day. And: When instead of a shutdown I do a reboot and switch the machine off by pressing the power button directly after BIOS then it also does NOT drain the battery that heavily afterwards.
  • It is not the BIOS setting. I've had disabled wake-on-lan in the BIOS at the very beginning four years ago and that didn't change.
  • I also did not change other relevant BIOS settings befor the battery drain occured (like USB-always-on for external device charging).
  • It is also not the hwclock issue mentioned in this post: https://forums.gentoo.org/viewtopic-t-937674-highlight-battery+hwclock.html. That workaround does not work for me, even if I disable both hctosys and sytohc in /etc/conf.d/hwclock.


What I'm sure about is that is has to be an OS issue. What I'm not that sure about is which component could be the culprit. Since I've read a lot about wake-on-lan being the wrongdoer in such cases I wanted to test for that. So I went for sys-apps/ethtool.
Code:
ethtool eth0

gave me the line:
Quote:
Wake-on: g

I continued by disabling it through:
Code:
ethtool -s eth0 wol d

which got confirmed ("Wake-on: d") but did not survive a reboot. So I followed another advice and added the following line to /etc/conf.d/net:
Code:
ethtool_change_eth0="wol d"

EDIT: WoL keeps being disabled if I shutdown/reboot while NOT an AC, also after reboot. (On AC WoL gets enabled all the time.)

So what else can I do? Is there anything else I may have overlooked that could cause the energy loss?

Thanks in advance,
freifunk_connewitz

My setup:
HW: Fujitsu Lifebook S 761, CPU: Intel i7-2620M, NIC: Intel gigabit 82579LM (driver: e1000e as module)
OS: x86_64 (almost only stable), kernel 3.17.8-gentoo-r1, baselayout-2.2, openrc-0.13.11


Last edited by freifunk_connewitz on Wed Jul 15, 2015 8:59 am; edited 4 times in total
Back to top
View user's profile Send private message
albright
Advocate
Advocate


Joined: 16 Nov 2003
Posts: 2588
Location: Near Toronto

PostPosted: Fri Mar 20, 2015 12:14 pm    Post subject: Reply with quote

obvious question, but if you shut down immediately
after disabling wake-on-lan do you still get the
battery rundown?

(if not, you could make disabling wol part of shutdown
script ...)
_________________
.... there is nothing - absolutely nothing - half so much worth
doing as simply messing about with Linux ...
(apologies to Kenneth Graeme)
Back to top
View user's profile Send private message
freifunk_connewitz
Apprentice
Apprentice


Joined: 08 Feb 2006
Posts: 231

PostPosted: Fri Mar 20, 2015 11:58 pm    Post subject: Reply with quote

hi albright, thank you for your suggestion. before I could try out your proposal something happened that I normally do not like as OP of a problem in a forum: WOL keeps being disabled now, even after reboot. the only thing I did otherwise than before was to issue the disabling command in a real terminal instead of a VT inside my DE, and the power cable as well as the network cable were connected this time.

but, this problem solved, there still is the problem with the power drain, even with WOL disabled. what else could it be?
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 215

PostPosted: Sat Mar 21, 2015 12:13 am    Post subject: Reply with quote

freifunk_connewitz wrote:
hi albright, thank you for your suggestion. before I could try out your proposal something happened that I normally do not like as OP of a problem in a forum: WOL keeps being disabled now, even after reboot. the only thing I did otherwise than before was to issue the disabling command in a real terminal instead of a VT inside my DE, and the power cable as well as the network cable were connected this time.

but, this problem solved, there still is the problem with the power drain, even with WOL disabled. what else could it be?


I am having a similar problem to yours. My laptop will lose 15-20% of it's battery overnight, where as my prior OS would last a entire week before dropping 10%.

Is there any other steps you have taken to disable WOL? I have the same problem that I can not force it to stay disabled even if I follow your steps you have taken.

Thanks.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sat Mar 21, 2015 3:10 am    Post subject: Reply with quote

It could be a kernel bug that leaves some internal PCI/USB device powered up. Try installing powertop, use its tuning tab to enable everything possible, then shut down from the OS and see if it still happens.
Back to top
View user's profile Send private message
freifunk_connewitz
Apprentice
Apprentice


Joined: 08 Feb 2006
Posts: 231

PostPosted: Mon Mar 23, 2015 8:48 am    Post subject: Reply with quote

@abduct: sorry, I did nothing more than I wrote. maybe try it from a console outside your DE or experiment with power and network cables plugged in while issueing ethtool...

@Ant.: thanks for the hint. I tried to switch all tunables to "good" and the battery drain seemed to stop. I'm gonna biscect now which exact entry is responsible.
Back to top
View user's profile Send private message
Atmmac
Tux's lil' helper
Tux's lil' helper


Joined: 17 Oct 2013
Posts: 130
Location: Watertown, MA

PostPosted: Mon Mar 23, 2015 3:56 pm    Post subject: Reply with quote

Noticed this as well. Didn't really think too much of it until i saw your post. Definitely a weird issue.
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 215

PostPosted: Wed Mar 25, 2015 10:22 pm    Post subject: Reply with quote

I'm still trying to figure this out. I set all options under tunable to "good", but upon a restart all the options (except for the last 2) are reset to "bad". Is there kernel options that should be compiled in order for this to work properly?

More or less the big battery drainer seems to be the wake on lan, so I am going to disable it during boot, although I am still confused as to why all these settings keep on changing back.

Any suggestions or tips to tracking this problem down would be helpful.
Back to top
View user's profile Send private message
freifunk_connewitz
Apprentice
Apprentice


Joined: 08 Feb 2006
Posts: 231

PostPosted: Thu Mar 26, 2015 8:40 am    Post subject: Reply with quote

I'm one small step further: it seems to be relevant whether the power is plugged or not. when I hook up the machine the wake-on-lan-status of the LAN card switches automagically to 'g'. when I disconnect the power cable again, it switches back to 'd'. Is that a bug or a feature? I suppose other energy states are affected as well, so it really matters if the machine is on AC while you fiddle with powersaving.

meanwhile, my powertop bisection was in vain. I've tried setting all the tunables to good blockwise, but unlike the first time when I tried all at once the battery drain stayed. I'll try again to toggle them all and shutdown. let's see what happens.

@abduct: if you disable wol on boot that won't necessarily affect the state while the machine is off. I suspect there is something switching wol (or some other device state) to 'hungry' while the box is running - or while shutting down.

@abduct and Atmmac: could you please tell us some basics about your hardware, kernel and core system version etc.? I'm wondering if there could be some clue there, because I have another laptop running the same kernel (3.17.8-gentoo-r1) on a different hardware and with a longer timespan since I did an update - which does not suffer a battery drain like this.
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 215

PostPosted: Thu Mar 26, 2015 7:21 pm    Post subject: Reply with quote

@freifunk_connewitz: My tests were done with ethernet/AC plugged in and wlan0 in a down state, and seemingly disabling WoL before shutting down resolved the issue for the most part (checking battery drainage after about 8 hours each shutdown), although the constant re-enabling of the feature upon boot is a bit bizarre. I agree though disabling the feature while starting up might not do it if it is reneabled sometime while running, and disabling it in a shutdown script may not be a good idea since there is a chance of a unclean shutdown in which the script will not run. I will run a few more tests with the AC/Ethernet unplugged to see if I can keep the settings in a disabled state. I also have a old bios version which I will update and run some more tests on.

As for my laptop and installation settings it is a HP envy4 1130US (i5-3317U) running x86_64 3.2.65-hardened-r2 kernel (configured by hand with menuconfig) with the /root and /home partitions encrypted and unlocked via cryptsetup during run level 3. Other than that it is pretty much a bare minimal install other than Xorg/fluxbox/conky and a few misc. tools at the moment. The only other notable change is I removed udev and installed eudev as well as using legacy grub (version 0.96 I believe is what emerge installed).

If you need any more information about my build let me know.

Edit:: It appears disabling WoL with the AC/Ethernet unplugged before shutdown didn't help as WoL returned to the "g" state once restarted. Just for more information I also used the configuration of conf.d as specified in the power management wiki: http://wiki.gentoo.org/wiki/Power_management/Ethernet
Back to top
View user's profile Send private message
freifunk_connewitz
Apprentice
Apprentice


Joined: 08 Feb 2006
Posts: 231

PostPosted: Fri Mar 27, 2015 8:48 am    Post subject: Reply with quote

@abduct: what version of baselayout and openrc are you using? I'm asking because we obviously can rule out the kernel version here. and do I understand you correctly that you found a setup where the battery keeps its charge level overnight?

in my case it seems that definitely the powermanagement is doing something weird: when on AC not only is the WoL state of eth0 enabled - it even is re-enabled after reboot even if I manually disable it before shutdown through ethtool (the link state of LAN has no effect). again: is that a bug or a feature? can we trust the output of ethtool or /proc/acpi/wakeup at all?
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 215

PostPosted: Fri Mar 27, 2015 6:54 pm    Post subject: Reply with quote

@freifunk_connewitz

My openrc version is 0.13.11 and my base layout is 2.2 as per /etc/gentoo-release and `equery list baselayout`

And yes I have found a way to minimize battery drain overnight by way of running `ethtool -s eth0 wol d` as root before shutdown with the AC/Ethernet plugged in. Once powered down I unplug the AC, but leave the Ethernet plugged in. By doing this I obtain very little battery drain (1% maybe just under 2% over 8-12 hours), "/sys/class/power_supply/BAT1/charge_now" reported 3071000 after about 5-10 minutes of booting (conky was reporting 98% or 97% battery at the time) and my max charge is 3158000 which appears to be marginally nothing compared to the 10%+ I was getting before issuing the ethtool command.

I also have tried various combinations such as unplugging the ethernet/AC while adjusting the powertop/ethtool wol settings and none of them seem to want to stay disabled.

Also I can confirm that in fact when I do issue `ethtool -s eth0 wol d` as root before shutdown, wake on lan is in fact disabled since the link/act lights turn off on my switch when the computer turns off. Just to double check I shutdown without doing this, and the LINK light on my switch is still active, although the act light is dead. So most of the problem on my side is the wake on lan I would imagine, although there are a bunch of settings within powertop which won't stay disabled either (all are set to bad except 2 upon reboot).
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sat Mar 28, 2015 11:29 pm    Post subject: Reply with quote

abduct wrote:
I'm still trying to figure this out. I set all options under tunable to "good", but upon a restart all the options (except for the last 2) are reset to "bad". Is there kernel options that should be compiled in order for this to work properly?

More or less the big battery drainer seems to be the wake on lan, so I am going to disable it during boot, although I am still confused as to why all these settings keep on changing back.

Those are runtime-only things (apart from WoL, which changes settings in the BIOS). They're never saved due to a lot of hardware being dangerously buggy when it comes to anything fancy like, oh, following 2-decade-old PCI/ACPI power management specs...

powertop has a command line flag to auto-set them all at once, if you want to stick it in an /etc/local.d/ script.
Back to top
View user's profile Send private message
freifunk_connewitz
Apprentice
Apprentice


Joined: 08 Feb 2006
Posts: 231

PostPosted: Tue Mar 31, 2015 9:59 am    Post subject: Reply with quote

Congrats, @abduct, that you solved your problem!

But I wonder: Is it really safe to assume WoL is not active if the link-light on the switch/router turns off on shutdown? Because that is the case here, regardless whether WoL is on or off before shutting down, according to ethtool.

However, WoL doesn't seem to be the problem in my case. Whether I disable it before shutdown or not, the battery loses 10-12% overnight.

Anyone: could it be that the last openrc update from 0.13.8 to 0.13.11 caused this weird behaviour? I'm asking because another laptop here has same kernel version and very similar setup (different hardware though) but running on openrc-0.13.8. and not showing any battery drain. That almost made me staggering that it could be an hardware issue but why then does the drain not appear if I briefly take out the battery between shutdown and boot?
Back to top
View user's profile Send private message
freifunk_connewitz
Apprentice
Apprentice


Joined: 08 Feb 2006
Posts: 231

PostPosted: Fri Apr 10, 2015 8:00 am    Post subject: Reply with quote

I think I have to give up. just two more things for everybody having the same problem - or who has another idea what to to:
- it seems that the power loss has around the same amount as if the box would be on suspend (~12%).
- also booting with the gentoo live-cd did not bring new info because it did not have any battery information, not even throuh upower -d.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9678
Location: almost Mile High in the USA

PostPosted: Wed Apr 22, 2015 5:36 am    Post subject: Reply with quote

I don't know if there's a standard way to disable USB charging but I know for my laptop that seems to drain the battery when 'off' keeps on powering the USB port for charging external devices...

Now I wish I could disable that... no obvious items in BIOS setup unfortunately.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 215

PostPosted: Wed Apr 22, 2015 4:59 pm    Post subject: Reply with quote

I've been putting this off for some time again, but I don't think I've solved this issue either.

Some updates from last time:

-Now running the 3.18.9 hardened kernel
-Exported all powertop's commands and have them running in /etc/local.d/ so that they all enable on boot and shutdown

Wake on lan is confirmed shut off (No signs of life from my switch), but I believe I am still experiencing the more or less 10% battery drain over night.

I have noticed that the USB ports do remain powered for charging devices as well even when powered off and I am not quite sure how to disable that since it happens even after setting all Powertop features to "good".

@freifunk_connewitz

Have you looked into or attempted the downgrading of openrc as mentioned in your previous posts?

I might do some reading and attempt it, see if it solved the problem for me, because that is really the only common point between our builds.
Back to top
View user's profile Send private message
freifunk_connewitz
Apprentice
Apprentice


Joined: 08 Feb 2006
Posts: 231

PostPosted: Mon May 04, 2015 10:14 am    Post subject: Reply with quote

abduct wrote:

@freifunk_connewitz
Have you looked into or attempted the downgrading of openrc as mentioned in your previous posts?
I might do some reading and attempt it, see if it solved the problem for me, because that is really the only common point between our builds.

No, I haven't. And unfortunately, I can't because there is no older version of openrc available (and I don't want to start to fiddle with any overlay).

I also have this USB-charging-feature, but in my case it gets properly switched off as expected.

To make this whole thing even more weird: The wake-on-lan-problem miraculously reappeared. Despite disabling WOL manually and having /etc/conf.d/net configured as described above: after a reboot, WOL is enabled again. Without my switch showing an online link when the laptop is powered off, though.
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 215

PostPosted: Mon May 04, 2015 4:28 pm    Post subject: Reply with quote

freifunk_connewitz wrote:
abduct wrote:

@freifunk_connewitz
Have you looked into or attempted the downgrading of openrc as mentioned in your previous posts?
I might do some reading and attempt it, see if it solved the problem for me, because that is really the only common point between our builds.

No, I haven't. And unfortunately, I can't because there is no older version of openrc available (and I don't want to start to fiddle with any overlay).

I also have this USB-charging-feature, but in my case it gets properly switched off as expected.

To make this whole thing even more weird: The wake-on-lan-problem miraculously reappeared. Despite disabling WOL manually and having /etc/conf.d/net configured as described above: after a reboot, WOL is enabled again. Without my switch showing an online link when the laptop is powered off, though.


I could never get the /etc/conf.d/net config to work for me when disabling WOL.

I ended up using /etc/local.d/ and creating two scripts, one suffixed by ".start" the other by ".stop" so that all my power saving commands run at boot and shutdown.

I took the command outputs from the powertop tuning tab and just inserted them into a script called "powersaving.start" and "powersaving.stop"
Back to top
View user's profile Send private message
freifunk_connewitz
Apprentice
Apprentice


Joined: 08 Feb 2006
Posts: 231

PostPosted: Tue Jul 07, 2015 10:21 am    Post subject: Reply with quote

abduct,
but did these measures prevent the power loss?
Back to top
View user's profile Send private message
freifunk_connewitz
Apprentice
Apprentice


Joined: 08 Feb 2006
Posts: 231

PostPosted: Wed Jul 15, 2015 8:58 am    Post subject: Reply with quote

solved it.
as a hint for anybody running into similar weird effects: if you encounter something hard to explain like this where you try and try and don't find a configuration or software problem -- and especially if it is about such a huge batttery drain as 10-12% per day (e.g. WOL would not consume that much power I was told) -- always do suspect a hardware issue. really. in my case, if a battery is broken it also wouldnt give correct info about itself. so I was mistaken when I believed everything that upower -d told me.
long story short: my 4 year old battery was the reason. I replaced it with a new one and everything is fine again.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum