Xpra-org / xpra

Persistent remote applications for X11; screen sharing for X11, MacOS and MSWindows.
https://xpra.org/
GNU General Public License v2.0
1.98k stars 169 forks source link

Failed to connect to socket /tmp/dbus-gXpCRTJe1M: Connection refused #4234

Closed cadem closed 6 months ago

cadem commented 6 months ago

i attach a session, got an error: Failed to connect to socket /tmp/dbus-gXpCRTJe1M: Connection refused

The command is: xpra attach :100

The full log is:

Warning: XDG_RUNTIME_DIR is not defined
 and '/run/user/1000' does not existfailure: Connection refused
 using '/tmp':35:05,397  pa_context_connect() failed: Connection refused
2024-05-17 11:35:05,401 created unix domain sockets:
2024-05-17 12:30:19,641 Xpra GTK3 X11 client version 6.0-r03194047'
2024-05-17 12:30:19,743  running on Linux Ubuntu 22.04 jammy
2024-05-17 12:30:19,743  cpython 3.10top.DBus.Error.NoServer: Failed to connect to socket /tmp/dbus-gXpCRTJe1M: Connecti
Warning: failed to query pulseaudio using 'pactl info'
 XDG_RUNTIME_DIR (/tmp) is not owned by us (uid 1000), but by uid 0! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)
 Connection failure: Connection refused
 pa_context_connect() failed: Connection refusedpts/main.py", line 138, in main
Warning: failed to query pulseaudio using 'pactl info', args, mode, defaults)
 XDG_RUNTIME_DIR (/tmp) is not owned by us (uid 1000), but by uid 0! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)de, defaults)
 Connection failure: Connection refusedxpra/scripts/main.py", line 613, in do_run_mode
 pa_context_connect() failed: Connection refusedr_cb, options, args, mode)
2024-05-17 12:30:21,098 GStreamer version 1.20.3pts/main.py", line 1449, in run_client
2024-05-17 12:30:21,140 Warning: failed to query pulseaudio using 'pactl info'
2024-05-17 12:30:21,140  XDG_RUNTIME_DIR (/tmp) is not owned by us (uid 1000), but by uid 0! (This could e.g. happen if you try to connect to a non-root PulseAudio as a root user, over the native protocol. Don't do that.)
2024-05-17 12:30:21,140  Connection failure: Connection refusedine 1690, in get_client_gui_app
2024-05-17 12:30:21,140  pa_context_connect() failed: Connection refused
2024-05-17 12:30:21,236 Warning: failed to instantiate the dbus notification handler in init_ui
2024-05-17 12:30:21,236  org.freedesktop.DBus.Error.NoServer: Failed to connect to socket /tmp/dbus-gXpCRTJe1M: Connection refusedsr/lib/python3/dist-packages/xpra/client/gtk3/keyboard_helper.py", line 20, in __init__
2024-05-17 12:30:21,237  disable notifications to avoid this warning
2024-05-17 12:30:21,240 Warning: failed to create socket directory '/run/user/1000/xpra/clients'
2024-05-17 12:30:21,240  [Errno 13] Permission denied: '/run/user/1000'
2024-05-17 12:30:21,241 Warning: cannot create socket '/run/user/1000/xpra/clients/53d01-3210733':
2024-05-17 12:30:21,241  [Errno 2] No such file or directory
2024-05-17 12:30:21,241  ($XDG_RUNTIME_DIR has not been created?)e.py", line 21, in __init__
2024-05-17 12:30:21,548 Error: cannot show notification
2024-05-17 12:30:21,549  'Xpra client failed to connect'ix/keyboard.py", line 48, in init_vars
2024-05-17 12:30:21,549  g-io-error-quark: Could not connect: Connection refused (39)
xpra main error:/python3/dist-packages/xpra/dbus/helper.py", line 97, in __init__
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 138, in mainession_bus
    return run_mode(script_file, cmdline, err, options, args, mode, defaults)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 521, in run_mode
    return do_run_mode(script_file, cmdline, error_cb, options, args, full_mode, defaults)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 613, in do_run_mode
    return run_client(script_file, cmdline, error_cb, options, args, mode)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 1449, in run_client
    app = get_client_app(cmdline, error_cb, opts, extra_args, mode)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 1618, in get_client_appocket /tmp/dbus-gXpCRTJe1M: Co
    app = get_client_gui_app(error_cb, opts, request_mode, extra_args, mode)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 1690, in get_client_gui_app
    app.init_ui(opts)
  File "/usr/lib/python3/dist-packages/xpra/client/gui/ui_client_base.py", line 222, in init_ui                     
    self.keyboard_helper = self.keyboard_helper_class(send_keyboard, opts.keyboard_sync,
  File "/usr/lib/python3/dist-packages/xpra/client/gtk3/keyboard_helper.py", line 20, in __init__
    KeyboardHelper.__init__(self, *args)
  File "/usr/lib/python3/dist-packages/xpra/client/gui/keyboard_helper.py", line 48, in __init__
    self.keyboard = Keyboard()  # pylint: disable=not-callable
  File "/usr/lib/python3/dist-packages/xpra/platform/posix/keyboard.py", line 28, in __init__
    super().__init__()
  File "/usr/lib/python3/dist-packages/xpra/platform/keyboard_base.py", line 21, in __init__
    self.init_vars()
  File "/usr/lib/python3/dist-packages/xpra/platform/posix/keyboard.py", line 48, in init_vars
    self.__dbus_helper = DBusHelper()
  File "/usr/lib/python3/dist-packages/xpra/dbus/helper.py", line 97, in __init__
    self.bus = init_session_bus()
  File "/usr/lib/python3/dist-packages/xpra/dbus/common.py", line 27, in init_session_bus
    _session_bus = dbus.SessionBus(private=private)
  File "/usr/lib/python3/dist-packages/dbus/_dbus.py", line 212, in __new__
    return Bus.__new__(cls, Bus.TYPE_SESSION, private=private,
  File "/usr/lib/python3/dist-packages/dbus/_dbus.py", line 102, in __new__
    bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 124, in __new__
    bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoServer: Failed to connect to socket /tmp/dbus-gXpCRTJe1M: Connection refused
totaam commented 6 months ago

Something is probably wrong with your client setup if you don't have a valid XDG_RUNTIME_DIR. Your log sample is also a bit garbled.

v6.0.1 will handle this more gracefully: 3d647b43d00ad4b4e28e3a8d5b0c0c7f7111ac61 Though this won't fix your issues with XDG_RUNTIME_DIR being missing - don't expect miracles.

The same commit is also in:

cadem commented 6 months ago

Yes, issue still exist, when I upgrade to xpra v6.1-r35687 (g929d991be7) beta.

XDG_RUNTIME_DIR=/home/ubuntu/ xpra attach :100 --notifications=no

2024-05-17 15:36:52,314 Xpra GTK3 X11 client version 6.1-r35687 (g929d991be7) beta
2024-05-17 15:36:52,419  running on Linux Ubuntu 22.04 jammy
2024-05-17 15:36:52,419  cpython 3.10
Warning: failed to query pulseaudio using 'pactl info'
 Connection failure: Connection refused
 pa_context_connect() failed: Connection refused
Warning: failed to query pulseaudio using 'pactl info'
 Connection failure: Connection refused
 pa_context_connect() failed: Connection refused
2024-05-17 15:36:53,063 GStreamer version 1.20.3
2024-05-17 15:36:53,103 Warning: failed to query pulseaudio using 'pactl info'
2024-05-17 15:36:53,103  Connection failure: Connection refused
2024-05-17 15:36:53,103  pa_context_connect() failed: Connection refused
2024-05-17 15:36:53,107 created unix domain sockets:
2024-05-17 15:36:53,107  '/home/ubuntu//xpra/clients/53d01-3243673'
2024-05-17 15:36:53,344 Xpra client failed to connect
2024-05-17 15:36:53,344  org.freedesktop.DBus.Error.NoServer: Failed to connect to socket /tmp/dbus-gXpCRTJe1M: Connection refused
2024-05-17 15:36:53,354 removing unix domain socket '/home/ubuntu//xpra/clients/53d01-3243673'
xpra main error:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 138, in main
    return run_mode(script_file, cmdline, err, options, args, mode, defaults)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 521, in run_mode
    return do_run_mode(script_file, cmdline, error_cb, options, args, full_mode, defaults)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 613, in do_run_mode
    return run_client(script_file, cmdline, error_cb, options, args, mode)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 1449, in run_client
    app = get_client_app(cmdline, error_cb, opts, extra_args, mode)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 1618, in get_client_app
    app = get_client_gui_app(error_cb, opts, request_mode, extra_args, mode)
  File "/usr/lib/python3/dist-packages/xpra/scripts/main.py", line 1690, in get_client_gui_app
    app.init_ui(opts)
  File "/usr/lib/python3/dist-packages/xpra/client/gui/ui_client_base.py", line 222, in init_ui
    self.keyboard_helper = self.keyboard_helper_class(send_keyboard, opts.keyboard_sync,
  File "/usr/lib/python3/dist-packages/xpra/client/gtk3/keyboard_helper.py", line 20, in __init__
    KeyboardHelper.__init__(self, *args)
  File "/usr/lib/python3/dist-packages/xpra/client/gui/keyboard_helper.py", line 48, in __init__
    self.keyboard = Keyboard()  # pylint: disable=not-callable
  File "/usr/lib/python3/dist-packages/xpra/platform/posix/keyboard.py", line 28, in __init__
    super().__init__()
  File "/usr/lib/python3/dist-packages/xpra/platform/keyboard_base.py", line 21, in __init__
    self.init_vars()
  File "/usr/lib/python3/dist-packages/xpra/platform/posix/keyboard.py", line 48, in init_vars
    self.__dbus_helper = DBusHelper()
  File "/usr/lib/python3/dist-packages/xpra/dbus/helper.py", line 97, in __init__
    self.bus = init_session_bus()
  File "/usr/lib/python3/dist-packages/xpra/dbus/common.py", line 27, in init_session_bus
    _session_bus = dbus.SessionBus(private=private)
  File "/usr/lib/python3/dist-packages/dbus/_dbus.py", line 212, in __new__
    return Bus.__new__(cls, Bus.TYPE_SESSION, private=private,
  File "/usr/lib/python3/dist-packages/dbus/_dbus.py", line 102, in __new__
    bus = BusConnection.__new__(subclass, bus_type, mainloop=mainloop)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 124, in __new__
    bus = cls._new_for_bus(address_or_type, mainloop=mainloop)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoServer: Failed to connect to socket /tmp/dbus-gXpCRTJe1M: Connection refused
totaam commented 6 months ago

Yes, issue still exist, when I upgrade to xpra v6.1-r35687 (g929d991be7) beta

That's expected, that version is older than the commit above. Either build from source or wait for new beta builds to be available. Or better yet, fix your dbus and XDG_RUNTIME_DIR issues. This should not be happening. The commit only papers over it.

cadem commented 6 months ago

Which version the dbus issue will be fixed in?

And I found the workaround way: launch the client as follow: dbus-run-session xpra attach :100.

totaam commented 6 months ago

Which version the dbus issue will be fixed in?

The fix is in xpra, the next crop of builds will have it.

And I found the workaround way: launch the client as follow: dbus-run-session xpra attach :100

So your client doesn't have dbus running? Strange.

cadem commented 6 months ago

maybe so. I setup ubuntu desktop in a docker, dbus maybe is missing.

totaam commented 6 months ago

I setup ubuntu desktop in a docker, dbus maybe is missing.

You should have mentioned that in the very first comment, save us all a lot of time.

eried commented 2 months ago

Hi @cadem what was the solution at the end? I am getting the same errors, I guess the system does not has dbus either

totaam commented 2 months ago

FWIW: with 6.2 and later, you can run with --no-dbus: 28f4d1dfaacf43e1075ba74188e951bd96fc6065

totaam commented 2 months ago

Anyone landing here is probably using an out-of-date package - see https://github.com/Xpra-org/xpra/wiki/Distribution-Packages

The workaround was included in v6.1.1: 702f35259aebf0377dc375e34060946b46a4cb79 which has been released.

eried commented 2 months ago

Hi, thanks, I am using 6.1.1-ro, but still getting this error. I will check once 6.2 gets released with the --no-dbus option :)

totaam commented 2 months ago

@eried are you sure that you have 6.1.1 running? What is the full output of xpra --version? Looking at the 6.1.1 version of this file: https://github.com/Xpra-org/xpra/blob/v6.1.1/xpra/platform/posix/keyboard.py#L46-L54 The fix is present!?