Bug 2312159 - unstable inconsistency of power profile shown in the control panel and in the settings [NEEDINFO]
Summary: unstable inconsistency of power profile shown in the control panel and in the...
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: tuned
Version: 41
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Pavol Zacik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-09-13 10:35 UTC by nicodelle04
Modified: 2025-02-02 14:44 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:
pzacik: needinfo? (nicodelle04)


Attachments (Terms of Use)

Description nicodelle04 2024-09-13 10:35:12 UTC
The power profile shown in the settings differs from the one shown in the control panel, if either is changed. This inconsistency only happened right after the first boot in a fedora 41 VM, and disappeared after letting the systemm go idle for a while.
THe command "tuned-adm active" was always compatible with the power profile selected in the settings.

Reproducible: Couldn't Reproduce

Comment 1 Pavol Zacik 2024-09-13 10:55:23 UTC
Can you provide logs from /var/log/tuned/tuned.log and /var/log/tuned/tuned-ppd.log?

Comment 2 Andre Costa 2025-01-15 17:25:25 UTC
Hi,

I also experience some inconsistencies between the profile management handled by tuned, and what is perceived by GNOME. Activating profiles via 'tuned-adm profile XXX' does not update GNOME power settings. For example:

❯ tuned-adm active
Current active profile: balanced
# at this point, GNOME also shows "Balanced"

❯ tuned-adm profile powersave

❯ tuned-adm active
Current active profile: powersave
# GNOME settings still show "Balanced" as the current profile

This does not happen the other way around, though: switching profiles through GNOME settings also switches underlying tuned profiles, as expected.

Not sure if this is a tuned issue, or GNOME's.

I've checked /var/log/tuned/tuned-ppd.log and there is nothing suspicious there. /var/log/tuned/tuned.log shows a couple of errors when switching to "balanced" profile, but I can't say if this is related:

2025-01-15 12:43:40,886 ERROR    tuned.utils.commands: Executing 'modprobe -r cpufreq_conservative' error: modprobe: FATAL: Module cpufreq_conservative is builtin.

Let me know if you need any additional info.

Comment 3 Pavol Zacik 2025-01-16 08:01:18 UTC
Thank you Andre. This is a known issue of the current stable build. It should be resolved in https://bodhi.fedoraproject.org/updates/FEDORA-2025-97c3eb9857, which is currently in updates-testing.

More info: https://github.com/redhat-performance/tuned/issues/689

Comment 4 Andre Costa 2025-01-16 20:01:14 UTC
Thanks Pavol. I decided to give it a try, but apparently I would need to upgrade something on GNOME's end as well, since any reference to Power Profiles on GNOME simply vanished after upgrading tuned and tuned-ppd to 2.24.1-3. Had to revert it back to 2.24.1-1.

Not related, but is "auto" profile selection mode actually used on Fedora? It seems GNOME (or something else) overrides this and forces it to "manual", but profiles are still properly changed when AC is (un)plugged.

Comment 5 Pavol Zacik 2025-01-17 07:07:31 UTC
Andre, the update is now in stable, can you please try again? If tuned/tuned-ppd are running before the upgrade, they should automatically start after the upgrade and Gnome should register them (without any upgrade on its end). In case it doesn't, please try restarting them with `systemctl restart tuned tuned-ppd` (and report here, it should not happen).

With regards to the auto profile functionality of tuned - we'll have to update the manpages/docs to clarify that this is incompatible with tuned-ppd, i.e., it doesn't make sense to use it when tuned-ppd is running. Thanks for mentioning it.

Comment 6 Andre Costa 2025-01-17 17:47:42 UTC
Hi Pavol, I upgraded today to 2.24.1-3 from stable, and the behavior I experienced yesterday manifested again: the power profiles settings disappear completely from GNOME's control panel. Investigating a little further, I found out what was happening: I had changed the entry

balanced=balanced-battery

to 

balanced=powersave

on the [battery] section of ppd.conf file, and this was causing an exception during tuned-ppd service startup:

jan 17 14:16:30 fedoracosta systemd[1]: Starting tuned-ppd.service - PPD-to-TuneD API Translation Daemon...
jan 17 14:16:31 fedoracosta python3[25993]: detected unhandled Python exception in '/usr/sbin/tuned-ppd'
jan 17 14:16:31 fedoracosta tuned-ppd[25993]: Traceback (most recent call last):
jan 17 14:16:31 fedoracosta tuned-ppd[25993]:   File "/usr/sbin/tuned-ppd", line 53, in <module>
jan 17 14:16:31 fedoracosta tuned-ppd[25993]:     controller = controller.Controller(bus, tuned_iface)
jan 17 14:16:31 fedoracosta tuned-ppd[25993]:   File "/usr/lib/python3.13/site-packages/tuned/ppd/controller.py", line 236, in __init__
jan 17 14:16:31 fedoracosta tuned-ppd[25993]:     self.initialize()
jan 17 14:16:31 fedoracosta tuned-ppd[25993]:     ~~~~~~~~~~~~~~~^^
jan 17 14:16:31 fedoracosta tuned-ppd[25993]:   File "/usr/lib/python3.13/site-packages/tuned/ppd/controller.py", line 367, in initialize
jan 17 14:16:31 fedoracosta tuned-ppd[25993]:     self._config = PPDConfig(PPD_CONFIG_FILE, self._tuned_interface)
jan 17 14:16:31 fedoracosta tuned-ppd[25993]:                    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
jan 17 14:16:31 fedoracosta tuned-ppd[25993]:   File "/usr/lib/python3.13/site-packages/tuned/ppd/config.py", line 47, in __init__
jan 17 14:16:31 fedoracosta tuned-ppd[25993]:     self.load_from_file(config_file)
jan 17 14:16:31 fedoracosta tuned-ppd[25993]:     ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
jan 17 14:16:31 fedoracosta tuned-ppd[25993]:   File "/usr/lib/python3.13/site-packages/tuned/ppd/config.py", line 139, in load_from_file
jan 17 14:16:31 fedoracosta tuned-ppd[25993]:     raise TunedException("Duplicate profile mapping in the configuration file '%s'" % config_file)
jan 17 14:16:31 fedoracosta tuned-ppd[25993]: tuned.exceptions.TunedException: Duplicate profile mapping in the configuration file '/etc/tuned/ppd.conf'
jan 17 14:16:31 fedoracosta systemd[1]: tuned-ppd.service: Main process exited, code=exited, status=1/FAILURE
jan 17 14:16:31 fedoracosta systemd[1]: tuned-ppd.service: Failed with result 'exit-code'.
jan 17 14:16:31 fedoracosta systemd[1]: Failed to start tuned-ppd.service - PPD-to-TuneD API Translation Daemon.

Reverting back the entry to "balanced-battery" allowed tuned-ppd to start, and GNOME configuration resumed showing the power profiles configuration.

And, last but not least, changes made through tuned-adm are now correctly reflected on GNOME settings! \o/

BTW thanks for the clarification on the "auto" profile switching mode. If you could also provide some info about ppd.conf file, that might be useful (eg. IMHO it's not intuitive why the [battery] section has a "balanced" property, and why it points to a tuned profile "balanced-battery")

As far as I am concerned, this issue is resolved.

Comment 7 Pavol Zacik 2025-01-18 18:13:18 UTC
Hello Andre, thank you very much for your investigation.

Regarding the ppd.conf file: it essentially contains mappings from the original power-profiles-daemon profiles (power-saver, balanced, performance - only these are recognized by Gnome) to existing TuneD profiles. There are two mappings, one is used on DC power (e.g., when charging a laptop), the other on AC power (on battery). The balanced=balanced-battery row in the [battery] section thus means that the balanced Gnome profile is mapped to the balanced-battery TuneD profile.

Each of the two mappings must be bijective so the Gnome profiles can be switched when the underlying TuneD profile is switched. If you'd still like to use non-injective mapping, you can create a new TuneD profile identical with the powersave profile (only with a different name) and change the corresponding row in the configuration file.

Comment 8 Andre Costa 2025-01-18 23:15:50 UTC
Thanks for the explanation, Pavol, much appreciated. IMHO [profiles] could be renamed to something else, since [battery] also holds profile mappings. Perhaps [charging] or something similar? Just my $0.02 ;-)

Comment 9 Andre Costa 2025-02-02 14:44:40 UTC
Pavol, just to let you know, with tuned-2.25.0-1 GNOME stopped reflecting power profiles changes once again. If I manually run tuned-adm profile balanced-battery , for example, this appears on the system log:

fev 02 11:37:46 fedoracosta gnome-control-c[4944]: Unknown power profile: unknown
fev 02 11:37:46 fedoracosta gnome-shell[2355]: JS ERROR: TypeError: PROFILE_PARAMS[activeProfile] is undefined
                                               _sync@resource:///org/gnome/shell/ui/status/powerProfiles.js:113:44
                                               _init/this._proxy</<@resource:///org/gnome/shell/ui/status/powerProfiles.js:58:30
                                               @resource:///org/gnome/shell/ui/init.js:21:20

and this appears on /var/log/tuned/tuned.log

2025-02-02 11:39:40,749 ERROR    tuned.units.manager: BUG: Unhandled exception in start_tuning: VideoPlugin._get_panel_power_savings() missing 1 required positional argument: 'instance'
2025-02-02 11:39:40,749 ERROR    tuned.units.manager: Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/tuned/units/manager.py", line 121, in _try_call
    return f(*args, **kwargs)
  File "/usr/lib/python3.13/site-packages/tuned/plugins/instance/instance.py", line 85, in apply_tuning
    self._plugin.instance_apply_tuning(self)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/usr/lib/python3.13/site-packages/tuned/plugins/base.py", line 274, in instance_apply_tuning
    self._instance_apply_static(instance)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/tuned/plugins/base.py", line 335, in _instance_apply_static
    self._execute_all_device_commands(instance, instance.assigned_devices)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/tuned/plugins/base.py", line 461, in _execute_all_device_commands
    self._execute_device_command(instance, command, device, new_value)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/tuned/plugins/base.py", line 526, in _execute_device_command
    command["set"](new_value, device, instance, sim = False, remove = False)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/tuned/plugins/plugin_video.py", line 170, in _set_panel_power_savings
    return self.apply_panel_power_saving_target(device, value, sim)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/tuned/plugins/plugin_video.py", line 96, in apply_panel_power_saving_target
    current = int(self._get_panel_power_savings(device))
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
TypeError: VideoPlugin._get_panel_power_savings() missing 1 required positional argument: 'instance'


Note You need to log in before you can comment on or make changes to this bug.