Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
cpufrequtils - file exists, but gives "not found" error
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
causality
Apprentice
Apprentice


Joined: 03 Jun 2006
Posts: 228

PostPosted: Wed Apr 09, 2014 9:48 pm    Post subject: cpufrequtils - file exists, but gives "not found" Reply with quote

I could just be overlooking something simple, but I don't understand why cpufrequtils is complaining about a file not found.

My frequency scaling works and I am successfully using the "ondemand" governor. As far as I can tell this is more of a nuisance and isn't causing real problems, though I am not certain of that. The problems happens whenever "/etc/init.d/cpufrequtils stop" is called (including invocation via "restart"). I generally see this message when shutting down:

Code:
* Running cpufreq-set --governor performance ...
/usr/libexec/cpufrequtils-change.sh: line 26: cd: /sys/devices/system/cpu/cpufreq: No such file or directory            [ !! ]
 * ERROR: cpufrequtils failed to stop


The thing is, that directory does exist:

Code:
# cd /sys/devices/system/cpu/cpufreq/
causality cpufreq # ls
ondemand
causality cpufreq #


The entire /usr/libexec/cpufrequtils-change.sh script looks like this (line 26 is the one containing the "cd" command):

Code:
#!/bin/bash
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-power/cpufrequtils/files/cpufrequtils-change.sh,v 1.3 2013/05/09 20:21:42 lxnay Exp $

ret=0 opts= gov_opts= sep=
for o in "${@}" ; do
        [ "${o}" = "--" ] && sep=1 && continue
        if [ -n "${sep}" ]; then
                gov_opts="${gov_opts} ${o}"
        else
                opts="${opts} ${o}"
        fi
done

echo "cpufreq-set options: ${opts}"
echo "Governor options: ${gov_opts}"

for c in $(cpufreq-info -o | awk '$1 == "CPU" { print $2 }') ; do
        cpufreq-set -c ${c} ${opts}
        : $(( ret += $? ))
done

if [ $# -gt 0 ] ; then
        c=1
        if cd /sys/devices/system/cpu/cpufreq ; then
                for o in ${gov_opts}; do
                        v=${o#*=}
                        o=${o%%=*}
                        echo ${v} > ${o} || break
                done
                c=0
        fi
        : $(( ret += c ))
fi

exit ${ret}


I just don't see why this isn't working.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Thu Apr 10, 2014 1:21 pm    Post subject: Re: cpufrequtils - file exists, but gives "not found&qu Reply with quote

causality wrote:
I could just be overlooking something simple, but I don't understand why cpufrequtils is complaining about a file not found.

causality ... you should probably switch to using sys-power/cpupower. Anyhow, I'm not quite sure what the issue is, I suspect your conf.d/cpufrequtils doesn't provide SYSFS_EXTRA and the script doesn't check if this var has a value or not. Looks as though this script was split out in order to accommodate systemd, so as you're using openrc I'd suggest replacing /etc/init.d/cpufrequtils with the following ...

Code:
#!/sbin/runscript
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

CPUFREQ_SYSFS=/sys/devices/system/cpu/cpufreq

change() {
   local c ret=0 opts="$1"
   if [ -n "$opts" ] ; then
      ebegin "cpufreq-set options: ${opts}"
         for c in $(cpufreq-info -o | awk '$1 == "CPU" {print $2}') ; do
         cpufreq-set -c ${c} ${opts}
         : $(( ret += $? ))
      eend ${ret}

      if [ -d ${CPUFREQ_SYSFS} ] && [ -n "${SYSFS_EXTRA}" ] ; then
         c=1
         einfo "Setting extra options: ${SYSFS_EXTRA}"
         if cd ${CPUFREQ_SYSFS} ; then
            local o v
            for o in ${SYSFS_EXTRA} ; do
               v=${o#*=}
               o=${o%%=*}
               echo ${v} > ${o} || break
            done
            c=0
         fi
         eend ${c}
         : $(( ret += c ))
      fi
   fi

   return ${ret}
}

start() {
   change "${START_OPTS}"
}

stop() {
   change "${STOP_OPTS}"
}

... I didn't test this (as I'm using cpupower) but it should work as expected (let me know if there are issues and I'll try and resolve them).

best ... khay
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