>=app-laptop/laptop-mode-tools-1.62-r1 installs the files lm_ac_adapter.sh and lm_battery.sh into /etc/acpi/actions. When these are triggered by the AC adapter being plugged or un-plugged and when ENABLE_BATTERY_LEVEL_POLLING=1 is set in /etc/laptop-mode/conf.d/battery-level-polling.conf then "/usr/sbin/laptop_mode auto" is called. In version 1.60 this would (on going to AC) issue "killall -q lm_polling_daemon" In version 1.62 this has been changed to "killall -g -q lm_polling_daemon". Unfortunately this means that if the polling daemon was started by a previous ACPI event it will be in the same process group as acpid which means that acpid will also be killed.
I checked it everywhere, and I don't see killall being called with the -g switch. I am not sure how that is there in your src. https://github.com/rickysarraf/laptop-mode-tools/blob/lmt-upstream/usr/share/laptop-mode-tools/modules/battery-level-polling
Thank you Ritesh. Murray Campbell: please use the app-laptop/laptop-mode-tools-1.63-r1 version and check it out, it was just released after a while and is synced with upstream repository.
Apologies for the delay. I can confirm that app-laptop/laptop-mode-tools-1.63-r1 has the same problem. I should have been more specific in my report. What happens is this: If the AC cable is plugged in then /etc/acpi/actions/lm_ac_adapter.sh is run by acpid which in turn runs '/usr/sbin/laptop_mode auto'. This will, on line 1133, kill the polling daemon with 'killall -g -q lm-polling-daemon'. If one then removes the AC cable acpid will run /etc/acpi/actions/lm_battery.sh which again runs '/usr/sbin/laptop_mode auto'. This time the script checks to see if the polling daemon is running and, if not, starts it again - now in the process group of acpid. Now if one plugs the AC back in, the killall is executed and acpid is killed.
Thank you for nailing this Murray. I can't recollect why this change was added. For now, I will revert it
Ok, fixed in laptop-mode-tools-1.63-r2. Thanks!