You are not logged in.

#1 2012-09-27 16:51:05

rggjan
Member
Registered: 2007-01-06
Posts: 69

[solved][laptop-mode-tools] hard drive power settings not applied

I've used the laptop-mode-tools now for quite some time. However, recently the power management settings are not applied anymore. Possibly since updating to systemd...

My laptop-mode.conf looks as follows:

CONTROL_HD_POWERMGMT=1

#
# Power management for HD (hdparm -B values)
#
BATT_HD_POWERMGMT=254
LM_AC_HD_POWERMGMT=254
NOLM_AC_HD_POWERMGMT=254

However, even after doing a systemctl restart laptop-mode-tools.service I always get

$ sudo hdparm -B /dev/sda                          

/dev/sda:
 APM_level	= 96

Setting it manually works:

$ sudo hdparm -B 254 /dev/sda

/dev/sda:
 setting Advanced Power Management level to 0xfe (254)
 APM_level	= 254
$ sudo hdparm -B /dev/sda 

/dev/sda:
 APM_level	= 254

Of course, the settings are lost upon rebooting in this case.

Any idea where the problem could be?

Last edited by rggjan (2012-10-08 12:25:04)

Offline

#2 2012-09-28 13:05:20

Revolt
Member
From: Portugal
Registered: 2009-06-11
Posts: 71
Website

Re: [solved][laptop-mode-tools] hard drive power settings not applied

Now that you mention it, I'm experiencing the same problem

Offline

#3 2012-09-28 14:36:14

sano
Member
Registered: 2012-02-11
Posts: 114

Re: [solved][laptop-mode-tools] hard drive power settings not applied

I just checked it, no problem here. Running pure systemd, if that makes a difference...

Offline

#4 2012-09-28 15:22:35

rggjan
Member
Registered: 2007-01-06
Posts: 69

Re: [solved][laptop-mode-tools] hard drive power settings not applied

Pure systemd here, too...

Offline

#5 2012-09-30 19:41:54

Revolt
Member
From: Portugal
Registered: 2009-06-11
Posts: 71
Website

Re: [solved][laptop-mode-tools] hard drive power settings not applied

Turns out my problem was different: laptop-mode does set the values correctly but it wasn't being reloaded after a resume due to the pm-utils HOOK_BLACKLIST="hal-cd-polling intel-audio-powersave journal-commit laptop-mode pcie_aspm readahead sata_alpm sched-powersave xfs_buffer wireless" matching the 99laptop-mode file in sleep.d.

Removed laptop-mode from the blacklist and now I can keep my hdparm -B value consistently on 254

Offline

#6 2012-10-08 12:24:38

rggjan
Member
Registered: 2007-01-06
Posts: 69

Re: [solved][laptop-mode-tools] hard drive power settings not applied

I just found the problem here, too. Just sent this Mail to the author:


I'm using your laptop-mode tools on an up-to-date archlinux system. The problem when switching to systemd is the following:
I have set the following settings in the configuration:

CONTROL_HD_POWERMGMT=1
BATT_HD_POWERMGMT=254
LM_AC_HD_POWERMGMT=254
NOLM_AC_HD_POWERMGMT=254

upon startup, they are correctly applied (hdparm -B 254). However, when suspending the laptop with pm-tools and waking it up again, hdparm -B shows me the default values of 96 instead of 254. This setting should be reapplied by laptop-mode-tools. There is actually this file: /usr/lib/pm-utils/sleep.d/01laptop-mode that handles it. When using systemd, however, this is NOT applied. Therefore, a custom systemd sleep hook is probably needed in /usr/lib/systemd/system-sleep/example.sh, as described here: https://wiki.archlinux.org/index.php/Systemd

This could be as simple as the following file (just tested it):

cat /usr/lib/systemd/system-sleep/laptop-mode.sh
#!/bin/sh

case "$1" in
  pre )
    ;;
  post )
    /usr/sbin/laptop_mode force
    ;;
esac

Offline

#7 2012-11-15 15:38:41

andreyv
Member
From: Riga, Latvia
Registered: 2012-11-02
Posts: 33

Re: [solved][laptop-mode-tools] hard drive power settings not applied

With the latest laptop-mode-tools (which claims to support systemd) I can't get this fixed even after applying rggjan's workaround… I don't have anything in /etc/pm/config.d, so there should be no HOOK_BLACKLIST defined.

Offline

#8 2012-11-16 16:37:14

dif
Member
From: Stalowa Wola, Poland
Registered: 2009-12-22
Posts: 137

Re: [solved][laptop-mode-tools] hard drive power settings not applied

In my case, rggjan's sollution solved the problem that occured after suspend. But I still have a problem when I astarting my laptop. Laptop-mode starts or does not start quite ramdomly. I have LVM so I thought that delaying the start of laptop-mode.service until after lvm.service has been started would help. It didn't.

Perhaps this should be a separate forum topic.

Offline

#9 2012-11-17 15:22:11

rogorido
Member
Registered: 2009-08-17
Posts: 111

Re: [solved][laptop-mode-tools] hard drive power settings not applied

I'm also experiencing the same problem. And:
1) it happens when I do a fresh boot;
2) I dont have any files in /etc/pm/config.d/

Offline

#10 2013-01-24 13:00:15

renegat
Member
From: Europe
Registered: 2012-12-28
Posts: 88

Re: [solved][laptop-mode-tools] hard drive power settings not applied

I apologize if it is bad style to answer to a post marked as [solved] but:
Same problem here!
HDParm-settings are not applied on boot by LMT.
laptop-mode.conf:

# Should laptop mode tools control the hard drive power management settings?
#
# Set to 0 to disable
CONTROL_HD_POWERMGMT="auto"
#
# Power management for HD (hdparm -B values)
#
BATT_HD_POWERMGMT=100
LM_AC_HD_POWERMGMT=200
NOLM_AC_HD_POWERMGMT=254
# hdparm -B /dev/sda

/dev/sda:
 APM_level	= 96

Any ideas or solutions on this so far?
And why is this post marked as 'solved'?

edit:
1.) manual set hdparm-settings survive reboot but not suspend!
2.) no difference between CONTROL_HD_POWERMGMT="auto" or "1"
3.)

# systemctl status laptop-mode
laptop-mode.service - Laptop Mode Tools
	  Loaded: loaded (/usr/lib/systemd/system/laptop-mode.service; enabled)
	  Active: active (exited) since Do 2013-01-24 14:05:20 CET; 8min ago
	 Process: 664 ExecStart=/usr/sbin/laptop_mode init auto (code=exited, status=0/SUCCESS)

4.) pointed out that this seems to be a bug: https://bugs.archlinux.org/task/33262 as systemd does not restore apm values on wake up.

Last edited by renegat (2013-03-09 11:01:42)

Offline

#11 2014-01-10 14:59:16

andreyv
Member
From: Riga, Latvia
Registered: 2012-11-02
Posts: 33

Re: [solved][laptop-mode-tools] hard drive power settings not applied

I think I may have found the solution for the suspend problem: open

/lib/udev/rules.d/99-laptop-mode.rules

and change the

lmt-udev auto

lines to

lmt-udev auto force

Offline

#12 2015-01-03 09:01:17

thenextdon13
Member
Registered: 2013-01-18
Posts: 58

Re: [solved][laptop-mode-tools] hard drive power settings not applied

This worked for me.  Thank you, andreyv!

What does 'force' do in these situations?  If i'm not wrong, it is from this bit of the manual:

"       Specify  force  as  the second parameter to force laptop_mode to re-apply a state even if the computer is already in that state. These are
       the values that are allowed for cmd :
"

Offline

#13 2015-01-03 09:20:00

andreyv
Member
From: Riga, Latvia
Registered: 2012-11-02
Posts: 33

Re: [solved][laptop-mode-tools] hard drive power settings not applied

thenextdon13 wrote:

What does 'force' do in these situations?  If i'm not wrong, it is from this bit of the manual:

"       Specify  force  as  the second parameter to force laptop_mode to re-apply a state even if the computer is already in that state. These are
       the values that are allowed for cmd :
"

Yes, it's this parameter. When suspend occurs, the AC/battery state doesn't change, so laptop-mode-tools think that nothing should be done. But with "force" we force it to set all settings anyway.

Offline

Board footer

Powered by FluxBB