# [Help] Trouble about cpufreqd

## pd1986

after installing the gentoo from minimal stage, I am trying to configure my system by following power management guide

http://www.gentoo.org/doc/en/power-management-guide.xml

but in the end I didn't succeed in swithing cpufreqd on

 *Quote:*   

> *** buffer overflow detected ***: /usr/sbin/cpufreqd terminated
> 
> ======= Backtrace: =========
> 
> /lib64/libc.so.6(__fortify_fail+0x37)[0x7f48240f66f7]
> ...

 

I've verified that acpi-cpu, and laptop-mode-tools are on.

I also tried cpufrequtils too. but it returned

 *Quote:*   

> cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
> 
> Report errors and bugs to cpufreq@vger.kernel.org, please.
> 
> analyzing CPU 0:
> ...

 

same issue was discussed here with no solution.

https://forums.gentoo.org/viewtopic-t-901642-start-0.html

How could I do?

Thank you

----------

## BillWho

pd1986,

When you ran cpufreq-info did you have cpufrequtils loaded? If not add it to boot -> rc-update add cpufrequtils boot

Check if it's running with -> rc-update show|grep cpufrequtils

There may be an issue with libc.so.6. Try -> ldd $(which cpufreq-info) - your output should look like this:

root@gentoo-gateway home # ldd $(which cpufreq-info)

	linux-vdso.so.1 =>  (0x00007fff67360000)

	libcpufreq.so.0 => /usr/lib64/libcpufreq.so.0 (0x00007f6350919000)

	libc.so.6 => /lib64/libc.so.6 (0x00007f635058e000)

	/lib64/ld-linux-x86-64.so.2 (0x00007f6350b1f000)

Also check your .config settings. Mine are

CONFIG_CPU_FREQ=y

CONFIG_CPU_FREQ_TABLE=y

CONFIG_CPU_FREQ_STAT=y

CONFIG_CPU_FREQ_STAT_DETAILS=y

CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y

CONFIG_CPU_FREQ_GOV_PERFORMANCE=y

CONFIG_CPU_FREQ_GOV_POWERSAVE=m

CONFIG_CPU_FREQ_GOV_USERSPACE=m

CONFIG_CPU_FREQ_GOV_ONDEMAND=y

CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m

CONFIG_X86_PCC_CPUFREQ=m

CONFIG_X86_ACPI_CPUFREQ=m

Also a revdep-rebuild never hurts.

Hope this helps   :Wink: 

----------

## pd1986

 *BillWho wrote:*   

> pd1986,
> 
> When you ran cpufreq-info did you have cpufrequtils loaded? If not add it to boot -> rc-update add cpufrequtils boot
> 
> Check if it's running with -> rc-update show|grep cpufrequtils
> ...

 

Thanks for your response

I am sorry, the outcome of cpufrequtils is that before I recompiled kernel. so right now, cpufrequtils works.

but I still have troubles with cpufreqd, I prefer using this because it seems more powerful than cpufrequtils, for instance it has configurations for battery.

outcome of ldd

 *Quote:*   

> 	linux-vdso.so.1 =>  (0x00007fffdde7f000)
> 
> 	libcpufreq.so.0 => /usr/lib64/libcpufreq.so.0 (0x00007f6122077000)
> 
> 	libc.so.6 => /lib64/libc.so.6 (0x00007f6121ceb000)
> ...

 

There truly be some little differences between my .config and yours which are

"CONFIG_CPU_FREQ_STAT=m

# CONFIG_CPU_FREQ_STAT_DETAILS is not set"

my .config

 *Quote:*   

> ...
> 
> CONFIG_CPU_FREQ=y
> 
> CONFIG_CPU_FREQ_TABLE=y
> ...

 

I ran revdep-rebuild too, cpufreqd still can't start

Do you have any other ideas?

----------

## BillWho

pd1986,

I browsed the bug writeup on this and if the version wasn't bumped, for whatever reason, then try reemerging it after deleting the file from DISTDIR otherwise portage will keep using the local copy. 

Another thing you can try if that doesn't work is mask sys-power/cpufreqd-2.4.2-r1 and emerge sys-power/cpufreqd-2.4.2 to see if that version works. Downgrading glibc was also mentioned as a possible remedy,  but I would not recommend pursuing  that avenue.

There's nothing else I can think of past this.

Good luck with it    :Wink: 

----------

## pd1986

BillWho:

 *BillWho wrote:*   

> pd1986,
> 
> I browsed the bug writeup on this and if the version wasn't bumped, for whatever reason, then try reemerging it after deleting the file from DISTDIR otherwise portage will keep using the local copy. 
> 
> Another thing you can try if that doesn't work is mask sys-power/cpufreqd-2.4.2-r1 and emerge sys-power/cpufreqd-2.4.2 to see if that version works. Downgrading glibc was also mentioned as a possible remedy,  but I would not recommend pursuing  that avenue.
> ...

 

I tryied that. unmerging cpufreqd, deleting the file in DISTDIR and reemerging again. it still doen't work. the version is already 2.4.2, but not 2.4.2-r1

Given the lack of gentoo experience, downgrading glibs seems more complicated. I've no idea about it. 

Well, let it pass. I wll use cpufrequtils instead. Thank you again.

----------

## WvR

There is indeed some issue with cpufreqd which makes it highly unlikely that it will work on recent Gentoo installations. Something with a filename path being coded in the wrong way in cpufreqd. Unless the maintainer of cpufreqd fixes that bug there is nothing we can do to make cpufreqd work.

So it seems that you may be able to do the following:

```
# cd /usr/portage/distfiles

# rm -rf *

# cd

# emerge --sync

# emerge cpufreqd
```

This may solve your problem. If it doesn't, then you'll have to use cpufrequtils, or similar software depending on your specific computer.

----------

## Etal

Are you on stable? According to this bug, upgrading to -r1 might help. See if that works for you too.

----------

## pd1986

 *Etal wrote:*   

> Are you on stable? According to this bug, upgrading to -r1 might help. See if that works for you too.

 

Sorry, what do you mean by "on stable", you mean for use or for cpufreq?

for cpufreq, I ran cpufreqd-2.4.2, it should be the stable version.

according to the gentoo package description, il seems that 2.4.2-r1 is unstable. by the way, I installed cpufrequtils, but I don't know if it works properly.

----------

## BillWho

pd1986,

How you can check if cpufrequtiles is working properly. 

cpufreq-info -o | grep ^CPU 

root@gentoo-gateway conf.d # cpufreq-info -o | grep ^CPU 

CPU  0       900000 kHz ( 50 %)  -    1800000 kHz (100 %)  -  ondemand

CPU  1       900000 kHz ( 50 %)  -    1800000 kHz (100 %)  -  ondemand

CPU  2       900000 kHz ( 50 %)  -    1800000 kHz (100 %)  -  ondemand

CPU  3       900000 kHz ( 50 %)  -    1800000 kHz (100 %)  -  ondemand

Don't forget to set the governor in /etc/conf.d/cpufrequtils

# /etc/conf.d/cpufrequtils: config file for /etc/init.d/cpufrequtils

# Options when starting cpufreq (given to the `cpufreq-set` program)

START_OPTS="--governor ondemand"

----------

## Etal

 *pd1986 wrote:*   

>  *Etal wrote:*   Are you on stable? According to this bug, upgrading to -r1 might help. See if that works for you too. 
> 
> Sorry, what do you mean by "on stable", you mean for use or for cpufreq?
> 
> for cpufreq, I ran cpufreqd-2.4.2, it should be the stable version.
> ...

 

Yes, that's what I meant. Try adding "=sys-power/cpufreqd-2.4.2-r1" to /etc/portage/package.keywords, and update to it.

----------

## pd1986

 *BillWho wrote:*   

> pd1986,
> 
> How you can check if cpufrequtiles is working properly. 
> 
> cpufreq-info -o | grep ^CPU 
> ...

 

Thanks, I know that too. But what I meant is whether cpufrequtils could change the governor profile when I connect the AC adapter or not. I tried disconnecting the ac adapter. it seems that the governor is always ondemand. does that mean we need to change that manually?

----------

## pd1986

 *Etal wrote:*   

>  *pd1986 wrote:*    *Etal wrote:*   Are you on stable? According to this bug, upgrading to -r1 might help. See if that works for you too. 
> 
> Sorry, what do you mean by "on stable", you mean for use or for cpufreq?
> 
> for cpufreq, I ran cpufreqd-2.4.2, it should be the stable version.
> ...

 

Thanks. I triedcpufreqd-2.4.2-r1 a while ago. cpufreqd can start. but when I check the status, it returns "status:crashed". It's really unstable.  :Smile: 

----------

## WvR

 *pd1986 wrote:*   

> Thanks, I know that too. But what I meant is whether cpufrequtils could change the governor profile when I connect the AC adapter or not. I tried disconnecting the ac adapter. it seems that the governor is always ondemand. does that mean we need to change that manually?

 

You set cpufrequtils to "ondemand" - this is the most sensible setting in all circumstances. If you want to change the cpufrequtils settings with the presence or absence of the AC adapter, you have to look into the ACPI settings. I don't know if cpufrequtils is aware of ACPI. I'd say, check the manuals   :Very Happy:  I use cpufrequtils with "ondemand" on all my computers in all cases, and in my experience it works very well.

----------

## BillWho

 *Quote:*   

> But what I meant is whether cpufrequtils could change the governor profile when I connect the AC adapter or not.

 

check into acpid (man acpid) on how to execute a script resulting from an event.

The script can execute this line -> for p in $(sed -n '/processor/p' /proc/cpuinfo|cut -d: -f2); do cpufreq-set -c ${p} -g powersave;done

That's the only way I know of doing it. 

For now you can run that line in the terminal for a quick change..   :Wink: 

Good luck

----------

## pd1986

Ok, I understand. Hope that there won't be some problem. Thanks.

----------

## Lezard

I have the same problem with cpufreqd when running the /etc/init.d script. When I run it from the command line it starts flawlessly.

Because I have a T400 I applied the patch in this bug:  https://bugs.gentoo.org/show_bug.cgi?id=346399

I really like cpufreqd because I can monitor the temperature of my system and the programs that are running (like folding at home)

I added the command in the local.start script  :Smile: 

I hope that helps

----------

## pd1986

 *Lezard wrote:*   

> I have the same problem with cpufreqd when running the /etc/init.d script. When I run it from the command line it starts flawlessly.
> 
> Because I have a T400 I applied the patch in this bug:  https://bugs.gentoo.org/show_bug.cgi?id=346399
> 
> I really like cpufreqd because I can monitor the temperature of my system and the programs that are running (like folding at home)
> ...

 

crashed again.

after checking the message, it shows

Mar 25 21:36:31 PD cpufreqd: acpi_battery_init        : Couldn't open BAT attributes

Mar 25 21:36:31 PD cpufreqd: get_class_device_attribute: couldn't open /sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT/current_now (No such file or directory)

it seems that there is a problem with the workings of acpi on my laptop.

There are always acpi issues on my laptop, not only with that but also with my fan working....

----------

## BillWho

pd1986,

That directory is created by acpid. Do you have sys-power/acpid installed and acpid in the boot runlevel?

Also check your configuration's HID_SUPPORT

----------

## pd1986

 *BillWho wrote:*   

> pd1986,
> 
> That directory is created by acpid. Do you have sys-power/acpid installed and acpid in the boot runlevel?
> 
> Also check your configuration's HID_SUPPORT

 

yes, acpid is installed, and put in the boot runlevel. HID_SUPPORT is chosen as built-in too.

I don't know where the problem is.

----------

## depontius

Let's start with some basics...

What kind of CPU do you have?  Your initial post makes it look like you have a dual-core, but something later looks like quad-core.  Nothing yet has told me the brand.  Could you post the results of "cat /proc/cpuinfo"?

I also notice that it looks like your kernel config shotguns the cpufreq drivers, but have you preloaded anything in "/etc/conf.d/modules"?  You're not going to get anything to run for frequency modulation if the right driver isn't loaded first.  (I bumped into this one just this weekend, because the 3.x kernel series effectively "lost" a digit, and I forget to update my module configuration every "one-tenth" kernel update.)

Finally, even though something like cpufreqd is more capable, I had been opting for the simpler cpufreq-utils and found "ondemand" to be quite reliable.  So much so in fact that I've taken to just setting ondemand to my default governor, and don't bother running cpufreq-utils any more, though it's still installed and cpufreq-info is handy to have around.  Now that I mention it, I could get around my /etc/conf.d/modules update problem by just building powernow-k8 into the kernel instead of as a module.

----------

## pd1986

 *depontius wrote:*   

> Let's start with some basics...
> 
> What kind of CPU do you have?  Your initial post makes it look like you have a dual-core, but something later looks like quad-core.  Nothing yet has told me the brand.  Could you post the results of "cat /proc/cpuinfo"?
> 
> I also notice that it looks like your kernel config shotguns the cpufreq drivers, but have you preloaded anything in "/etc/conf.d/modules"?  You're not going to get anything to run for frequency modulation if the right driver isn't loaded first.  (I bumped into this one just this weekend, because the 3.x kernel series effectively "lost" a digit, and I forget to update my module configuration every "one-tenth" kernel update.)
> ...

 

sorry to reply late, I was very busy in the last several days, and I just updated the kernel version hoping that the problem would be solved, Unfortunately it's not.

it's dual-core, here is the cat /proc/cpuinfo

 *Quote:*   

> # cat /proc/cpuinfo
> 
> processor	: 0
> 
> vendor_id	: GenuineIntel
> ...

 

this is information about my .config about "cpufreq"

 *Quote:*   

> # grep -i "cpufreq" .config
> 
> # CONFIG_X86_PCC_CPUFREQ is not set
> 
> CONFIG_X86_ACPI_CPUFREQ=y
> ...

 

I add nothing in /etc/conf.d/modules, 

lsmod returns the modules that is installed automatically, like sound card driver, fcitx(asian input method).

it seems that the modulation works well with the preinstalled cpufreq driver (acpi-cpufreq)

after updating the kernel, nothing is fixed. Neither cpufreqd nor fan problem

----------

## depontius

 *pd1986 wrote:*   

> 
> 
> this is information about my .config about "cpufreq"
> 
>  *Quote:*   # grep -i "cpufreq" .config
> ...

 

You have the acpi cpufreq driver built right into the kernel, so you need not load any module.  That makes this sound like a cpufreqd configuration problem.  Have you tried using cpufrequtils as an alternative, just to make sure modulation is working properly?

----------

## pd1986

 *depontius wrote:*   

>  *pd1986 wrote:*   
> 
> this is information about my .config about "cpufreq"
> 
>  *Quote:*   # grep -i "cpufreq" .config
> ...

 

You mean that I should installed it as module? This method really makes the alsa find my sound card driver, but not sure if it works for cpufreq

I didn't install cpufrequtils, but when I installed cpufreqd, it installed automatically cpufrequtils with the version different from the that if I install cpufrequtils independently.

I think I'm pretty sure that the modulation is working. I checked it when I compiled libreoffice. the frequency varied by itself.

----------

## depontius

 *pd1986 wrote:*   

> 
> 
> You mean that I should installed it as module? This method really makes the alsa find my sound card driver, but not sure if it works for cpufreq
> 
> I didn't install cpufrequtils, but when I installed cpufreqd, it installed automatically cpufrequtils with the version different from the that if I install cpufrequtils independently.
> ...

 

Sounds like you got cpu frequency modulation properly configured and working.  I wouldn't change to a module, in fact I'm thinking now that I should move mine from module to in-kernel, since I always use it.  I'm not sure what your problem is, at this point.

----------

## pd1986

 *depontius wrote:*   

>  *pd1986 wrote:*   
> 
> You mean that I should installed it as module? This method really makes the alsa find my sound card driver, but not sure if it works for cpufreq
> 
> I didn't install cpufrequtils, but when I installed cpufreqd, it installed automatically cpufrequtils with the version different from the that if I install cpufrequtils independently.
> ...

 

so cpufreqd is not necessary?

----------

## dim0xff

 *pd1986 wrote:*   

>  *Lezard wrote:*   I have the same problem with cpufreqd when running the /etc/init.d script. When I run it from the command line it starts flawlessly.
> 
> Because I have a T400 I applied the patch in this bug:  https://bugs.gentoo.org/show_bug.cgi?id=346399
> 
> I really like cpufreqd because I can monitor the temperature of my system and the programs that are running (like folding at home)
> ...

 

Hello!

I've had the same problem.

Try to check if file /sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT/power_now exists

If yes, then you should to recompile cpufreqd with some changes in source code:

file cpufreqd-2.4.2/src/cpufreqd_acpi_battery.c

line 38

Change from #define CURRENT_NOW "current_now" to #define CURRENT_NOW "power_now"

PS: http://sourceforge.net/tracker/index.php?func=detail&aid=3172707&group_id=58904&atid=489239

PPS: It helps me.

----------

## pd1986

 *dim0xff wrote:*   

>  *pd1986 wrote:*    *Lezard wrote:*   I have the same problem with cpufreqd when running the /etc/init.d script. When I run it from the command line it starts flawlessly.
> 
> Because I have a T400 I applied the patch in this bug:  https://bugs.gentoo.org/show_bug.cgi?id=346399
> 
> I really like cpufreqd because I can monitor the temperature of my system and the programs that are running (like folding at home)
> ...

 

This file does exist. But I don't know where the C file is. Could you tell me please? Thanks

----------

## dim0xff

 *pd1986 wrote:*   

> 
> 
> This file does exist. But I don't know where the C file is. Could you tell me please? Thanks

 

The easiest, but wrong way:

%> sudo emerge -1v cpufreqd

```
 * cpufreqd-2.4.2.tar.bz2 RMD160 SHA1 SHA256 size ;-) ...                                                                               [ ok ]

>>> Unpacking source...

>>> Unpacking cpufreqd-2.4.2.tar.bz2 to /var/tmp/portage/sys-power/cpufreqd-2.4.2-r1/work

>>> Source unpacked in /var/tmp/portage/sys-power/cpufreqd-2.4.2-r1/work

>>> Preparing source in /var/tmp/portage/sys-power/cpufreqd-2.4.2-r1/work/cpufreqd-2.4.2 ...

 * Applying cpufreqd-conf.d.patch ...                                                                                                   [ ok ]

 * Applying cpufreqd-2.4.2-PATH_MAX.patch ...                                                                                          [ ok ]

>>> Source prepared.

>>> Configuring source in /var/tmp/portage/sys-power/cpufreqd-2.4.2-r1/work/cpufreqd-2.4.2 ...
```

At this time you should press Ctrl-Z.

```
[1]+  Stopped                 emerge -1v cpufreqd

%>

```

In the other win open and edit file /var/tmp/portage/sys-power/cpufreqd-2.4.2-r1/work/cpufreqd-2.4.2/src/cpufreqd_acpi_battery.c

Then go back and enter fg command, so emerging will continue.

This will work, BUT this is wrong way, because after next full system upgrade these changes will be lost.

The right way:

1. create patch 

2. put your own copy cpufreqd ebuild with patch to local overlay

3. submit patch to bugtracker  :Smile: 

PS: sorry for my English

----------

## pd1986

 *dim0xff wrote:*   

>  *pd1986 wrote:*   
> 
> This file does exist. But I don't know where the C file is. Could you tell me please? Thanks 
> 
> The easiest, but wrong way:
> ...

 

understood, thanks.

PS: don't worry, my english sucks too

----------

