You are not logged in.

#1 2012-01-29 16:45:37

duquesnc
Member
Registered: 2008-12-10
Posts: 94
Website

laptop-mode-tools loops on lock_retry()

I have been struggling with laptop-mode-tools for a while, so I am finally posting here.

Short version:
laptop-mode-tools never does anything on acpi events. Here is what happens in /var/log/everything.log when I unplug the ac adaptor:

Jan 29 17:20:25 localhost laptop-mode: Determining power state from /sys/class/power_supply/ACAD/online.
Jan 29 17:20:25 localhost laptop-mode: Not trying other options, already found a power supply.
Jan 29 17:20:25 localhost laptop-mode: Battery level polling is disabled.
Jan 29 17:20:25 localhost laptop-mode: Prelim lock acquisition on descriptor 8 with pid 8098
Jan 29 17:20:25 localhost laptop-mode: Couldn't acquire prelim lock on descriptor 9 with pid 8098
Jan 29 17:20:25 localhost laptop-mode: Now invoking lock_retry with arguments -- auto
Jan 29 17:20:25 localhost kernel: [ 2961.821328] EXT4-fs (sda5): re-mounted. Opts: commit=300,commit=600
Jan 29 17:20:26 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8098\n
Jan 29 17:20:27 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8098\n
Jan 29 17:20:28 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8098\n
Jan 29 17:20:29 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8098\n
Jan 29 17:20:30 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8098\n
Jan 29 17:20:31 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8098\n
Jan 29 17:20:32 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8098\n
Jan 29 17:20:33 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8098\n
Jan 29 17:20:34 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8098\n
Jan 29 17:20:35 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8098\n
Jan 29 17:20:35 localhost laptop-mode: Determining power state from /sys/class/power_supply/ACAD/online.
Jan 29 17:20:35 localhost laptop-mode: Not trying other options, already found a power supply.
Jan 29 17:20:35 localhost laptop-mode: Battery level polling is disabled.
Jan 29 17:20:35 localhost laptop-mode: Prelim lock acquisition on descriptor 8 with pid 8188
Jan 29 17:20:35 localhost laptop-mode: Couldn't acquire prelim lock on descriptor 9 with pid 8188
Jan 29 17:20:35 localhost laptop-mode: Now invoking lock_retry with arguments -- auto
Jan 29 17:20:36 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8188\n
Jan 29 17:20:37 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8188\n
Jan 29 17:20:38 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8188\n
Jan 29 17:20:39 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8188\n
Jan 29 17:20:40 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8188\n
Jan 29 17:20:41 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8188\n
Jan 29 17:20:42 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8188\n
Jan 29 17:20:43 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8188\n
Jan 29 17:20:44 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8188\n
Jan 29 17:20:45 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 8188\n

To obtain this log, I switched to 1 the variables VERBOSE_OUTPUT, LOG_TO_SYSLOG and DEBUG in /etc/laptop-mode/laptop-mode.conf

long version:

If I understand correctly, when the ac adapter is unplugged, the script /etc/acpi/events/lm_ac_adapter (which basically grabs every acpi events starting with ac_adapter), triggers the script /etc/acpi/actions/lm_ac_adapter.sh, and this action triggers the command '/usr/sbin/laptop_mode auto'

I could check that acpid does its work correctly by modifying /etc/acpi/actions/lm_ac_adapter.sh and checking it is called immediately when I unplug the adapter, so I tried to manually call '/usr/sbin/laptop_mode auto' after unplugging the adapter, and I discovered that laptop_mode gets stuck in calling lock_retry() 10 times and then exists.

See this paste: http://pastie.org/3276821

Any idea how to fix that?

Last edited by duquesnc (2012-01-29 17:26:05)

Offline

#2 2012-01-29 17:01:04

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,017

Re: laptop-mode-tools loops on lock_retry()

Removing lmt-*.lock files from /var/lock/ after having stopped the laptop-mode "daemon" could (temporarily?) help. Perhaps you have a battery-level-polling.conf.pacnew file in /etc/laptop-mode/conf.d/ - merging the changes might help.

Offline

#3 2012-01-29 17:55:16

duquesnc
Member
Registered: 2008-12-10
Posts: 94
Website

Re: laptop-mode-tools loops on lock_retry()

lucke wrote:

Perhaps you have a battery-level-polling.conf.pacnew file in /etc/laptop-mode/conf.d/ - merging the changes might help.

No, this installation is brand new (I just got this laptop).

Removing lmt-*.lock files from /var/lock/ after having stopped the laptop-mode "daemon" could (temporarily?) help.

Trying to apply this advice, I realized something strange: calling 'rc.d stop laptop-mode' does not really stop laptop-mode:

I first reboot the laptop in order to get rid of everything I could have done previously that could mess with the daemon. Then I check the lock files you mentionned exist:

ls /var/lock/lmt-*.lock      
/var/lock/lmt-battpoll.lock  /var/lock/lmt-invoc.lock  /var/lock/lmt-req.lock

Then, when calling

rc.d stop laptop-mode

I get in /var/log/everything.log:

Jan 29 18:47:08 localhost laptop-mode: Now invoking lock_retry with arguments -- stop
Jan 29 18:47:09 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20296\n
Jan 29 18:47:10 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20296\n
Jan 29 18:47:11 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20296\n
Jan 29 18:47:12 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20296\n
Jan 29 18:47:13 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20296\n
Jan 29 18:47:14 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20296\n
Jan 29 18:47:15 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20296\n
Jan 29 18:47:16 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20296\n
Jan 29 18:47:17 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20296\n
Jan 29 18:47:18 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20296\n

If I check /var/lock/lmt-*.lock after that, all the files are still there (they were not removed)

ls /var/lock/lmt-*.lock      
/var/lock/lmt-battpoll.lock  /var/lock/lmt-invoc.lock  /var/lock/lmt-req.lock

If I unplug the laptop after having stopped laptop-mode, I still get messages from laptop-mode in /var/log/everything.log!!!

Jan 29 18:53:06 localhost laptop-mode: Determining power state from /sys/class/power_supply/ACAD/online.
Jan 29 18:53:06 localhost laptop-mode: Not trying other options, already found a power supply.
Jan 29 18:53:06 localhost laptop-mode: Battery level polling is enabled.
Jan 29 18:53:06 localhost laptop-mode: Lock acquisition on descriptor 7 failed with pid 20828
Jan 29 18:53:06 localhost laptop-mode: Prelim lock acquisition on descriptor 8 with pid 20828
Jan 29 18:53:06 localhost laptop-mode: Couldn't acquire prelim lock on descriptor 9 with pid 20828
Jan 29 18:53:06 localhost laptop-mode: Now invoking lock_retry with arguments -- auto
Jan 29 18:53:06 localhost kernel: [ 8514.884884] EXT4-fs (sda5): re-mounted. Opts: commit=300,commit=600
Jan 29 18:53:07 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20828\n
Jan 29 18:53:08 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20828\n
Jan 29 18:53:09 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20828\n
Jan 29 18:53:10 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20828\n
Jan 29 18:53:11 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20828\n
Jan 29 18:53:12 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20828\n
Jan 29 18:53:13 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20828\n
Jan 29 18:53:14 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20828\n
Jan 29 18:53:15 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20828\n
Jan 29 18:53:16 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20828\n
Jan 29 18:53:16 localhost laptop-mode: Determining power state from /sys/class/power_supply/ACAD/online.
Jan 29 18:53:16 localhost laptop-mode: Not trying other options, already found a power supply.
Jan 29 18:53:16 localhost laptop-mode: Battery level polling is enabled.
Jan 29 18:53:16 localhost laptop-mode: Lock acquisition on descriptor 7 failed with pid 20920
Jan 29 18:53:16 localhost laptop-mode: Prelim lock acquisition on descriptor 8 with pid 20920
Jan 29 18:53:16 localhost laptop-mode: Couldn't acquire prelim lock on descriptor 9 with pid 20920
Jan 29 18:53:16 localhost laptop-mode: Now invoking lock_retry with arguments -- auto
Jan 29 18:53:17 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20920\n
Jan 29 18:53:18 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20920\n
Jan 29 18:53:19 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20920\n
Jan 29 18:53:20 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20920\n
Jan 29 18:53:21 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20920\n
Jan 29 18:53:22 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20920\n
Jan 29 18:53:23 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20920\n
Jan 29 18:53:24 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20920\n
Jan 29 18:53:25 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20920\n
Jan 29 18:53:26 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 20920\n

When I remove the files, I can stop laptop-mode for good, but when I restart it, it re-creates them and the problems start again after the next acpi event...

Last edited by duquesnc (2012-01-29 18:10:23)

Offline

#4 2012-01-31 03:09:54

Cows
Member
From: Brooklyn, NY
Registered: 2007-05-20
Posts: 101

Re: laptop-mode-tools loops on lock_retry()

Hmm, weird.

My laptops power stuff is working fine. I'm using KDE 4.8.0, so I guess the power management stuff handle sit for me. I do have pm-utils installed, but nothing else. No acpid,acpi,laptop-mode-tools,cpufrequtils (I don't remember having to install frequtils, even as a dependency).

When I'm compiling my custom kernels, I do have to enable the Watchdog Core in the kernel config. Make sure that it's enabled.

Device Drivers -> Watchdog Timer Support -> Watchdog Timer Driver Core , & Intel TCO Timer/Watchdog

SYMBOL: WATCHDOG_CORE
             : ITCO_WDT

You can try with and without the Intel TCO Timer, I'm not even sure if that is for my computer, I haven't tested it without it, but I will some day. The watchdog should be enough though. It's enough on my desktop, but computers vary.

Also if you are using the stock Arch kernel, the watchdog should be enabled.

Last edited by Cows (2012-01-31 03:10:12)

Offline

#5 2012-01-31 10:04:10

duquesnc
Member
Registered: 2008-12-10
Posts: 94
Website

Re: laptop-mode-tools loops on lock_retry()

Thanks for replying (I PMed Cows because I saw from another thread that we have the same laptop).

I am using the stock kernel.

I don't want to use kde stuff and prefer laptop-mode-tools because it has almost no dependencies and works without X (useful when you are just editing code in a console and want as much battery as possible).

Offline

#6 2012-01-31 11:03:43

duquesnc
Member
Registered: 2008-12-10
Posts: 94
Website

Re: laptop-mode-tools loops on lock_retry()

duquesnc wrote:

When I remove the files, I can stop laptop-mode for good, but when I restart it, it re-creates them and the problems start again after the next acpi event...

Actually, I was wrong. Once launched, laptop-mode never stops. Here is what I just did:

1) fully reinstalled (-Rns) laptop-mode-tools, reenabled logging, enabled laptop-mode-tools on AC and some modules (but did not tweak them)
2) rebooted with the daemon enabled in /etc/rc.conf
3) tried to stop it

xps-14z:~/ % sudo rc.d stop laptop-mode 
:: Stopping laptop-mode                                                                                                                                                                    [DONE] 
xps-14z:~/ % sudo rm /var/lock/lmt-*.lock 
xps-14z:~/ % sudo rc.d stop laptop-mode     
:: Stopping laptop-mode                                                                                                                                                                    [DONE] 

However, it is still running. Here is what I see when I unplug the laptop:

 % tail -f /var/log/everything.log
Jan 31 11:47:32 localhost laptop-mode: Now invoking lock_retry with arguments -- auto
Jan 31 11:47:32 localhost kernel: [  182.309477] EXT4-fs (sda5): re-mounted. Opts: commit=300,commit=600
Jan 31 11:47:33 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3473\n
Jan 31 11:47:34 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3473\n
Jan 31 11:47:35 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3473\n
Jan 31 11:47:36 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3473\n
Jan 31 11:47:37 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3473\n
Jan 31 11:47:38 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3473\n
Jan 31 11:47:39 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3473\n
Jan 31 11:47:40 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3473\n
Jan 31 11:47:41 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3473\n
Jan 31 11:47:42 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3473\n
Jan 31 11:47:42 localhost laptop-mode: Determining power state from /sys/class/power_supply/ACAD/online.
Jan 31 11:47:42 localhost laptop-mode: Not trying other options, already found a power supply.
Jan 31 11:47:42 localhost laptop-mode: Battery level polling is disabled.
Jan 31 11:47:42 localhost laptop-mode: Prelim lock acquisition on descriptor 8 with pid 3570
Jan 31 11:47:42 localhost laptop-mode: Couldn't acquire prelim lock on descriptor 9 with pid 3570
Jan 31 11:47:42 localhost laptop-mode: Now invoking lock_retry with arguments -- auto
Jan 31 11:47:43 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3570\n
Jan 31 11:47:44 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3570\n
Jan 31 11:47:45 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3570\n
Jan 31 11:47:46 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3570\n
Jan 31 11:47:47 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3570\n
Jan 31 11:47:48 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3570\n
Jan 31 11:47:49 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3570\n
Jan 31 11:47:50 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3570\n
Jan 31 11:47:51 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3570\n
Jan 31 11:47:52 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Retrying.... PID is 3570\n
Jan 31 11:47:52 localhost logger: ACPI action undefined: PNP0C0A:00
Jan 31 11:47:52 localhost logger: ACPI group/action undefined: processor / LNXCPU:00
Jan 31 11:47:52 localhost logger: ACPI group/action undefined: processor / LNXCPU:01
Jan 31 11:47:52 localhost logger: ACPI group/action undefined: processor / LNXCPU:02
Jan 31 11:47:52 localhost logger: ACPI group/action undefined: processor / LNXCPU:03
Jan 31 11:47:42 localhost laptop-mode: Couldn't acquire prelim lock on descriptor 9 with pid 357
Jan 31 11:47:42 localhost laptop-mode: Now invoking lock_retry with arguments -- auto
Jan 31 11:47:43 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Re
Jan 31 11:47:44 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Re
Jan 31 11:47:45 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Re
Jan 31 11:47:46 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Re
Jan 31 11:47:47 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Re
Jan 31 11:47:48 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Re
Jan 31 11:47:49 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Re
Jan 31 11:47:50 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Re
Jan 31 11:47:51 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Re
Jan 31 11:47:52 localhost laptop-mode: Couldn't acquire lock on descriptor 9 in lock_retry(). Re

Offline

#7 2012-01-31 11:15:55

duquesnc
Member
Registered: 2008-12-10
Posts: 94
Website

Re: laptop-mode-tools loops on lock_retry()

Ok, I think I know what is happening. /etc/acpi/events have two event handlers lm_ac_adapter and lm_battery that both trigger the action '/usr/sbin/laptop_mode auto'.

However if I remove laptop-mode from the daemon array in /etc/rc.conf, that does not solve the problem. Excerpt from /var/log/everything.log:

Jan 31 12:08:38 localhost laptop-mode: Now invoking lmt_main_function with arguments -- auto
Jan 31 12:08:38 localhost laptop-mode: On AC power: Activating, because ENABLE_LAPTOP_MODE_ON_AC is set.
Jan 31 12:08:38 localhost laptop-mode: Laptop mode disabled because /var/run/laptop-mode-tools/enabled is missing.

Offline

#8 2012-02-01 08:32:44

duquesnc
Member
Registered: 2008-12-10
Posts: 94
Website

Re: laptop-mode-tools loops on lock_retry()

I asked the laptop-mode-tools developper directly. It turns out LMT does not works fine with nilfs2, which is the filesystem I use on my /home partition. Turning CONTROL_MOUNT_OPTIONS off fixes the problem.

Offline

Board footer

Powered by FluxBB