# [solved] hdparm init script does not work...

## pste

I considered to post this in https://forums.gentoo.org/viewtopic-t-889400.html, but since that was marked closed I decided to start a new topic!

I have a similar problem, the harddrives of my laptop have ridiculous default power settings and there is no bios setting availble. So I configured hdparm with

```
sata_all_args="-B255 -S0"
```

and added it to default runlevel. During startup hdparm init script shows [ok] for both drives. Still, when system is started completely and gnome/kde is loaded, the significant value (for both drives) is back to the default

```
# hdparm -B /dev/sda

/dev/sda:

 APM_level = 1
```

However, when I issue

```
/etc/init.d/hdparm restart
```

the value becomes

```
# hdparm -B /dev/sda

/dev/sda:

 APM_level = off
```

and the drive behave as I like (it keeps spinning) throughout that session. I have made sure gnome power settings are off...

Anyone know why this is happening and how to make init settings stick?

/psteLast edited by pste on Wed Oct 12, 2011 8:13 am; edited 1 time in total

----------

## ppurka

It seems hdparm is started very early in the boot process. There is a note in the /etc/conf.d/hdparm to start hdparm from local.start in certain cases.

----------

## pste

Thank's for the tip ppurka (one should of course read such notes more carefully), unfortunately it wasn't the catch... although it made me walk through start-up with an interactive boot giving me enough to blame gnome for this.

Skipping xdm (gdm) render the drives with correct settings both with hdparm and local, but starting the desktop restores this to default for some reason? As I said, spin-down settings are unchecked in power-manager (and doublechecked in gconf) leaving some other gnome/dbus/??? magic responsible. I still have to restart hdparm (or local) in order to get what I want. Annoying (and close to a windoze-like automagic behavior), isn't it?

Any clues?

/pste

----------

## mack1

Some power settings are done by pm-utils, the config files are in /usr/lib/pm-utils/power.d/.

Cheers

----------

## pste

yepp, that seems to be the culprit - thank's for giving directions mack1

I recognize the default values from /usr/lib/pm-utils/power.d/harddrive

```
# Default values on AC

DRIVE_SPINDOWN_VALUE_AC="${DRIVE_SPINDOWN_VALUE_AC:-0}"

DRIVE_WRITE_CACHE_AC="${DRIVE_WRITE_CACHE_AC:-1}" 

DRIVE_POWER_MGMT_AC="${DRIVE_POWER_MGMT_AC:-254}"

DRIVE_ACOUSTIC_MGMT_AC="${DRIVE_ACOUSTIC_MGMT_AC:-0}"

# Default values on battery

DRIVE_SPINDOWN_VALUE_BAT="${DRIVE_SPINDOWN_VALUE_BAT:-6}"

DRIVE_WRITE_CACHE_BAT="${DRIVE_WRITE_CACHE_BAT:-0}" 

DRIVE_POWER_MGMT_BAT="${DRIVE_POWER_MGMT_BAT:-1}"

DRIVE_ACOUSTIC_MGMT_BAT="${DRIVE_ACOUSTIC_MGMT_BAT:-254}"

```

although these variables seem possible to be initialized in some other place, do you know where? Some "central" config file perhaps?

/pste

----------

## mack1

 *Quote:*   

> 
> 
> although these variables seem possible to be initialized in some other place, do you know where? Some "central" config file perhaps?
> 
> 

 

If I understand the manual... you must copy the files located at /usr/lib/pm-utils/power.d in /etc/pm/power.d/ and then edit them.

Cheers

----------

## pste

hehehe... once again, one should read the manuals   :Embarassed:   - anyway, thank's for guiding me, and the solution was even slightly simpler (or gentoo-config-style-like) than you suggested mack1 (although perfectly along your suggested line of action!). I just placed a file in /etc/pm/config.d/ with my preferred values, i.e.:

```
# preferred values to defaults in /usr/lib/pm-utils/power.d/harddrive

DRIVE_SPINDOWN_VALUE_AC=0

DRIVE_SPINDOWN_VALUE_BAT=0

DRIVE_POWER_MGMT_AC=255

DRIVE_POWER_MGMT_BAT=255
```

And the settings are according to my wishes even when the desktop is started   :Cool:   --> [solved] - simple as nothing when you get to know how to do it! This is why forum support is the best, thank you both!

/pste

----------

## mack1

 *Quote:*   

> 
> 
> And the settings are according to my wishes even when the desktop is started  --> [solved] - simple as nothing when you get to know how to do it!
> 
> 

 

 :Very Happy:   :Very Happy:   :Very Happy: 

 *Quote:*   

> 
> 
> This is why forum support is the best, thank you both!
> 
> 

 

The same here   :Smile: 

Cheers

----------

## ppurka

Wow! pm-utils messing up stuff, as usual  :Wink: 

----------

## tbart

found out the same as per my problem at

https://forums.gentoo.org/viewtopic-p-6893114.html#6893114

still, I set 255 (disable, work on console) for Advanced PM and I get 128 after wake from suspend. Still better than a spindown every 30 secs but not quite like what I expected to get.

The manual also not really states you can set these values, but it seems logical..

----------

