tlp-portage
tlp-portage copied to clipboard
TLP is disabled by default
Originally posted by @joakim-tjernlund in https://github.com/dywisor/tlp-portage/issues/26#issuecomment-583282426
Noticed the /etc/tlp.d/01-gentoo.conf: TLP_ENABLE=0
I find it odd that the default is disabled here. One has to do 3 things to get TLP going: emerge tlp, then edit/add a TLP_ENABLE=1 conf snippet, run the service IMHO a user who installs and runs the service find it odd that he in addition has to edit a config file too.
In versions prior to 1.3
, I patched to default configuration to disable TLP by default.
With 1.3
, this has been moved to a separate file.
There's no code interconnecting the TLP_ENABLE=1
state with the service enabled
state, so you'll have to configure both:
echo TLP_ENABLE=1 > /etc/tlp.d/02-enable.conf
rc-update add tlp default # OpenRC
systemctl enable tlp.service # systemd
You could also configure your package manager to skip the 01-gentoo.conf
file when installing TLP if you prefer that route (see INSTALL_MASK
, PKG_INSTALL_MASK
in make.conf(5)
for portage/emerge).
Consider the following variants of how TLP could be installed/configured:
# | TLP_ENABLE=1 ? |
openrc/systemd service enabled? | outcome |
---|---|---|---|
1 | n | n | TLP disabled |
2 | n | y | TLP disabled |
3 | y | n | TLP halfway-enabled, inconsistent - udev rules might trigger TLP, init-only stuff like charge thresholds will not be set |
4 | y | y | TLP enabled, operational |
I highly prefer a defined state that is either enabled or disabled, eliminating variant #3
.
I dare not to mess with your init system in the ebuild, #2
and #4
require to do that.
#1
requires extra configuration work on your behalf, but certainly does no harm.
Choosing between disabled by default and enabled by default is also about philosophy. Gentoo has this disabled by default stance, something I truly value:
- install whatever, it will not be started/run automagically with its default configuration
- configure whatever thoroughly
- start whatever, knowing it will behave exactly how you configured it (minus bugs)
=> WONTFIX for objective and subjective reasons, enabling TLP by default would be a technical burden and also contrary to what I expect from installing a package.
I don't think Gentoo has a disabled config by default in general, at least not in my experience. Take sshd, once installed and you start the service, sshd is operating at some level.
That is exactly the point: unless you start sshd manually, it will remain inactive. I cannot guarantee that for TLP without setting TLP_ENABLE=0
since TLP may otherwise be triggered automatically by udev rules, resulting in a sort of, but not quite enabled state.
OK, now I see. Why is people using udev though ? Do you have any examples I can check out?
- handle power source changes, see
tlp.rules
- implement USB power saving for hot-plugged devices, see
tlp.rules
- with
USE=rdw
, handle dock/undock events, seetlp-rdw.rules
Giving you a detailed code walk-through is out of scope here, please consult the upstream documentation, specifically files and architecture in the dev docs.