WSL icon indicating copy to clipboard operation
WSL copied to clipboard

wsl 2 - Getting “Failed to connect to the bus: Could not parse server address” error when launching google chrome or any electron app

Open mwoodpatrick opened this issue 4 years ago • 44 comments

Version

Windows version: 10.0.22000.376

WSL Version

  • [X] WSL 2
  • [ ] WSL 1

Kernel Version

5.10.74.3

Distro Version

20.04.3 LTS (Focal Fossa)

Other Software

electron 16.0.6 or Google chrome Version 97.0.4692.71 (Official Build) (64-bit)

Repro Steps

Install and start google chrome on wsl2 and start

Expected Behavior

browser should come up without error

Actual Behavior

google-chrome [8405:8442:0110/140553.266744:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory [8405:8441:0110/140553.276538:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [8405:8441:0110/140553.277982:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [8405:8441:0110/140553.329491:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [8405:8441:0110/140553.329632:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [8405:8476:0110/140553.499766:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory [8405:8476:0110/140553.499863:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory [8405:8476:0110/140553.500048:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory [8405:8476:0110/140553.500124:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory [8405:8476:0110/140553.500170:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory [8448:8448:0110/140555.058357:ERROR:sandbox_linux.cc(378)] InitializeSandbox() called with multiple threads in process gpu-process. [8405:8441:0110/140636.457250:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [8405:8441:0110/140636.457371:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [8405:9002:0110/140641.065898:ERROR:chrome_browser_main_extra_parts_metrics.cc(227)] START: ReportBluetoothAvailability(

Diagnostic Logs

No response

mwoodpatrick avatar Jan 10 '22 22:01 mwoodpatrick

Note chrome and electron apps do start but they give the above errors

mwoodpatrick avatar Jan 10 '22 22:01 mwoodpatrick

@mwoodpatrick - are you using WSLg or a third party xserver on Windows?

benhillis avatar Jan 11 '22 22:01 benhillis

wslg, xdpyinfo shows

name of display: :0 version number: 11.0 vendor string: Microsoft Corporation vendor release number: 12010000 maximum request size: 16777212 bytes motion buffer size: 256 bitmap unit, bit order, padding: 32, LSBFirst, 32 image byte order: LSBFirst

mwoodpatrick avatar Jan 11 '22 22:01 mwoodpatrick

starting dbus using

sudo service dbus start

did not help

mwoodpatrick avatar Jan 11 '22 23:01 mwoodpatrick

That error is making our GHA workflows hard to debug as there are tons of it. If anyone know a workaround for it it would be great.

ssbarnea avatar Jan 31 '22 17:01 ssbarnea

Likewise I'm seeing a lot of these errors, when running test on our Electron based app.

The cyrpress test tool makes reference to it in http://www.apimirror.com/cypress/guides/guides/debugging, And there is some hope offered here https://x410.dev/cookbook/wsl/setting-up-wsl-for-linux-gui-apps/

I would hope that the new WSLg will help here; or use multipass rather WSL.

mbwhite avatar Mar 04 '22 09:03 mbwhite

I am getting these error with Cypress + Github Actions. Any solution for this?

rajann44 avatar Apr 11 '22 21:04 rajann44

any updates?

OmarLomsadze avatar May 20 '22 12:05 OmarLomsadze

also interesting

RestOp avatar Jun 11 '22 22:06 RestOp

Would also appreciate some help with this - im running into the same issue

PLopezD avatar Jun 21 '22 19:06 PLopezD

Same error with a fresh WSL install.

npx cypress open
[842:0622/130355.318602:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[842:0622/130355.318681:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[1017:0622/130355.388099:ERROR:sandbox_linux.cc(377)] InitializeSandbox() called with multiple threads in process gpu-process.
[1017:0622/130355.390256:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
[842:0622/130356.093104:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[842:0622/130356.100823:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
^C[1017:0622/130359.490904:ERROR:connection.cc(66)] X connection error received.
[1017:0622/130359.490881:ERROR:connection.cc(66)] X connection error received.

I tried distros : Ubuntu22, Ubuntu20, Debian. The same.

StephaneRavet avatar Jun 22 '22 11:06 StephaneRavet

Here are steps to get dbus functionality on Win10/WSL:

- set `DISPLAY` env variable
- start `dbus` service
- set `XDG_RUNTIME_DIR` env variable
- start `dbus` user session

This will fix ERROR:bus.cc(398)] Failed to connect to the bus: Failed to connect to socket /run/user/1000/bus: No such file or directory

Sample run on Win10 and vcxsrv using current WSL endpoint IP address:

- export DISPLAY=172.19.48.1:0
- sudo service dbus start
- export XDG_RUNTIME_DIR=/run/user/$(id -u)
- sudo mkdir $XDG_RUNTIME_USER
- sudo chmod 700 $XDG_RUNTIME_DIR
- sudo chown $(id -un):$(id -gn) $XDG_RUNTIME_DIR
- export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus
- dbus-daemon --session --address=$DBUS_SESSION_BUS_ADDRESS --nofork --nopidfile --syslog-only &

This can be added to .profile or .bashrc however the IP changes with every WSL restart. Win11 users don't need to worry about setting DISPLAY it's done by wslg.

When lauching google-chrome there are no more dbus errors, just some power daemon related (ignore them) and some extension not being supported:

tux@RIPPER:~$ google-chrome
[1603:1687:0622/090500.809467:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[1603:1687:0622/090500.809580:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[1603:1687:0622/090500.809665:ERROR:object_proxy.cc(623)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[1643:1643:0622/090501.718820:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.

And if you install upower the only error when starting google-chrome is:

tux@RIPPER:~$ google-chrome
[2313:2313:0622/092753.743901:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.

elsaco avatar Jun 22 '22 16:06 elsaco

I am trying to launch vs code installed on wsl ubuntu installed on windows machine .Getting the same error and vs code is unable to start

[18017:0708/124642.570768:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[18017:0708/124642.570908:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
[18017:0708/124642.572659:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[18017:0708/124642.572681:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[18017:0708/124642.628617:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable.
[main 2022-07-08T07:16:42.707Z] [File Watcher (node.js)] Request to start watching: /home/ayusver/.config/Code/User (excludes: <none>, includes: <all>),/home/ayusver/.config/Code/User/settings.json (excludes: <none>, includes: <all>)
[main 2022-07-08T07:16:42.719Z] Sending env to running instance...
[main 2022-07-08T07:16:42.720Z] [File Watcher (node.js)] Started watching: '/home/ayusver/.config/Code/User'
[main 2022-07-08T07:16:42.721Z] [File Watcher (node.js)] Error: ENOENT: no such file or directory, stat '/home/ayusver/.config/Code/User/settings.json'
[main 2022-07-08T07:16:42.827Z] Sent env to running instance. Terminating...
[main 2022-07-08T07:16:42.828Z] Lifecycle#kill()
[main 2022-07-08T07:16:42.828Z] Lifecycle#onWillShutdown.fire()

ayushverma14 avatar Jul 08 '22 07:07 ayushverma14

I am trying to launch cypress from my wsl project :

npx cypress open [2069:0708/111639.476991:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory [2069:0708/111639.477091:ERROR:bus.cc(397)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory [2069:0708/111639.480470:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [2069:0708/111639.480516:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [2069:0708/111639.575912:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable. [2241:0708/111639.606803:ERROR:sandbox_linux.cc(377)] InitializeSandbox() called with multiple threads in process gpu-process. [2241:0708/111639.609824:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported. [2069:0708/111640.314047:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [2069:0708/111640.441276:ERROR:bus.cc(397)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")

StephaneRavet avatar Jul 08 '22 09:07 StephaneRavet

Launching chromium from void linux causes the same behaviour.

[6769:6795:0926/204512.848653:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")

[6769:6795:0926/204512.848734:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")

[6769:6795:0926/204512.848775:ERROR:bus.cc(399)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")

ms0uto avatar Sep 26 '22 18:09 ms0uto

I had this issue and it turned out that SELinux was causing chrome not to be able to access certain things through dbus. (errors were seen in the dbus log noting the selinux/chrome connection) Solutions are to either, add the appropriate selinux permissions to chrome or to disable selinux.

Jester3141 avatar Oct 20 '22 22:10 Jester3141

Is this issue resolved? After installing google-chrome , getting the below issue

image

desaijay315 avatar Oct 21 '22 08:10 desaijay315

I had this issue and it turned out that SELinux was causing chrome not to be able to access certain things through dbus. (errors were seen in the dbus log noting the selinux/chrome connection) Solutions are to either, add the appropriate selinux permissions to chrome or to disable selinux.

@Jester3141 - Ill give this a try

desaijay315 avatar Oct 21 '22 08:10 desaijay315

Cypress now launches correctly after migrating to Windows 11 (which adds WSLg).

StephaneRavet avatar Oct 24 '22 13:10 StephaneRavet

Here are steps to get dbus functionality on Win10/WSL:

- set `DISPLAY` env variable
- start `dbus` service
- set `XDG_RUNTIME_DIR` env variable
- start `dbus` user session

This will fix ERROR:bus.cc(398)] Failed to connect to the bus: Failed to connect to socket /run/user/1000/bus: No such file or directory

Sample run on Win10 and vcxsrv using current WSL endpoint IP address:

- export DISPLAY=172.19.48.1:0
- sudo service dbus start
- export XDG_RUNTIME_DIR=/run/user/$(id -u)
- sudo mkdir $XDG_RUNTIME_USER
- sudo chmod 700 $XDG_RUNTIME_DIR
- sudo chown $(id -un):$(id -gn) $XDG_RUNTIME_DIR
- export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus
- dbus-daemon --session --address=$DBUS_SESSION_BUS_ADDRESS --nofork --nopidfile --syslog-only &

Is line 4 a typo, i.e., should it be sudo mkdir $XDG_RUNTIME_DIR?

sam-mfb avatar Oct 27 '22 18:10 sam-mfb