Bug 1222179

Summary: openSUSE Tumbleweed 20240328 breaks power-profiles-daemon
Product: [openSUSE] openSUSE Tumbleweed Reporter: Vichar B <eazyvg>
Component: OtherAssignee: Atri Bhattacharya <badshah400>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Major    
Priority: P5 - None CC: dominik, emiliano.langella, ghax.z.yt, leodream2008, leohearts, mrintala43, packaging, rs.opensuse, yuvalery
Version: Current   
Target Milestone: ---   
Hardware: x86-64   
OS: openSUSE Tumbleweed   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Vichar B 2024-03-30 05:11:30 UTC
Since the update the Power Profile stopped working, it is not being loaded during the boot up. Previously it was working fine on KDE.

[code]
vg@VG-835G10Nix:~> sudo systemctl status power-profiles-daemon.service 
[sudo] password for root: 
× power-profiles-daemon.service - Power Profiles daemon
     Loaded: loaded (/usr/lib/systemd/system/power-profiles-daemon.service; enabled; preset: disabled)
     Active: failed (Result: exit-code) since Sat 2024-03-30 07:54:35 MSK; 15min ago
   Duration: 264us
    Process: 1633 ExecStart=/usr/libexec/power-profiles-daemon (code=exited, status=1/FAILURE)
   Main PID: 1633 (code=exited, status=1/FAILURE)
        CPU: 16ms

Mar 30 07:54:35 VG-835G10Nix systemd[1]: power-profiles-daemon.service: Scheduled restart job, restart counter is at 5.
Mar 30 07:54:35 VG-835G10Nix systemd[1]: power-profiles-daemon.service: Start request repeated too quickly.
Mar 30 07:54:35 VG-835G10Nix systemd[1]: power-profiles-daemon.service: Failed with result 'exit-code'.
Mar 30 07:54:35 VG-835G10Nix systemd[1]: Failed to start Power Profiles daemon.
[/code]
Comment 1 Taroe Leohearts 2024-03-30 17:18:36 UTC
+1 dbus name acquire failed.

workaround:
cd /usr/share/dbus-1/system.d/
sudo cp org.freedesktop.UPower.PowerProfiles.conf net.hadess.PowerProfiles.conf
replace org.freedesktop.UPower.PowerProfiles with net.hadess.PowerProfiles in net.hadess.PowerProfiles.conf
reboot

now kde plasma still says powerprofile not available, but powerprofilesctl works.
Comment 2 Florian 2024-03-30 17:50:07 UTC
(In reply to Taroe Leohearts from comment #1)
> +1 dbus name acquire failed.
> 
> workaround:
> cd /usr/share/dbus-1/system.d/
> sudo cp org.freedesktop.UPower.PowerProfiles.conf
> net.hadess.PowerProfiles.conf
> replace org.freedesktop.UPower.PowerProfiles with net.hadess.PowerProfiles
> in net.hadess.PowerProfiles.conf
> reboot
> 
> now kde plasma still says powerprofile not available, but powerprofilesctl
> works.

Alternative workaround is to simply downgrade power-profiles-daemon back to 0.13:
    sudo zypper in -f "https://download.opensuse.org/history/20240327/tumbleweed/repo/oss/x86_64/power-profiles-daemon-0.13-1.5.x86_64.rpm"
and either lock it or simply not upgrade.

At least on GNOME it works exactly as it used to.
Comment 3 Vichar B 2024-03-30 18:35:33 UTC
Yes, downgrading did initiate the power-profile-daemon as it should and thus is working. The question is could it be the issue as Power-Profiles-Daemon 0.20 is now living under the UPower umbrella ... switch project to the freedesktop ‘Upower’ group? Hope soon a fix will be released/updated in the tumbleweed repo. Thanks.
Comment 4 Florian 2024-03-30 20:19:41 UTC
Xiang Fan <sfanxiang@gmail.com> already found the cause of the issue over at boo#1219956:

> Hi all, this service currently fails to start with the following error message:
> 
> $ sudo bash -c 'STATE_DIRECTORY=/var/lib/power-profiles-daemon G_MESSAGES_DEBUG=all /usr/libexec/power-profiles-daemon'
> power-profiles-daemon is already running, or it cannot own its D-Bus name. Verify installation.
> 
> This is because power-profiles-daemon tries to acquire both the legacy dbus name "net.hadess.PowerProfiles" and the new name "org.freedesktop.UPower.PowerProfiles" on startup:
> 
> https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/blob/0.20/src/power-profiles-daemon.c#L988
> 
> Note that L988 installs the `name_lost_handler`. When the legacy name fails, the entire service exits with error:
> 
> https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/blob/0.20/src/power-profiles-daemon.c#L954
> 
> I'd expect that carefully removing all references to POWER_PROFILES_LEGACY_* in power-profiles-daemon.c would fix this. I haven't tested this solution though.

I've submitted https://build.opensuse.org/request/show/1163727 which just re-adds the missing "net.hadess.PowerProfiles" dbus service. Simply doing what upstream does seems more reasonable than "heavy" patching.

The package might need an additional security review according to rpmlint, but it should work (well, at least seems to on my machine), altho I haven't  tested it thoroughly.
Comment 5 Vichar B 2024-03-31 04:15:10 UTC
(In reply to Florian from comment #4)
> Xiang Fan <sfanxiang@gmail.com> already found the cause of the issue over at
> boo#1219956:
> 
> > Hi all, this service currently fails to start with the following error message:
> > 
> > $ sudo bash -c 'STATE_DIRECTORY=/var/lib/power-profiles-daemon G_MESSAGES_DEBUG=all /usr/libexec/power-profiles-daemon'
> > power-profiles-daemon is already running, or it cannot own its D-Bus name. Verify installation.
> > 
> > This is because power-profiles-daemon tries to acquire both the legacy dbus name "net.hadess.PowerProfiles" and the new name "org.freedesktop.UPower.PowerProfiles" on startup:
> > 
> > https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/blob/0.20/src/power-profiles-daemon.c#L988
> > 
> > Note that L988 installs the `name_lost_handler`. When the legacy name fails, the entire service exits with error:
> > 
> > https://gitlab.freedesktop.org/upower/power-profiles-daemon/-/blob/0.20/src/power-profiles-daemon.c#L954
> > 
> > I'd expect that carefully removing all references to POWER_PROFILES_LEGACY_* in power-profiles-daemon.c would fix this. I haven't tested this solution though.
> 
> I've submitted https://build.opensuse.org/request/show/1163727 which just
> re-adds the missing "net.hadess.PowerProfiles" dbus service. Simply doing
> what upstream does seems more reasonable than "heavy" patching.
> 
> The package might need an additional security review according to rpmlint,
> but it should work (well, at least seems to on my machine), altho I haven't 
> tested it thoroughly.

Thanks for creating the request!
Comment 6 Florian 2024-04-04 13:06:54 UTC
Btw, if anyone is also running power-profiles-deamon 0.20, have you noticed that its seemingly unable to store/reload it's previous state and always falls back to "Balanced" on reboot, or is that an issue on my side?
Comment 7 Taroe Leohearts 2024-04-04 13:14:38 UTC
(In reply to Florian from comment #6)
> Btw, if anyone is also running power-profiles-deamon 0.20, have you noticed
> that its seemingly unable to store/reload it's previous state and always
> falls back to "Balanced" on reboot, or is that an issue on my side?

When I was running 0.20, this didn't happen on my machine.
Comment 8 H 2024-04-04 13:36:40 UTC
(In reply to Florian from comment #6)
> Btw, if anyone is also running power-profiles-deamon 0.20, have you noticed
> that its seemingly unable to store/reload it's previous state and always
> falls back to "Balanced" on reboot, or is that an issue on my side?

Same behavior and I had to manually switch to "performance" mode after every reboot. Thinkpad x1 carbon gen9.
Comment 9 OBSbugzilla Bot 2024-04-09 15:45:02 UTC
This is an autogenerated message for OBS integration:
This bug (1222179) was mentioned in
https://build.opensuse.org/request/show/1166474 Factory / power-profiles-daemon
Comment 10 Florian 2024-04-15 09:38:23 UTC
I'm closing this, given that the fixed package reached TW.

If someone is still affected with the inability of ppd to restore the previously selected profile (it seemingly works for me now, no idea why), create a new issue.