linuxmint / blueberry

A Bluetooth configuration tool
GNU General Public License v3.0
171 stars 51 forks source link

Blueberry-tray icon missing on resuming after hibernate #110

Open wurst-hans opened 3 years ago

wurst-hans commented 3 years ago

Using

System:    Host: kruemel Kernel: 5.4.0-42-generic x86_64 bits: 64 Desktop: Cinnamon 4.6.7 Distro: Linux Mint 20 Ulyana 
Machine:   Type: Laptop System: Dell product: XPS 15 9500 v: N/A serial: <superuser/root required> 
           Mobo: Dell model: 05XYW7 v: A00 serial: <superuser/root required> UEFI: Dell v: 1.2.1 date: 06/01/2020 

it seems to happen everytime, that the blueberry-tray icon disappears from task bar when resuming from hibernate. Bluetooth itself is working nevertheless, i.e. headset device can connect. When launching bluetooth app from menu the icon is restored again.

LorenAmelang commented 3 years ago

Similar problem, except my headset amp (QCY QY3) will NOT connect when the tray icon is missing. Icon worked maybe a year ago, became intermittent months ago, now always fails on wake.

Run this from a local terminal:

[loren@Gazp9 ~]$ cd /usr/lib/blueberry/
[loren@Gazp9 blueberry]$ python blueberry.py

Or just select the Blueberry icon in the menu after each wake and it works again - for one session. Restarting the Bluetooth service does not work.

Is there some quick workaround?

BTW, finding this would have been much easier if the Blueberry interface said "Blueberry" somewhere, like in an About option...

System76 Gazelle Professional gazp9 5.7.9-arch1-1 Cinnamon 4.6.6

-rwxr-xr-x 1 root root 27754 Jul 10 13:28 blueberry-obex-agent.py -rwxr-xr-x 1 root root 14415 Jul 10 13:28 blueberry.py -rw-r--r-- 1 root root 3471 Jul 10 13:28 BlueberrySettingsWidgets.py -rwxr-xr-x 1 root root 7616 Jul 10 13:28 blueberry-tray.py -rw-r--r-- 1 root root 6686 Jul 10 13:28 blueberry.ui -rw-r--r-- 1 root root 4720 Jul 10 13:28 rfkillMagic.py -rwxr-xr-x 1 root root 903 Jul 10 13:28 safechild

LorenAmelang commented 3 years ago

After way too much time wasted trying to add a script to /usr/lib/systemd/system-sleep/, I've found a simple workaround that has launched Blueberry on every wake so far...

I added "Bluetooth" to "Start -> Preferences -> Startup Applications" - maybe it was supposed to be there all along?

gadicc commented 3 years ago

@LorenAmelang, did this stay working for you?

I wasn't aware "Startup Applications" had anything to do with resume (vs when the user first logs into the desktop), but it did seem to work initially. It seemed to be just chance though, and I'm back in the same place. Guess I need to really pay attention on resume to figure out exactly when it's happening and look for relevant log entries.

LorenAmelang commented 3 years ago

@gadicc Yes, mine has gone back to "random" after seeming to work every time for a few days. An improvement on "never", I guess, but actually now I end up starting my headset when Blueberry has failed, and having to power cycle it because Blueberry only sees it when the headset powers on. Why can't Blueberry notice there are already Bt sinks available when it starts up?

hxss commented 2 years ago

same issue on arch linux & xfce. All bluetooth function including autoconnect to headset works fine except missing icon in tray. This happens only on resuming from hibernate. When system resumes from suspend, the icon on its place.

hxss commented 2 years ago

temporary workaround:

  1. disable default tray icon in your DE startup settings
  2. create and enable $XDG_CONFIG_HOME/systemd/user/blueberry-tray.service:
    
    [Unit]
    Description=Blueberry tray icon
    After=graphical-session.target
    After=bluetooth.target

[Service] Type=forking ExecStart=blueberry-tray

[Install] WantedBy=graphical-session.target WantedBy=bluetooth.target


3. reboot

Now `blueberry-tray` will start on resume with bluetooth.target.
LorenAmelang commented 2 years ago

@hxss Pardon my probably ignorant questions, but I can't get your workaround to work.

I did remove the various hacks I'd tried before...

disable default tray icon in your DE startup settings

I'm guessing that means the Bluetooth control panel I have to use on every resume to get the Bluetooth working again? And up in its top right corner, the "burger" menu, and turn off the "Show an icon" switch?

If I do that I never get an icon, and Bt never works, even before hibernation. I turned the icon back on...

create and enable $XDG_CONFIG_HOME/systemd/user/blueberry-tray.service

That points to my Home folder, so I made:

[loren@Gazp9 ~]$ ls -alR systemd
systemd:
total 20
drwxr-xr-x  3 loren loren  4096 Jan 17 18:36 .
drwx------ 36 loren users 12288 Jan 17 19:01 ..
drwxr-xr-x  2 loren loren  4096 Jan 17 18:38 user

systemd/user:
total 12
drwxr-xr-x 2 loren loren 4096 Jan 17 18:38 .
drwxr-xr-x 3 loren loren 4096 Jan 17 18:36 ..
-rw-r--r-- 1 root  root   214 Jan 17 18:38 blueberry-tray.service
[loren@Gazp9 ~]$

Nothing new happened on reboot and hib cycle. Tried it without sudo, owned by loren loren, still nothing.

But I just noticed "and enable" - not sure what that means... Maybe that's my problem?

Also, I had 1.3.9-1. Tried the newest Arch Community 1.4.4-1 - still nothing. Github has a newer version - might that matter?

Here are lots of messages from the latest restart (not wake):

[loren@Gazp9 ~]$ journalctl -b -rx | grep 'blue'
Jan 17 19:39:55 Gazp9 bluetoothd[400]: Endpoint registered: sender=:1.32 path=/MediaEndpoint/A2DPSource/sbc
Jan 17 19:39:55 Gazp9 bluetoothd[400]: Endpoint registered: sender=:1.32 path=/MediaEndpoint/A2DPSink/sbc
░░ Subject: A start job for unit bluetooth.target has finished successfully
░░ A start job for unit bluetooth.target has finished successfully.
░░ Subject: A stop job for unit bluetooth.target has finished
░░ A stop job for unit bluetooth.target has finished.
Jan 17 19:39:54 Gazp9 bluetoothd[400]: Endpoint unregistered: sender=:1.32 path=/MediaEndpoint/A2DPSource/sbc
Jan 17 19:39:54 Gazp9 bluetoothd[400]: Endpoint unregistered: sender=:1.32 path=/MediaEndpoint/A2DPSink/sbc
Jan 17 19:37:59 Gazp9 bluetoothd[400]: Endpoint registered: sender=:1.32 path=/MediaEndpoint/A2DPSource/sbc
Jan 17 19:37:59 Gazp9 bluetoothd[400]: Endpoint registered: sender=:1.32 path=/MediaEndpoint/A2DPSink/sbc
░░ Subject: A start job for unit bluetooth.target has finished successfully
░░ A start job for unit bluetooth.target has finished successfully.
░░ Subject: A stop job for unit bluetooth.target has finished
░░ A stop job for unit bluetooth.target has finished.
Jan 17 19:37:58 Gazp9 bluetoothd[400]: Endpoint unregistered: sender=:1.32 path=/MediaEndpoint/A2DPSource/sbc
Jan 17 19:37:58 Gazp9 bluetoothd[400]: Endpoint unregistered: sender=:1.32 path=/MediaEndpoint/A2DPSink/sbc
Jan 17 19:37:13 Gazp9 dbus-daemon[391]: [system] Rejected send message, 0 matched rules; type="method_return", sender=":1.32" (uid=1000 pid=577 comm="/usr/bin/pulseaudio --daemonize=no --log-target=jo") interface="(unset)" member="(unset)" error name="(unset)" requested_reply="0" destination=":1.4" (uid=0 pid=400 comm="/usr/lib/bluetooth/bluetoothd ")
Jan 17 19:37:13 Gazp9 bluetoothd[400]: src/profile.c:ext_io_disconnected() Unable to get io data for Headset Voice gateway: getpeername: Transport endpoint is not connected (107)
Jan 17 19:37:06 Gazp9 bluetoothd[400]: /org/bluez/hci0/dev_1C_52_16_46_69_27/sep1/fd0: fd(46) ready
Jan 17 19:36:31 Gazp9 dbus-daemon[517]: [session uid=1000 pid=517] Successfully activated service 'org.bluez.obex'
Jan 17 19:36:31 Gazp9 dbus-daemon[517]: [session uid=1000 pid=517] Activating via systemd: service name='org.bluez.obex' unit='dbus-org.bluez.obex.service' requested by ':1.50' (uid=1000 pid=809 comm="blueberry-obex-agent                              ")
Jan 17 19:36:28 Gazp9 bluetoothd[400]: Endpoint registered: sender=:1.32 path=/MediaEndpoint/A2DPSource/sbc
Jan 17 19:36:28 Gazp9 bluetoothd[400]: Endpoint registered: sender=:1.32 path=/MediaEndpoint/A2DPSink/sbc
Jan 17 19:36:26 Gazp9 NetworkManager[392]: <info>  [1642476986.2307] Loaded device plugin: NMBluezManager (/usr/lib/NetworkManager/1.30.0-1/libnm-device-plugin-bluetooth.so)
Jan 17 19:36:25 Gazp9 dbus-daemon[391]: [system] Activating via systemd: service name='org.freedesktop.hostname1' unit='dbus-org.freedesktop.hostname1.service' requested by ':1.4' (uid=0 pid=400 comm="/usr/lib/bluetooth/bluetoothd ")
Jan 17 19:36:25 Gazp9 bluetoothd[400]: Bluetooth management interface 1.18 initialized
Jan 17 19:36:25 Gazp9 bluetoothd[400]: Starting SDP server
░░ Subject: A start job for unit bluetooth.target has finished successfully
░░ A start job for unit bluetooth.target has finished successfully.
Jan 17 19:36:25 Gazp9 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=bluetooth comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
░░ Subject: A start job for unit bluetooth.service has finished successfully
░░ A start job for unit bluetooth.service has finished successfully.
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEAutoconnecttimeout” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEConnectionSupervisionTimeout” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEConnectionLatency” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEMaxConnectionInterval” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEMinConnectionInterval” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEScanWindowConnect” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEScanIntervalConnect” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEScanWindowAdvMonitor” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEScanIntervalAdvMonitor” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEScanWindowDiscovery” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEScanIntervalDiscovery” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEScanWindowSuspend” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEScanIntervalSuspend” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEScanWindowAutoConnect” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEScanIntervalAutoConnect” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEMultiAdvertisementRotationInterval” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEMaxAdvertisementInterval” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “LEMinAdvertisementInterval” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “BRMaxSniffInterval” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “BRMinSniffInterval” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “BRPageTimeout” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “BRLinkSupervisionTimeout” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “BRInquiryScanWindow” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “BRInquiryScanInterval” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “BRInquiryScanType” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “BRPageScanWindow” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “BRPageScanInterval” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: src/main.c:parse_controller_config() Key file does not have key “BRPageScanType” in group “Controller”
Jan 17 19:36:25 Gazp9 bluetoothd[400]: Bluetooth daemon 5.55
░░ Subject: A start job for unit bluetooth.service has begun execution
░░ A start job for unit bluetooth.service has begun execution.
[loren@Gazp9 ~]$

Kind of amazing it works at all, but if I manually open the control panel after a wake, it totally works!

And some systemctl status:

● Gazp9
    State: running
     Jobs: 0 queued
   Failed: 0 units
    Since: Mon 2022-01-17 19:36:22 PST; 17min ago
   CGroup: /
           ├─user.slice 
           │ └─user-1000.slice 
           │   ├─user@1000.service …
           │   │ ├─app.slice 
           │   │ │ ├─gvfs-goa-volume-monitor.service 
           │   │ │ │ └─730 /usr/lib/gvfs-goa-volume-monitor
           │   │ │ ├─pulseaudio.service 
           │   │ │ │ ├─577 /usr/bin/pulseaudio --daemonize=no --log-target=journal
           │   │ │ │ └─667 /usr/lib/pulse/gsettings-helper
           │   │ │ ├─gvfs-daemon.service 
           │   │ │ │ ├─525 /usr/lib/gvfsd
           │   │ │ │ ├─530 /usr/lib/gvfsd-fuse /run/user/1000/gvfs -f
           │   │ │ │ └─842 /usr/lib/gvfsd-trash --spawner :1.3 /org/gtk/gvfs/exec_spaw/0
           │   │ │ ├─gvfs-udisks2-volume-monitor.service 
           │   │ │ │ └─665 /usr/lib/gvfs-udisks2-volume-monitor
           │   │ │ ├─obex.service 
           │   │ │ │ └─839 /usr/lib/bluetooth/obexd

           │   │ ├─809 blueberry-obex-agent

             ├─bluetooth.service 
             │ └─400 /usr/lib/bluetooth/bluetoothd

Is there some better way to peek at this?

Thanks for any clues!

hxss commented 2 years ago

yeah, I also noticed today that graphical-session.target doesn't starts by default(in xfce at least). So working solution should look something like this.

hxss commented 2 years ago

@LorenAmelang

I'm guessing that means the Bluetooth control panel

No, you need to go to cinnamon settings and find something like 'Session and startup settings', then disable default blueberry-tray command.

That points to my Home folder

Usually this is $HOME/.config/ directory.

enable - not sure what that means

To enable user service exec this in terminal: $ systemctl --user enable blueberry-tray.service

All files with full paths you can find in the gist.

LorenAmelang commented 2 years ago

Thanks for staying with me here! I'd really like to see this work...

So I went to $ cinnamon-settings startup to be sure, and got this:

Settings crop

"Bluetooth" was off, I had to turn it on to see the Edit dialog. Canceled and turned it back off - is that right? But there was no "blueberry-tray" command anywhere...

I did have a "$HOME/.config/" folder. I put your new "gist" files in it, and in "autostart". Owned by "loren loren" like most of the other .config files.

In autostart I noticed:

[loren@Gazp9 autostart]$ ls
autokey.desktop  blueberry.desktop  light-locker.desktop  screensaver-settings.desktop
[loren@Gazp9 autostart]$ cat blueberry.desktop
[Desktop Entry]
Name=Bluetooth
Name[am]=ብሉቱዝ
Name[ar]=البلوتوث
Name[as]=ব্লুটুথ
...
(tons more of those)
...
Icon=bluetooth
Exec=blueberry
Terminal=false
Type=Application
Categories=GTK;GNOME;Settings;HardwareSettings;X-XFCE-SettingsDialog;X-XFCE-HardwareSettings;
StartupNotify=true
NotShowIn=GNOME;KDE;Unity;
X-GNOME-Autostart-enabled=false
NoDisplay=false
Hidden=false
Name[en_US]=Bluetooth
Comment[en_US]=Configure Bluetooth settings
X-GNOME-Autostart-Delay=0
[loren@Gazp9 autostart]$

But the enable command didn't work:

[loren@Gazp9 autostart]$ systemctl --user enable blueberry-tray.service
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)
[loren@Gazp9 autostart]$
[loren@Gazp9 autostart]$ systemctl enable blueberry-tray.service
Failed to enable unit: Unit file blueberry-tray.service does not exist.
[loren@Gazp9 autostart]$

After a restart I get the Bt icon. On the first wake from hibernation I'm pretty sure it flashes on for a few ms before disappearing. On later wakes, no sign of it. At least I can still manually open Bluetooth and get connected.

Any ideas?

hxss commented 2 years ago

@LorenAmelang

I went to $ cinnamon-settings startup

Yes, this menu, but in xfce I have here only blueberry-tray command, not just blueberry - this command opens bluetooth window. So I think you dont need to change anything here.

$ systemctl --user enable blueberry-tray.service

Correct, this command should be executed from local user, without sudo.

Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined

this is strange, try to google it. systemctl --user should work from the box

I'm pretty sure it flashes on for a few ms

blueberry-tray stops on hibernate and doesn't start on resume until the service is enabled. The icon flashes most likely because of slow machine.

LorenAmelang commented 2 years ago

Trying to reply...

$ systemctl --user enable blueberry-tray.service
Correct, this command should be executed from local user, without sudo.

Earlier it logged: Jan 20 17:10:57 Gazp9 sudo[3197]: loren : TTY=pts/0 ; PWD=/home/loren/.config/systemd/user ; USER=root ; COMMAND=/usr/bin/systemctl status blueberry-tray.service

Now it doesn't log that, but does log: Jan 21 11:46:36 Gazp9 sudo[1104]: loren : TTY=pts/0 ; PWD=/home/loren ; USER=root ; COMMAND=/usr/bin/systemctl status blueberry-tray.service

Jan 21 11:58:03 Gazp9 sudo[1267]: loren : TTY=pts/2 ; PWD=/home/loren ; USER=root ; COMMAND=/usr/bin/systemctl status blueberry-tray.service

Where does it get "status"? No such command in the added files! Why does it say USER=root?

[loren@Gazp9 ~]$ cd /home/loren/.config/systemd/user/
[loren@Gazp9 user]$ ls -al
total 16
drwr-r- 2 loren loren 4096 Jan 18 21:50 .
drwr-r- 3 loren loren 4096 Jan 18 21:46 ..
-rwr-r- 1 loren loren  272 Jan 18 21:48 blueberry-tray.service
-rwr-r- 1 loren loren  121 Jan 18 21:50 xsession.target
[loren@Gazp9 user]$
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined
this is strange, try to google it. systemctl --user should work from the box

Just doesn't happen:

[loren@Gazp9 systemd]$ systemctl | grep blue
  sys-devices-pci0000:00-0000:00:14.0-usb3-3\x2d7-3\x2d7:1.0-bluetooth-hci0.device                                         loaded active plugged   /sys/devices/pci0000:00/0000:00:14.0/usb3/3-7/3-7:1.0/bluetooth/hci0
  sys-subsystem-bluetooth-devices-hci0.device                                                                              loaded active plugged   /sys/subsystem/bluetooth/devices/hci0
  bluetooth.service                                                                                                        loaded active running   Bluetooth service
  bluetooth.target                                                                                                         loaded active active    Bluetooth
[loren@Gazp9 systemd]$ systemctl status bluetooth.service
● bluetooth.service - Bluetooth service
     Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; vendor preset: disabled)
     Active: active (running) since Tue 2022-01-18 22:08:49 PST; 1 day 18h ago
       Docs: man:bluetoothd(8)
   Main PID: 400 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 19087)
     Memory: 3.6M
     CGroup: /system.slice/bluetooth.service
             └─400 /usr/lib/bluetooth/bluetoothd
[loren@Gazp9 systemd]$ systemctl enable bluetooth.service  [just works, no error]
[loren@Gazp9 systemd]$ systemctl --user enable bluetooth.service
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)

I tried making the added files executable... Obviously wrong...

From "slow" log (timeout=25000ms...):

Jan 20 17:20:38 Gazp9 kernel: usb 3-7: device descriptor read/64, error -110
Jan 20 17:20:52 Gazp9 dbus-daemon[387]: [system] Failed to activate service 'org.freedesktop.UPower': timed out (service_start_timeout=25000ms)
Jan 20 17:20:52 Gazp9 dbus-daemon[387]: [system] Activating via systemd: service name='org.freedesktop.UPower' unit='upower.service' requested by ':1.25' (uid=1000 pid=565 comm="csd-power ")
Jan 20 17:20:52 Gazp9 dbus-daemon[387]: [system] Failed to activate service 'org.bluez': timed out (service_start_timeout=25000ms)
Jan 20 17:20:52 Gazp9 pulseaudio[579]: GetManagedObjects() failed: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
Jan 20 17:20:54 Gazp9 kernel: usb 3-7: device descriptor read/64, error -110
Jan 20 17:20:54 Gazp9 kernel: usb 3-7: new full-speed USB device number 3 using xhci_hcd
Jan 20 17:20:54 Gazp9 systemd[482]: Configuration file /home/loren/.config/systemd/user/xsession.target is marked executable. Please remove executable permission bits. Proceeding anyway.
Jan 20 17:20:54 Gazp9 systemd[482]: Configuration file /home/loren/.config/systemd/user/xsession.target is marked executable. Please remove executable permission bits. Proceeding anyway.
Jan 20 17:20:54 Gazp9 systemd[482]: Configuration file /home/loren/.config/systemd/user/xsession.target is marked executable. Please remove executable permission bits. Proceeding anyway.
Jan 20 17:20:54 Gazp9 systemd[482]: Configuration file /home/loren/.config/systemd/user/xsession.target is marked executable. Please remove executable permission bits. Proceeding anyway.
Jan 20 17:20:54 Gazp9 systemd[482]: Reached target Current graphical user session.

--> Interesting the timeouts happened just before the "executable" warnings...

So we know it sees the added files.

But all it does is: Jan 20 17:20:26 Gazp9 systemd-xdg-autostart-generator[487]: /home/loren/.config/autostart/xsession.target.stop.desktop:7: Unknown key name 'RunHook' in section 'Desktop Entry', ignoring.

Earlier it logged: Jan 20 17:10:57 Gazp9 sudo[3197]: loren : TTY=pts/0 ; PWD=/home/loren/.config/systemd/user ; USER=root ; COMMAND=/usr/bin/systemctl status blueberry-tray.service

Now it doesn't log that, but does log:

Jan 21 11:46:36 Gazp9 sudo[1104]:    loren : TTY=pts/0 ; PWD=/home/loren ; USER=root ; COMMAND=/usr/bin/systemctl status blueberry-tray.service
...
Jan 21 11:58:03 Gazp9 sudo[1267]:    loren : TTY=pts/2 ; PWD=/home/loren ; USER=root ; COMMAND=/usr/bin/systemctl status blueberry-tray.service

Where does it get "status"? No such command in the added files!

It does log: Jan 20 17:17:08 Gazp9 systemd-xdg-autostart-generator[488]: /home/loren/.config/autostart/xsession.target.stop.desktop:7: Unknown key name 'RunHook' in section 'Desktop Entry', ignoring.

Could this matter:

Jan 18 22:08:51 Gazp9 pulseaudio[593]: E: [pulseaudio] daemon-conf.c: [/home/loren/.config/pulse//daemon.conf:45] Deprecated option 'enable-lfe-remixing' found.
Jan 18 22:08:51 Gazp9 pulseaudio[593]: E: [pulseaudio] daemon-conf.c: [/home/loren/.config/pulse//daemon.conf:45] Please migrate to 'remixing-produce-lfe' and 'remixing-consume-lfe', set both to 'no'.

I think I have to give up. In the time I've spent here I could have manually restarted Bluetooth for the rest of my life. I have five Linux machines, all totally different. Every one is unique and incomparable to any other instance. It is a miracle they all mostly work! Seems some unfixable quirks are the price one pays for that.

hxss commented 2 years ago

@LorenAmelang

systemctl --user enable blueberry-tray.service

you need to run this command from loren user without sudo. systemctl and systemctl --user is different environments and has different system and user services respectively. Read this and this.

LorenAmelang commented 2 years ago

Finally have a space to investigate this. But I did a full system update last week, and have seen the Bluetooth icon automatically on every wake since. It is far too soon to celebrate, but I'm definitely not going to change anything intentionally at this point...

It seems clear that my system refuses to run your suggested command. Maybe there is a clue here:

[loren@Gazp9 ~]$ systemctl --user show-environment
Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)

[loren@Gazp9 ~]$ systemctl --machine=loren@.host --user show-environment
EDITOR=/usr/bin/nano
HOME=/home/loren
LANG=en_US.UTF-8
LOGNAME=loren
MAIL=/var/spool/mail/loren
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
QT_QPA_PLATFORMTHEME=qt5ct
SHELL=/bin/bash
SYSTEMD_EXEC_PID=526
SYSTEMD_LESS=FRXMK
USER=loren
XDG_RUNTIME_DIR=/run/user/1000
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DESKTOP_SESSION=cinnamon
DISPLAY=:0
GDMSESSION=cinnamon
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
GTK3_MODULES=xapp-gtk3-module
GTK_MODULES=canberra-gtk-module
GTK_OVERLAY_SCROLLING=0
MOTD_SHOWN=pam
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
PWD=/home/loren
SESSION_MANAGER=local/Gazp9:@/tmp/.ICE-unix/539,unix/Gazp9:/tmp/.ICE-unix/539
SHLVL=0
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
XAUTHORITY=/home/loren/.Xauthority
XDG_CURRENT_DESKTOP=X-Cinnamon
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/loren
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=cinnamon
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SESSION_TYPE=x11
lines 1-34/34 (END)

It is not because I SSH into that terminal, I get the same response on a local terminal app.

https://wiki.archlinux.org/title/Systemd/User

As per default configuration in /etc/pam.d/system-login, the pam_systemd module automatically launches a systemd --user instance when the user logs in for the first time.

I don't recognize it here:

[loren@Gazp9 ~]$ cat /etc/pam.d/system-login
#%PAM-1.0

auth       required   pam_shells.so
auth       requisite  pam_nologin.so
auth       include    system-auth

account    required   pam_access.so
account    required   pam_nologin.so
account    include    system-auth

password   include    system-auth

session    optional   pam_loginuid.so
session    optional   pam_keyinit.so       force revoke
session    include    system-auth
session    optional   pam_motd.so
session    optional   pam_mail.so          dir=/var/spool/mail standard quiet
-session   optional   pam_systemd.so
session    required   pam_env.so           user_readenv=1
[loren@Gazp9 ~]$

I see Bluetooth mentioned here:

[loren@Gazp9 ~]$ ls -al /usr/lib/systemd/user/
total 280
drwxr-xr-x  4 root root 4096 Jan 29 22:30 .
drwxr-xr-x 18 root root 4096 Jan 29 22:28 ..
-rw-r--r--  1 root root  419 Nov 29 05:42 app.slice
-rw-r--r--  1 root root  127 Nov  8 12:46 at-spi-dbus-bus.service
-rw-r--r--  1 root root  424 Nov 29 05:42 background.slice
-rw-r--r--  1 root root  505 Nov 29 05:42 basic.target
-rw-r--r--  1 root root  427 Nov 29 05:42 bluetooth.target
...

And here:

[loren@Gazp9 ~]$ systemctl --machine=loren@.host --user status
● loren@.host
    State: running
     Jobs: 0 queued
   Failed: 0 units
    Since: Sat 2022-01-29 22:34:57 PST; 1 week 0 days ago
   CGroup: /user.slice/user-1000.slice/user@1000.service
           ├─session.slice
           │ └─pulseaudio.service
           │   ├─611 /usr/bin/pulseaudio --daemonize=no --log-target=journal
           │   └─667 /usr/lib/pulse/gsettings-helper
           ├─app.slice
           │ ├─gvfs-goa-volume-monitor.service
           │ │ └─741 /usr/lib/gvfs-goa-volume-monitor
           │ ├─dconf.service
           │ │ └─646 /usr/lib/dconf-service
           │ ├─gvfs-daemon.service
           │ │ ├─ 548 /usr/lib/gvfsd
           │ │ ├─ 553 /usr/lib/gvfsd-fuse /run/user/1000/gvfs -f
           │ │ └─1034 /usr/lib/gvfsd-trash --spawner :1.3 /org/gtk/gvfs/exec_spaw/0
           │ ├─gvfs-udisks2-volume-monitor.service
           │ │ └─705 /usr/lib/gvfs-udisks2-volume-monitor
           │ ├─obex.service
           │ │ └─855 /usr/lib/bluetooth/obexd
...

And here:

[loren@Gazp9 ~]$ systemctl --machine=loren@.host --user list-units
  UNIT                                                                                                                     LOAD   ACTIVE SUB       DESCRIPTION
  sys-devices-pci0000:00-0000:00:02.0-drm-card0-card0\x2deDP\x2d1-intel_backlight.device                                   loaded active plugged   /sys/devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight
  sys-devices-pci0000:00-0000:00:03.0-sound-card0-controlC0.device                                                         loaded active plugged   /sys/devices/pci0000:00/0000:00:03.0/sound/card0/controlC0
  sys-devices-pci0000:00-0000:00:14.0-usb3-3\x2d7-3\x2d7:1.0-bluetooth-hci0.device                                         loaded active plugged   /sys/devices/pci0000:00/0000:00:14.0/usb3/3-7/3-7:1.0/bluetooth/hci0
  sys-devices-pci0000:00-0000:00:1b.0-sound-card1-controlC1.device                                                         loaded active plugged   /sys/devices/pci0000:00/0000:00:1b.0/sound/card1/controlC1
  sys-devices-pci0000:00-0000:00:1c.2-0000:03:00.0-net-wlp3s0.device                                                       loaded active plugged   
...
module/fuse
  sys-subsystem-bluetooth-devices-hci0.device                                                                              loaded active plugged   /sys/subsystem/bluetooth/devices/hci0
  sys-subsystem-net-devices-enp4s0f2.device                                                                                loaded active plugged   
...
Bluetooth OBEX service
  pulseaudio.service                                                                                                       loaded active running   Sound Service
  -.slice                                                                                                                  loaded active active    Root 
...
p11-kit server
  pulseaudio.socket                                                                                                        loaded active running   Sound System
  dev-sda5.swap                                                                                                            loaded active active    /dev/sda5
  basic.target                                                                                                             loaded active active    Basic System
  bluetooth.target                                                                                                         loaded active active    Bluetooth
  default.target                                                                                                           loaded active active    Main User Target
  paths.target                                                                                                            loaded active active    Paths

The only mention of "tray" is here:

[loren@Gazp9 ~]$ ls -al ~/.config/systemd/user/
total 16
drwxr-xr-x 2 loren loren 4096 Jan 18 21:50 .
drwxr-xr-x 3 loren loren 4096 Jan 18 21:46 ..
-rwxr-xr-x 1 loren loren  272 Jan 18 21:48 blueberry-tray.service
-rwxr-xr-x 1 loren loren  121 Jan 18 21:50 xsession.target
[loren@Gazp9 ~]$

I suppose that is because I haven't successfully run the suggested command to start it. Maybe

systemctl --machine=loren@.host --user enable blueberry-tray.service

would work? But as I said, the default system seems to be working at the moment, so I'm not going to mess with it.

I appreciate your patience with this! Hope my experience helps somebody.

Loren