FS#45587 - [tlp] does not adjust settings when power connected/disconnected

Attached to Project: Community Packages
Opened by A Web (aweb) - Wednesday, 08 July 2015, 09:29 GMT
Last edited by Maxime Gauduin (Alucryd) - Tuesday, 14 July 2015, 11:44 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Maxime Gauduin (Alucryd)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:

tlp is supposed to adjust a bunch of settings whenever the power is connected or disconnected. The mechanism for doing this is the following rule in /usr/lib/udev/rules.d/85-tlp.rules:

ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Mains", RUN+="/usr/bin/tlp auto"

Unfortunately, "tlp auto" exits immediately and attempts to do a bunch of changes in the background. However, systemd-udevd will not allow this. It uses cgroups (or some linux mechanism) to kill off all processes that have been spawned by a udev rule as soon as the main process exits. Even daemon processes that have been reparented to systemd get killed. The result is that none of the tlp rule changes go through.

There are two workarounds possible. One is to patch the tlp script not to run auto in the background. That's a simple as commenting out an '&' on line 149. The other workaround is to change the udev rule to run "tlp start" rather than "tlp auto." That also works because "tlp start" does not put anything in the background.

Additional info:
* package version(s)

tlp 0.7-2

* config and/or log files etc.


Steps to reproduce:

To reproduce this, you can run powertop and look at the tunables. If you run "tlp auto" from the command line, they all go "good" on battery and "bad" on AC power, as expected. However, if you don't run tlp from the command line and just expect udev to take care of it, the log shows that udev is running "tlp auto", but none of the tunables actually change.
This task depends upon

Closed by  Maxime Gauduin (Alucryd)
Tuesday, 14 July 2015, 11:44 GMT
Reason for closing:  Fixed
Additional comments about closing:  0.7-3

Loading...