Bug 469119 - Status restoration sometimes doesn't work
Summary: Status restoration sometimes doesn't work
Status: RESOLVED FIXED
Alias: None
Product: Bluedevil
Classification: Plasma
Component: daemon (show other bugs)
Version: 6.0.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: David Rosca
URL:
Keywords:
: 470736 479868 482783 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-04-28 21:12 UTC by f.walbaum
Modified: 2024-04-25 17:41 UTC (History)
13 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0.5


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description f.walbaum 2023-04-28 21:12:46 UTC
SUMMARY
***
Bluetooth is not enabled on startup, because my adapter is not powered on, despite turning on  "On Login: Enable Bluetooth" setting in the bluetooth settings.
Setting AutoEnable=true in /etc/bluetooth/main.conf doesn't make a difference.
Installing blueman and enabling autostart works.
Fix I found on reddit: 
~/.config/bluedevilglobalrc contains a line with my adapters MAC with "_powered=false".
Setting powered to true resolved my issues.
***


STEPS TO REPRODUCE
1.  Enable "On Login: Enable Bluetooth"
2. Restart

OBSERVED RESULT
Bluetoothd Service running, tray icon not showing and settings saying "bluetooth is disabled"

EXPECTED RESULT
Bluetooth enabled on startup

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Arch
(available in About System)
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.105.0
Qt Version: 5.15.9

ADDITIONAL INFORMATION
Comment 1 Andres 2023-06-07 00:41:19 UTC
The same issue on my system, however, the fix of setting "~/.config/bluedevilglobalrc contains a line with my adapters MAC with "_powered=" to true keeps getting reverted every time I open the Bluetooth settings in KDE. 

another 'fix' is after setting the powered option to true make the file read-only so that it doesn't get set to false again

Operating System: Garuda Linux 
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.106.0
Qt Version: 5.15.9
Kernel Version: 6.3.6-273-tkg-bmq (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon RX 6700 XT
Comment 2 zylsjsp 2023-06-08 07:08:59 UTC
Same issue with me. I noticed the situation that Andres is also using Wayland, and the configuration file ~/.config/bluedevilglobalrc is synchronized with GUI bluetooth settings on X11 session ( It seems on Wayland the configuration could only be read but not written ) . So I guess maybe they just didn't fit settings application properly to write a configuration file?
Comment 3 Nicolas Fella 2023-06-10 16:58:52 UTC
*** Bug 470736 has been marked as a duplicate of this bug. ***
Comment 4 Nicolas Fella 2023-06-11 12:48:46 UTC
As far as I can tell it's broken both on X11 and Wayland for me when rebooting.

What's interesting is that it seems to work when rebooting via 'reboot', but not when clicking reboot in Kickoff.

It is supposed to save the state when kded5 quits, see https://invent.kde.org/plasma/bluedevil/-/blob/master/src/kded/bluedevildaemon.cpp#L107

When I manually call "kquitapp5 kded5" it indeed writes the config, but not when rebooting, which might suggest that kded5 is terminated ungracefully on reboot
Comment 5 Fabio Coatti 2023-08-02 06:23:25 UTC
Still present in
Operating System: Gentoo Linux 2.14
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.108.0
Qt Version: 5.15.10
Kernel Version: 6.4.7-cova (64-bit)
Graphics Platform: Wayland
Comment 6 qlum 2023-09-21 14:38:53 UTC
Same here on plasma 5.27 on arch
I do notice that toggling enabled on / off under settings > bluetooth > configure does not change anything in this file.
Where I would expect it if anything. 

Changing it to powered=true in bluedevilglobalrc as described in the opening comment does help.
It generally survives reboots / shutdowns but does get reset at times, possibly upon system updates.
Comment 7 Dinko 2024-03-29 07:58:23 UTC
This still occurs on plasma-wayland 6.0.2, kernel 6.8.2. I dont know if this is relevant but I'm getting:
kf.bluezqt: PendingCall Error: "The name is not activatable" in my journal

Manualy editing bluedevilglobalrc still helps it it gets reset.
Comment 8 g311571057 2024-04-11 13:33:23 UTC
In my system, there is "<MAC_ADDRESS>_powered=false" under [Adapter] group and my Bluetooth adapter will not power on after logout and in or reboot. If I delete this line everything will be fine.
My system is KDE 6.0/3 Arch Linux.
Comment 9 jeffpotvin930 2024-04-24 08:10:16 UTC
Same here on KDE 6.0.4 & Arch Linux with 6.8.7 kernel.

This bug happens very randomly, even when no update was excuted. But resetting `~/.config/bluedevilglobalrc` helps.
Comment 10 Nate Graham 2024-04-25 15:46:27 UTC
*** Bug 482783 has been marked as a duplicate of this bug. ***
Comment 11 Nate Graham 2024-04-25 15:47:26 UTC
*** Bug 479868 has been marked as a duplicate of this bug. ***
Comment 12 Nate Graham 2024-04-25 17:33:58 UTC
Git commit d71bfa54089b388a83473599a4dfce6ff06b4be6 by Nate Graham, on behalf of Arctic Lampyrid.
Committed on 25/04/2024 at 17:33.
Pushed by ngraham into branch 'master'.

kded: Fix `launchState` setting not working

Before setting the initial state, we need to wait for the manager to
be operational.

`restoreAdapter()` is scheduled to be called after 1 second when
`adapterAdded` is emitted. Thus after applying `launchState` settings,
`saveState` should be called to avoid restoring to an incorrect state.

Signed-off-by: Arctic Lampyrid <ArcticLampyrid@outlook.com>
FIXED-IN: 6.0.5

M  +24   -0    src/kded/devicemonitor.cpp
M  +4    -0    src/kded/devicemonitor.h

https://invent.kde.org/plasma/bluedevil/-/commit/d71bfa54089b388a83473599a4dfce6ff06b4be6
Comment 13 Nate Graham 2024-04-25 17:41:53 UTC
Git commit 2cc4a2ed3e573df8760b8db6805a5396d89f3920 by Nate Graham, on behalf of Arctic Lampyrid.
Committed on 25/04/2024 at 17:34.
Pushed by ngraham into branch 'Plasma/6.0'.

kded: Fix `launchState` setting not working

Before setting the initial state, we need to wait for the manager to
be operational.

`restoreAdapter()` is scheduled to be called after 1 second when
`adapterAdded` is emitted. Thus after applying `launchState` settings,
`saveState` should be called to avoid restoring to an incorrect state.

Signed-off-by: Arctic Lampyrid <ArcticLampyrid@outlook.com>
FIXED-IN: 6.0.5


(cherry picked from commit d71bfa54089b388a83473599a4dfce6ff06b4be6)

d145259e fix: `launchState` settings never works

M  +24   -0    src/kded/devicemonitor.cpp
M  +4    -0    src/kded/devicemonitor.h

https://invent.kde.org/plasma/bluedevil/-/commit/2cc4a2ed3e573df8760b8db6805a5396d89f3920