Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLP is disabled by default #27

Open
dywisor opened this issue Feb 8, 2020 · 5 comments
Open

TLP is disabled by default #27

dywisor opened this issue Feb 8, 2020 · 5 comments

Comments

@dywisor
Copy link
Owner

dywisor commented Feb 8, 2020

Originally posted by @joakim-tjernlund in #26 (comment)

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.

@dywisor
Copy link
Owner Author

dywisor commented Feb 8, 2020

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:

  1. install whatever, it will not be started/run automagically with its default configuration
  2. configure whatever thoroughly
  3. 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.

@joakim-tjernlund
Copy link

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.

@dywisor
Copy link
Owner Author

dywisor commented Feb 8, 2020

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.

@joakim-tjernlund
Copy link

OK, now I see. Why is people using udev though ?
Do you have any examples I can check out?

@dywisor
Copy link
Owner Author

dywisor commented Feb 8, 2020

  • 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, see tlp-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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants