-
Notifications
You must be signed in to change notification settings - Fork 2
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
powerplan -s shows a different battery policy than what's set in powerplan.conf #6
Comments
Where you running it as a daemon? If so, can you please share your output of powerplan --log? If you can reproduce the problem, you can try running it like this:
This will give you essentially the live output of what would be saved as a log if run as a daemon.
Did this only happen when using --persistent?
This is bit puzzling, powerplan doesn't do any permanent modification whatsoever, and everything should be reset after a reboot (until it runs again). I'm thinking perhaps this could be another application changing the policy, unless this behaviour is reliable triggered with the --persistent argument. I'll keep thinking about it... |
balance_power is the default policy in tlp. Maybe it changes the policy. |
I have removed TLP via |
Yes, always as a daemon This is
Just reproduced it and this is the output of
|
Only one instance of powerplan can be actively changing one system's configuration. Since the daemon is running you can't run powerplan in "active mode". The way to run it with the persistent argument is without any other instance running before it, or adding it to the .service file invocation for the daemon. Perhaps this should be a configuration option (instead of a cli argument), what do you think about this?
This shows that profile application was indeed successful. Can you tell me the steps to reproduce this behaviour? |
I don't understand much of this. Do you mean that since I already ran
Which behavior, when |
Yes, that one. About the running modes, there's two mayor modes powerplan can run in:
If you run powerplan only once it will run in active mode. If you run powerplan two times at the same time the second of Given all this, running powerplan with the --persistent argument (which enforces the changes periodically) only makes sense when running on active mode. Running it as a daemon is the same as running it manually (with --verbose, which logs some info), it will run in active mode at boot, and if for some reason there's ever another instance running at the time you start/restart the daemon it will just fail. I'm trying my best to explain this, but don't hesitate to ask if it still is unclear. English isn't my first language and my use of it is mostly academic, please feel free to suggest changes in the project's readme if you think something is unclear 😅 |
How do I run either of these two modes? With what commands? I thought running
Again, how do I run that?
How do I run it a second time? After I ran |
Yes, that is correct:+1: Running:
No, by second time I mean a second simultaneous process. So for example, if I already installed powerplan as a daemon, executing The idea behind the distinction between active and monitor mode is that only one instance (ie. one running process) of powerplan is applying changes, and any additional simultaneous processes of powerplan won't be allowed to make changes.
Oh I get you, I might be on the same boat :P But still, I think I might be making things sound more convoluted than they really are.
That's reassuring haha ❤️ |
If you want my honest opinion, this is kind of overly complicated. I think that it should be simplified a bit.
|
Hmm, do you think so? The best I can summarize it is like this: So if an instance runs in monitor mode it means another one must be already running in active mode.
|
I think that it should be installed with the |
You can control start/stop/enable/disable with systemd already. I'd also like to support systems without systemd in the future and implementing these additional functions also mean powerplan would take additional responsibilities, which are already redundant.
While using similar tools it seemed to me that persistent always meant persistent changes Vs embedded controllers or other software. I think that --daemon is already explicit (maybe I could change it to install as service or something), but I agree that --persistent can be confusing. Maybe changing the help messages, or making persistency (protection against override) a config entry could help. I'm open to opinions, but it isn't obvious to me what's the best way to go about it, honestly.
This sounds very reasonable. @monarc99 Can I bother you with an opinion on these things? 🙏 |
I would remove --daemon, --start --stop. Normally a daemon is packaged by a linux distribution. And the packager decide, how a daemon is started on the system. (systemd, openrc, ...) I would provide a powerplan.service file for systemd and your install scripts - for easy testing on github - until powerplan can be installed from AUR. --persistent or permanent (?) |
All this confusion would be solved with a simple GUI app that has a couple of switches, "activate/dactivate powerplan", "start at boot", "prevent overrides"... etc. A couple of switches/check boxes would make it very simple. The user would just worry about those checkboxes/switches, and you (and hopefully future contributors) worry about the backend. I wish I knew how to or had the time to learn how. :/ |
Anyway i can reproduce the problem. If i edit the powerplan.conf file and don't restart both - daemon and monitor, something is wrong.
sudo systemctl restart powerplan
sudo powerplan --status it seems to work. |
Oh, in the middle of everything I missed the fact that he was running it as a daemon. A service restart is needed after config edits, just like with any other service. |
I think I may need to re-read the |
It's always been like that. I don't think it is mentioned in the readme as of now, I guess mentioning it is a good idea. |
Do I need to run powerplan as a daemon before I can restart it with
|
Yes, running |
I'm so confused. So running |
Ok, help me get some things clear.
What do you mean it's not stopping? Can you see it running on a process monitor?
With active window do you mean the active mode indication? Since no other instance of powerplan is running, the instance of it when you run powerplan -s in the terminal will be allowed to make system changes.
That's to be expected. Since the daemon is already running, if you run powerplan in a terminal window this new instance won't be allowed to make changes to your system (hence the monitor mode). What I am getting is that somehow the changes are persisting across reboots without the daemon. Is this correct? If this is somehow the case, without an active powerplan process your power profiles won't get automatically switched (with ac power changes or profile-triggering apps running). The main difference between running powerplan manually (with or without the --status argument) and installing it as a daemon is that as a daemon it will run automatically at boot. |
I think I see the misunderstanding now. Using the --status argument means that in addition to doing it's thing, powerplan will also output some status data. If there's already a process or powerplan running at the time of running powerplan -s in a terminal, then the powerplan process you created in the terminal won't do any system changes, it will just show the status data (and it will therefore show monitor mode at the top). "active/monitor mode" indicates if the current process being run is allowed to do system changes.
The behaviour you describe is exactly as expected, but that doesn't mean the process maintains it's presence across boots. This happens in the following way:
So powerplan never runs at boot time automatically in this scenario, but whenever you run it it runs on active mode. |
Ok, so I'd like some feedback on this. I was thinking on introducing a pair of global config variables (persistent and notifications, both off by default). But I worry it'd be a bit confusing if I include all that in the current profile config file (/etc/powerplan.conf). The idea is to change that to: The current /etc/powerplan.conf would just get moved to /etc/powerplan/profiles.conf and new global variables can go in the other file. Does this sound reasonable? |
It sounds good. Global config in /etc/powerplan/powerplan.conf Profiles: /etc/powerplan/profiles.conf or /etc/powerplan/profiles.d/default.conf like the ananicy rules. |
Description
A clear and concise description of what the bug is.
In the output of
sudo powerplan -s
, it was showing the policy as balance_power no matter what I did in thepowerplan.conf
file.I think it started happening after I ran
powerplan --persistent
, then it corrected itself after a couple of reboots. Now it is showing the correct thing. I still want to know why it did that at first.Additional info:
Please include the output of "powerplan --system" and your powerplan.conf file (if relevant to issue)
powerplan.conf
:.
The text was updated successfully, but these errors were encountered: