# Power Management Issue - Baselayout 2 {Solved}

## danky

I did a clean install of gentoo on my asus w3j laptop.  Durring the minimal install I added "ACCEPT_KEYWORDS="~x86" to my make.conf file.  After I was done with the minimal install I did the following:

```
emerge --sync

emerge -avtDNu world

etc-update

gcc-config i686-pc-linux-gnu-4.1.1

env-update && source /etc/profile

emerge -av --depclean

eclean distfiles

glsa-check -f affected

revdep-rebuild

```

then I rebooted the system and did:

```
emerge -e system && emerge -e system && emerge -e world && emerge -e world
```

Then I followed this guide to setup power managment for the laptop: http://www.gentoo.org/doc/en/power-management-guide.xml

I did the sections for acpid, cpu power managment, and sleep modes.  The only issue I seem to have is with the pmg_switch_runlevel.sh script:

```
#!/bin/bash

# BEGIN configuration

RUNLEVEL_AC="default"

RUNLEVEL_BATTERY="battery"

# END configuration

if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ]

then

    logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting."

    exit 1

fi

if [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ]

then

    logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting."

    exit 1

fi

if on_ac_power

then

    if [[ "$(</var/lib/init.d/softlevel)" != "${RUNLEVEL_AC}" ]]

    then

        logger "Switching to ${RUNLEVEL_AC} runlevel"

         /sbin/rc ${RUNLEVEL_AC}

    fi

elif [[ "$(</var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY}" ]]

then

    logger "Switching to ${RUNLEVEL_BATTERY} runlevel"

    /sbin/rc ${RUNLEVEL_BATTERY}

fi

```

when the system is rebooted I get an error on startup that states the following: 

```
 /etc/acpi/actions/pmg_switch_runlevel.sh: line 23: /var/lib/init.d/softlevel: No such file or directory
```

On a baselayout 2 system there is no /var/lib/init.d/softlevel file.  But if I do locate softlevel it returns the following: /lib/rc/cache/softlevel

if I cat /lib/rc/cache/softlevel it returns shutdown

if I cat /var/lib/init.d/softlevel on a baselayout 1 machine it returns default

looks like the pmg_switch_runlevel.sh script is looking for default or battery to be returned from that file.  

Any ideas how I can get this working correctly?Last edited by danky on Wed Mar 04, 2009 6:40 pm; edited 1 time in total

----------

## ppurka

Since you are on baselayout-2 + openrc, replace $(</var/lib/init.d/softlevel) with $(rc-status -r).

----------

## danky

Thank you I will give that a shot

----------

## danky

That fixed the problem, thanks

----------

