Alexays / Waybar

Highly customizable Wayland bar for Sway and Wlroots based compositors. :v: :tada:
MIT License
6.81k stars 715 forks source link

CRITICAL : unhandled exception (type Glib::Error) in signal handler g-dbus-error-quark #3302

Open ashish-kus opened 6 months ago

ashish-kus commented 6 months ago

everyrime i run waybar on terminal everything work fine but I see these error in std output

** (waybar:22634): CRITICAL **: 19:07:05.895:
unhandled exception (type Glib::Error) in signal handler:
domain: g-dbus-error-quark
code  : 41
what  : GDBus.Error:org.freedesktop.DBus.Error.UnknownObject: Unknown object '/org/freedesktop/login1/session/self'.

config: https://0x0.st/XZ0F.json

shimeoki commented 6 months ago

Same issue. Appeared after I added the "backlight/slider" module.

apiraino commented 5 months ago

I did some investigation here, I'm not sure of my findings.

I think this error is not causing anything bad, it's just that Waybar tries to connect to the wrong dbus login session. According to the following output, there is no /org/freedesktop/login1/session/self. Instead there is a /org/freedesktop/login1/session/auto:

$ busctl tree org.freedesktop.login1
└─ /org
  └─ /org/freedesktop
    ├─ /org/freedesktop/LogControl1
    └─ /org/freedesktop/login1
      ├─ /org/freedesktop/login1/seat
      │ ├─ /org/freedesktop/login1/seat/auto
      │ └─ /org/freedesktop/login1/seat/seat0
      ├─ /org/freedesktop/login1/session
      │ ├─ /org/freedesktop/login1/session/_33
      │ ├─ /org/freedesktop/login1/session/_34
      │ └─ /org/freedesktop/login1/session/auto
      └─ /org/freedesktop/login1/user
        ├─ /org/freedesktop/login1/user/_1000
        └─ /org/freedesktop/login1/user/self

I recompiled Waybar changing that:

--- a/src/util/backlight_backend.cpp
+++ b/src/util/backlight_backend.cpp
@@ -153,7 +153,7 @@ BacklightBackend::BacklightBackend(std::chrono::milliseconds interval,
   // Connect to the login interface
   login_proxy_ = Gio::DBus::Proxy::create_for_bus_sync(
       Gio::DBus::BusType::BUS_TYPE_SYSTEM, "org.freedesktop.login1",
-      "/org/freedesktop/login1/session/self", "org.freedesktop.login1.Session");
+      "/org/freedesktop/login1/session/auto", "org.freedesktop.login1.Session");

and the error disappears. I'm not 100% what this all means, tried reading the documentation but didn't understand anything :slightly_smiling_face:

This was introduced in e8c4b85328f6fb6b8a250db6709595af6cca3bfb so paging @Kuruyia as author of the original patch. Do you have any thoughts here on how DBus works?

By the way, this issue is maybe related to #3042 (at least for the errors dumped on console)

Kuruyia commented 4 months ago

This was introduced in https://github.com/Alexays/Waybar/commit/e8c4b85328f6fb6b8a250db6709595af6cca3bfb so paging @Kuruyia as author of the original patch. Do you have any thoughts here on how DBus works?

I'm not 100% sure, but from what I understand from systemd-logind's code, you can indeed not have the /org/freedesktop/login1/session/self node and have the /org/freedesktop/login1/session/auto node in some case. So I think your patch of using /auto is very reasonable.

I'm curious as to what environment you are running? I took a look at elogind's code too, but there are no differences with the function in systemd-logind.

apiraino commented 4 months ago

hey @Kuruyia thank you so much for pointing to the systemd codebase! Yes, by reading the commit message, I now get a bit more context and though the wording is not 100% clear to me, it sounds like "auto" is some sort of fallback.

Can't speak for OP but I am on debian/trixie with latest systemd 256.1. My login manager is not elogind, I am using greetd with Sway.

Kuruyia commented 4 months ago

hey @Kuruyia thank you so much for pointing to the systemd codebase! Yes, by reading the commit message, I now get a bit more context and though the wording is not 100% clear to me, it sounds like "auto" is some sort of fallback.

Oh good idea reading the commit message, didn't think about that x) Yeah it seems to say that if we don't care about sessions, we can simply use the /auto node. If you want to open a PR to fix this it would be cool ^^ We can also try to open /auto first and fallback to /self if this failed (in case we encounter an old or odd login manager).

Can't speak for OP but I am on debian/trixie with latest systemd 256.1. My login manager is not elogind, I am using greetd with Sway.

Ohhh okay didn't know about this one. Although is it greetd that exposes the org.freedesktop.login1 interface on your system? I don't see any D-Bus related code in the greetd repo.

5han7anu-S commented 3 months ago

I'm facing the same issue. Is there any workaround that doesn't involve editing the source code and recompiling locally?

msmafra commented 2 months ago

Same here, but with me is only happening, as far as I could understand, when I restart waybar with killall -SIGUSR2 waybar or a "complete" kill killall waybar; waybar -c ~/.config/hypr/waybar/config -s ~/.config/hypr/waybar/style.css & disown. Only works again by loging out of Hyrpeland and loging back in.

 .821ns fsh ❯ 
** (waybar:10720): CRITICAL **: 10:01:38.820: 
unhandled exception (type Glib::Error) in signal handler:
domain: g-dbus-error-quark
code  : 41
what  : GDBus.Error:org.freedesktop.DBus.Error.UnknownObject: Unknown object '/org/freedesktop/login1/session/self'.

** (waybar:10720): CRITICAL **: 10:01:39.271: 
unhandled exception (type Glib::Error) in signal handler:
domain: g-dbus-error-quark
code  : 41
what  : GDBus.Error:org.freedesktop.DBus.Error.UnknownObject: Unknown object '/org/freedesktop/login1/session/self'.

** (waybar:10720): CRITICAL **: 10:01:39.475: 
unhandled exception (type Glib::Error) in signal handler:
domain: g-dbus-error-quark
code  : 41
what  : GDBus.Error:org.freedesktop.DBus.Error.UnknownObject: Unknown object '/org/freedesktop/login1/session/self'.

** (waybar:10720): CRITICAL **: 10:01:40.273: 
unhandled exception (type Glib::Error) in signal handler:
domain: g-dbus-error-quark
code  : 41
IBeTheBlueCat commented 1 month ago

This issue seems to be the same as #3042 And I receive the error every time I try to change my display brightness using the brightness or brightness/slider module. brightnessctl set x% works as expected, and the value updates on the waybar module, but altering the value using the waybar module itself is impossible

demonspork commented 3 weeks ago

For my environment in Hyprland, I have to run waybar from Hyprland with hyprctl dispatch exec waybar and these problems go away.

Nambers commented 1 day ago

This issue seems to be the same as #3042 And I receive the error every time I try to change my display brightness using the brightness or brightness/slider module. brightnessctl set x% works as expected, and the value updates on the waybar module, but altering the value using the waybar module itself is impossible

I also faced this problem when I try to use slider to adjust my backlight and it doesn't work. The brightnessctl set works normally and I use waybar-git in Archlinux(re-installed today).

IBeTheBlueCat commented 1 day ago

For my environment in Hyprland, I have to run waybar from Hyprland with hyprctl dispatch exec waybar and these problems go away.

Thank you for bringing this up, the brightness module does work correctly and no errors are thrown when running from hyprctl or just by running waybar in a terminal. This error seems to be exclusive to running waybar with systemd --user start waybar, which is how I prefer to do it for my config.

Nambers commented 1 day ago

For my environment in Hyprland, I have to run waybar from Hyprland with hyprctl dispatch exec waybar and these problems go away.

sadly this didn't works on my side I used

hyprctl dispatch exec "waybar -c ~/.config/waybar/waybar.conf"

(ps I didn't get any log in stdout) and I was started waybar from exec-once

edit: for terminal, I got

** (waybar:17441): CRITICAL **: 17:43:26.668: 
unhandled exception (type Glib::Error) in signal handler:
domain: g-dbus-error-quark
code  : 41
what  : GDBus.Error:org.freedesktop.DBus.Error.UnknownObject: Unknown object '/org/freedesktop/login1/session/self'.
msmafra commented 1 day ago

For me it solved that issue with hyprctl dispatch exec, but I use hyprctl dispatch -- exec waybar -c ~/config -s ~/style https://wiki.hyprland.org/Configuring/Using-hyprctl/#dispatch

Won't work for long lines. At least did not work for me with nwg-drawer's long lines.