# Battery sucked quickly



## lin (Oct 2, 2016)

Hello to all the community.
I installed FreeBSD on my notebook stable 10.3 g4-2029wm Pavilion.
The installation was successful, and I have my installed packages, but I still have some things to solve, for example activate the FN keys (brightness, sound, etc).

But I have a problem with power management, battery ends quickly.
I tested with the following article:
https://wiki.freebsd.org/TuningPowerConsumption

But there is no change, the battery lasts only 30 minutes.
I must say that the fan is always turning at maximum and can not make it stop.
I think the problem comes from powerd that simply does not work on my computer, I get errors during the boot on powerd:

```
powerd: no cpu freq(4)
/etc/rc: failed to start powerd.
```
It should be mentioned that also use Arch Linux and to manage the use of the battery cpupower use, everything is correct because the battery lasts more than two hours.
Any idea what could be happening?


----------



## ivosevb (Oct 2, 2016)

Did you make custom kernel? Try `kldload cpufreq`


----------



## lin (Oct 2, 2016)

Nope, kernel stock:

```
FreeBSD Box 10.3-STABLE FreeBSD 10.3-STABLE #0 r302791: Thu Jul 14 01:16:15 UTC 2016     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
```

The module had already been loaded and error I had with powerd was solved by changing the value of these lines within /boot/device.hints:

```
hint.acpi_throttle.0.disabled="0"
hint.p4tcc.0.disabled="0"
```
Change 1 to 0,But I do not understand why I have a high consumption.


I'm using Fluxbox


----------



## ivosevb (Oct 2, 2016)

What is the output when you run `sysctl dev.cpu | grep freq`


----------



## molofishy (Oct 2, 2016)

lin, do you have powerd installed? Run `powerd -v` as root, for 60 seconds (ctrl + c to exit). It will return an estimate of the total joules your system consumed in 60 seconds. Divide joules by 60 to get the watts. Let us know the result...


----------



## Juha Nurmela (Oct 2, 2016)

Some process gone berserk, 100% CPU ?

Juha


----------



## lin (Oct 2, 2016)

ivosevb said:


> What is the output when you run
> sysctl dev.cpu | grep freq


Here is the output:

```
dev.cpu.0.freq_levels: 2695/-1 2358/-1 2021/-1 1684/-1 1347/-1 1010/-1 673/-1 336/-1
dev.cpu.0.freq: 1684
```



molofishy said:


> lin, do you have powerd installed? Run `powerd -v` as root, for 60 seconds (ctrl + c to exit). It will return an estimate of the total joules your system consumed in 60 seconds. Divide joules by 60 to get the watts. Let us know the result...


Ok I not really understand you want me to do, but this is the output powerd throws in 60 seconds:
http://pastebin.com/6DHE2T16



Juha Nurmela said:


> Some process gone berserk, 100% CPU ?
> 
> Juha


Yeah that's right,but only using the battery.

For example if I run firefox the CPU runs at 100% and the system is unusable.
When I have the charger connected all goes well, the CPU is kept at a minimum speed.

This shows htop using the battery:

 

This shows htop with the charger connected:


Thanks for your answers..


----------



## Juha Nurmela (Oct 2, 2016)

(Somehow very pleasing color scheme in those pictures)

Have you adjusted Cx states in /etc/rc.conf, I have

```
economy_cx_lowest="LOW"
performance_cx_lowest="HIGH"
```

Can you show `systat -vm` for those two cases too ? Anything different? Maybe something is spewing ACPI events at high rate, and high load comes from handling them.

Juha

Treppenwitz, any file in /var/log growing rapidly while on battery?


----------



## lin (Oct 2, 2016)

Yes I tested with the following article:
https://wiki.freebsd.org/TuningPowerConsumption

So in rc.conf I have:

```
performance_cx_lowest="Cmax"
economy_cx_lowest="Cmax"
```
I'll try changing the parameters with yours..

Ok the output with charger:


And with battery:


Same problem with your parameters, the fan always runs at maximum with battery, consuming 100% CPU and the system is unusable


----------



## Juha Nurmela (Oct 2, 2016)

LOW and Cmax might be the same.
Can't see anything out of ordinary in the screen captures, 1/second from acpi0.
Odd that it is the Xserver which goes bananas. Does the situation change if you drop out of X while on battery?

Juha

You load acpi_hp.ko ? I have an HP too, but acpi_hp(4) does not support this PC, so I don't bother loading it. It didn't cause trouble though.

You've looked at `acpiconf -i0` ? I read 27 watts on an external wattmeter, and 10...15 watts from acpiconf while on battery. Joules from powerd don't quite match, don't know why*

Tried setting the economy_cx_lowest gradually from C1, C2, ... in case the aggressive settings don't suit your hw ?

*) Peeking at powerd.c, it gets the milliwatts of cpu from *dev.cpu.0.freq_levels*. Numbers match better now, cpu watts versus total watts. Would be nice if it also gave the amount of carbon dioxide in cubic furlongs.


----------



## molofishy (Oct 2, 2016)

lin said:


> Ok I not really understand you want me to do, but this is the output powerd throws in 60 seconds:
> http://pastebin.com/6DHE2T16



Press ctrl + c after 60 seconds. The amount of joules should be given. What are the joules? I am less interested in all the other information.


----------



## cpm@ (Oct 2, 2016)

molofishy said:


> Press ctrl + c after 60 seconds. The amount of joules should be given. What are the joules? I am less interested in all the other information.



I hope that helps:

http://electronics.stackexchange.com/questions/28847/how-much-energy-can-be-stored-in-a-battery


----------



## ASX (Oct 2, 2016)

For a test only, try to disable acpi(4) completely.

```
To disable the acpi driver completely, set the kernel environment vari‐
     able hint.acpi.0.disabled to 1.
```

Also, check for BIOS/UEFI updates, if any.


----------



## lin (Oct 3, 2016)

Juha Nurmela said:


> Does the situation change if you drop out of X while on battery?


Nope, the situation es same nothing changes



Juha Nurmela said:


> You load acpi_hp.ko ? I have an HP too, but acpi_hp(4) does not support this PC, so I don't bother loading it. It didn't cause trouble though.



Yes sir, this module was loaded.
In loader.conf I have:

```
acpi_hp_load="YES"
```



> You've looked at `acpiconf -i0` ? I read 27 watts on an external wattmeter, and 10...15 watts from acpiconf while on battery. Joules from powerd don't quite match, don't know why*


Here is the output from acpiconf:

```
Design capacity:    3712 mAh
Last full capacity:    3712 mAh
Technology:        secondary (rechargeable)
Design voltage:        10800 mV
Capacity (warn):    534 mAh
Capacity (low):        344 mAh
Low/warn granularity:    10 mAh
Warn/full granularity:    25 mAh
Model number:        Primary
Serial number:         
Type:            LION
OEM info:        Hewlett-Packard
State:            high
Remaining capacity:    46%
Remaining time:        unknown
Present rate:        0 mA (0 mW)
Present voltage:    10931 mV
```


----------



## Juha Nurmela (Oct 3, 2016)

lin said:


> Remaining capacity: 46% Remaining time: unknown Present rate: 0 mA (0 mW)


That looks odd, half full, but not charging?

Mine shows, while on AC, on battery, and then back on AC, like this:

```
Design capacity:        1626 mAh
Last full capacity:     1626 mAh
...
State:                  high
Remaining capacity:     100%
Remaining time:         unknown
Present rate:           0 mA (0 mW)
Present voltage:        12545 mV

State:                  discharging
Remaining capacity:     96%
Remaining time:         0:53
Present rate:           1747 mA (20310 mW)
Present voltage:        11626 mV

State:                  charging
Remaining capacity:     93%
Remaining time:         unknown
Present rate:           262 mA (3154 mW)
Present voltage:        12041 mV
```
Full capacity has gone down to 30%, old battery, but it still runs for an hour and a half, if network is closed down.

Juha


----------



## lin (Oct 3, 2016)

My charger fails sometimes, here you have the result with the charger connected, and using the battery:

```
Design capacity:    2208 mAh
Last full capacity:    2208 mAh
Technology:        secondary (rechargeable)
Design voltage:        10800 mV
Capacity (warn):    324 mAh
Capacity (low):        209 mAh
Low/warn granularity:    10 mAh
Warn/full granularity:    25 mAh
Model number:        Primary
Serial number:        
Type:            LION
OEM info:        Hewlett-Packard
State:            charging
Remaining capacity:    11%
Remaining time:        unknown
Present rate:        2882 mA (35073 mW)
Present voltage:    12170 mV
```

On battery:

```
Design capacity:    3712 mAh
Last full capacity:    3712 mAh
Technology:        secondary (rechargeable)
Design voltage:        10800 mV
Capacity (warn):    534 mAh
Capacity (low):        344 mAh
Low/warn granularity:    10 mAh
Warn/full granularity:    25 mAh
Model number:        Primary
Serial number:         
Type:            LION
OEM info:        Hewlett-Packard
State:            discharging
Remaining capacity:    63%
Remaining time:        0:39
Present rate:        3608 mA (38327 mW)
Present voltage:    10623 mV
```

I have no problems with the battery, in Linux have an excellent power management ..
Maybe FreeBSD is not suitable to run on my hardware?
I hope I do not really like to solve this problem and still use FreeBSD for everyday use.


----------



## Juha Nurmela (Oct 3, 2016)

I've never seen 3.5+ amperes yet, but yes, buzzing `while : ; do done` in multiple terminals did it.

What processes eat up the cpu, when you drop out of X ?
Juha


----------



## lin (Oct 3, 2016)

Any process eats CPU, for example vitunes, ranger, etc.
And not know what else to try to solve the problem:
1-temperature high
2-fan rotating at maximum all the time (as a turbine)
3-Battery down in a few minutes.


----------

