Toqozz / wired-notify

Lightweight notification daemon with highly customizable layout blocks, written in Rust.
MIT License
581 stars 27 forks source link

thread 'main' panicked at src/bus/dbus.rs:119:39, Failed to get a session bus. #122

Closed xero-lib closed 9 months ago

xero-lib commented 9 months ago

Arch Linux 6.6.6 Wired 10.2

Command executed: sudo systemctl enable --now wired

Output:

Job for wired.service failed because the control process exited with error code.
See "systemctl status wired.service" and "journalctl -xeu wired.service" for details.

Journalctl logs:

Dec 13 20:09:20 andromeda wired[33562]: Couldn't load a config because we couldn't find one, so will use default.
Dec 13 20:09:20 andromeda wired[33562]: A wired socket exists; taking ownership.  Existing wired processes will not receive CLI calls.
Dec 13 20:09:20 andromeda wired[33562]: thread 'main' panicked at src/bus/dbus.rs:119:39:
Dec 13 20:09:20 andromeda wired[33562]: Failed to get a session bus.: D-Bus error: Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead (org.freedesktop.DBu>
Dec 13 20:09:20 andromeda wired[33562]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Dec 13 20:09:20 andromeda systemd[1]: wired.service: Main process exited, code=exited, status=1/FAILURE

There was no previous wired instance running, and I had manually removed /tmp/wired.sock, so I'm not convinced by "A wired socket exists". I'm not sure what else to try here, so I've come to the issues section.

Toqozz commented 9 months ago

This seems to be coming from somewhere in D-Bus. I looked up the error and found this other issue: https://github.com/waydroid/waydroid/issues/732

Seems like it could be related to running as root. Try doing systemctl enable --user --now wired instead.

What happens if you run the wired executable on its own, without systemd?

xero-lib commented 9 months ago

This seems to be coming from somewhere in D-Bus. I looked up the error and found this other issue: waydroid/waydroid#732

Seems like it could be related to running as root. Try doing systemctl enable --user --now wired instead.

What happens if you run the wired executable on its own, without systemd?

With systemctl enable --user --now wired the error shown in journalctl --user -xeu wired.service is:

Dec 19 13:43:57 andromeda systemd[1167]: Starting Wired Notification Daemon...
░░ Subject: A start job for unit UNIT has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit UNIT has begun execution.
░░
░░ The job identifier is 1135.
Dec 19 13:43:57 andromeda wired[196609]: A wired socket exists; taking ownership.  Existing wired processes will not receive CLI calls.
Dec 19 13:43:57 andromeda wired[196609]: thread 'main' panicked at src/cli.rs:47:47:
Dec 19 13:43:57 andromeda wired[196609]: called `Result::unwrap()` on an `Err` value: Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" }
Dec 19 13:43:57 andromeda wired[196609]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Dec 19 13:43:57 andromeda systemd[1167]: wired.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStart= process belonging to unit UNIT has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Dec 19 13:43:57 andromeda systemd[1167]: wired.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit UNIT has entered the 'failed' state with result 'exit-code'.
Dec 19 13:43:57 andromeda systemd[1167]: Failed to start Wired Notification Daemon.
░░ Subject: A start job for unit UNIT has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ A start job for unit UNIT has finished with a failure.
░░
░░ The job identifier is 1135 and the job result is failed.

When running the executable by itself, I receive the error:

A wired socket exists; taking ownership.  Existing wired processes will not receive CLI calls.
thread 'main' panicked at src/cli.rs:47:47:
called `Result::unwrap()` on an `Err` value: Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

with the full backtrace being:

A wired socket exists; taking ownership.  Existing wired processes will not receive CLI calls.
thread 'main' panicked at src/cli.rs:47:47:
called `Result::unwrap()` on an `Err` value: Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" }
stack backtrace:
   0:     0x560c26188f5c - std::backtrace_rs::backtrace::libunwind::trace::hccf3cfe599d26745
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x560c26188f5c - std::backtrace_rs::backtrace::trace_unsynchronized::hd3d8077f873485f2
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x560c26188f5c - std::sys_common::backtrace::_print_fmt::h182daaf98b25bd14
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x560c26188f5c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4b6a846227d97bb7
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x560c261b5ee0 - core::fmt::rt::Argument::fmt::h9766ef94e9786c29
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/core/src/fmt/rt.rs:142:9
   5:     0x560c261b5ee0 - core::fmt::write::hb46e4cb217dc2581
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/core/src/fmt/mod.rs:1120:17
   6:     0x560c2618653f - std::io::Write::write_fmt::h0e754bba34fa795b
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/io/mod.rs:1810:15
   7:     0x560c26188d44 - std::sys_common::backtrace::_print::h73ad48f083423281
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x560c26188d44 - std::sys_common::backtrace::print::h394692fca6f2f34a
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x560c2618a877 - std::panicking::default_hook::{{closure}}::haa3c8a2ef3bd08de
  10:     0x560c2618a5df - std::panicking::default_hook::h37c8166f13b8b27c
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/panicking.rs:292:9
  11:     0x560c25e43c2e - wired::main::{{closure}}::hd6cf5428ec12f46c
  12:     0x560c2618ae88 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1fb6d1c1593aee78
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/alloc/src/boxed.rs:2029:9
  13:     0x560c2618ae88 - std::panicking::rust_panic_with_hook::h71d389cf21201b59
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/panicking.rs:783:13
  14:     0x560c2618abde - std::panicking::begin_panic_handler::{{closure}}::h655372ff562611b4
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/panicking.rs:657:13
  15:     0x560c26189426 - std::sys_common::backtrace::__rust_end_short_backtrace::h0e91de37c406f2fe
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x560c2618a942 - rust_begin_unwind
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/panicking.rs:645:5
  17:     0x560c25dad385 - core::panicking::panic_fmt::h0290566811e2a53e
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/core/src/panicking.rs:72:14
  18:     0x560c25dad883 - core::result::unwrap_failed::he976b56b2f3075df
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/core/src/result.rs:1649:5
  19:     0x560c25e0aa04 - wired::cli::CLIListener::init::h33f49c6eb973e00a
  20:     0x560c25e4319b - wired::main::h1206776738bcd69d
  21:     0x560c25e2ba43 - std::sys_common::backtrace::__rust_begin_short_backtrace::ha168e766a9bb9cca
  22:     0x560c25e2ba79 - std::rt::lang_start::{{closure}}::h6c8d7288a809b830
  23:     0x560c2617f667 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hd620b3b8c9654887
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/core/src/ops/function.rs:284:13
  24:     0x560c2617f667 - std::panicking::try::do_call::h319f4a718cea0bc5
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/panicking.rs:552:40
  25:     0x560c2617f667 - std::panicking::try::h2c1b070ca4a247bb
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/panicking.rs:516:19
  26:     0x560c2617f667 - std::panic::catch_unwind::h6a5d720b96964c71
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/panic.rs:142:14
  27:     0x560c2617f667 - std::rt::lang_start_internal::{{closure}}::hbad653246307ad43
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/rt.rs:148:48
  28:     0x560c2617f667 - std::panicking::try::do_call::h83f4de88adc0ca5e
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/panicking.rs:552:40
  29:     0x560c2617f667 - std::panicking::try::hd3793aaafcd95dda
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/panicking.rs:516:19
  30:     0x560c2617f667 - std::panic::catch_unwind::h4b1c2658c4d0db72
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/panic.rs:142:14
  31:     0x560c2617f667 - std::rt::lang_start_internal::hcda365c9de08b755
                               at /rustc/f967532a47eb728ada44473a5c4c2eca1a45fe30/library/std/src/rt.rs:148:20
  32:     0x560c25e2ba6e - std::rt::lang_start::h2ad7a592302729ed
  33:     0x7fde636cacd0 - <unknown>
  34:     0x7fde636cad8a - __libc_start_main
  35:     0x560c25dadb85 - _start
  36:                0x0 - <unknown>
s-b-repo commented 9 months ago

ERROR: org.freedesktop.DBus.Error.NotSupported: Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead

s-b-repo commented 9 months ago

File "/usr/lib/waydroid/tools/init.py", line 70, in main actions.session_manager.start(args) File "/usr/lib/waydroid/tools/actions/session_manager.py", line 35, in start name = dbus.service.BusName("id.waydro.Session", dbus.SessionBus(), do_not_queue=True) ^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/dbus/_dbus.py", line 209, in new return Bus.new(cls, Bus.TYPE_SESSION, private=private, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/dbus/_dbus.py", line 99, in new bus = BusConnection.new(subclass, bus_type, mainloop=mainloop) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/site-packages/dbus/bus.py", line 120, in new bus = cls._new_for_bus(address_or_type, mainloop=mainloop) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NotSupported: Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead

Toqozz commented 9 months ago

@xero-lib The error that's happening now seems to be because it is unable to remove the existing session bus, likely because of running as root beforehand. Can you manually remove the /tmp/wired.sock and show me the output of just running wired on the command line again?

xero-lib commented 9 months ago

@xero-lib The error that's happening now seems to be because it is unable to remove the existing session bus, likely because of running as root beforehand. Can you manually remove the /tmp/wired.sock and show me the output of just running wired on the command line again?

After disabling and stopping wired through systemctl and removing wired.sock, it does seem to work:

Notification bus name acquired.

Maybe check if a root sock exists with an if let Err(x) and give a bit more of a descriptive message than just panicking? Not sure of the structure of wired.

xero-lib commented 9 months ago

I have opened #124 to fix this issue.