Skip to content

Cannot run Linux GUI apps in windows: Error: cannot open display: :0 #880

Closed

Description

Windows build number:

Microsoft Windows [Version 10.0.22621.674]

Your Distribution version:

Kali Release: 2022.3

Your WSL versions:

WSL version: 0.70.4.0
Kernel version: 5.15.68.1
WSLg version: 1.0.45
MSRDC version: 1.2.3575
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.674

Steps to reproduce:

Attempt to run a GUI app from WSL.

WSL logs:

pulseaudio.log
stderr.log
weston.log

WSL dumps:

No response

Expected behavior:

I expected GUI apps to open in Windows.

Actual behavior:

It didn't open. Received:

Error: cannot open display: :0

Activity

  1. added
    bug
    on Oct 28, 2022
  2. ajkelsey commented on Oct 28, 2022

    @ajkelsey
    Author

    That's how I wound up here. 😁

    I will say that /tmp/.X11-unix appears to be a hard link and not a soft link. It does not contain X0 either. If I am running Win-KeX, it will show X1.

    drwxrwxrwt 2 root root 40 Oct 28 11:22 .X11-unix

  3. crramirez commented on Oct 28, 2022

    @crramirez
    Contributor

    Win-KeX starts its Xserver, so let's keep it out of the equation.

    your issue looks like this: #844 or #853

    Check the troubleshooting there if you see something in the dumps.

    You can also try a clean Kali installation before running Win-KeX to see if it is creating something in .X11-unix

  4. ajkelsey commented on Oct 28, 2022

    @ajkelsey
    Author

    So #844 appears to be an issue with running multiple distros and systemd. I am running systemd, but only one distro. Plus, it is said to be resolved by a WSL update. I am running the latest version of WSL.

    #853 suggests disabling my display device which I am not going to attempt.

    Do you happen to know how to install a second instance of Kali? It looks like I need a tar ball, but I don't see one offered by Kali.

  5. ajkelsey commented on Oct 29, 2022

    @ajkelsey
    Author

    Ok. I disabled systemd and that was the problem. The lastest WSL did not resolve that issue for me.

  6. crramirez commented on Oct 30, 2022

    @crramirez
    Contributor

    So #844 appears to be an issue with running multiple distros and systemd. I am running systemd, but only one distro. Plus, it is said to be resolved by a WSL update. I am running the latest version of WSL.

    #853 suggests disabling my display device which I am not going to attempt.

    Do you happen to know how to install a second instance of Kali? It looks like I need a tar ball, but I don't see one offered by Kali.

    To install another instance you need to wsl --export ... your current one, and import it again with another name and path.

  7. jimthedj65 commented on Nov 8, 2022

    @jimthedj65

    I upgraded to Windows 11 today and when I activated systemd in wsl ubuntu 20.04 it broke wslg giving an error of cant connect to display:0 and when I disabled it again in my /etc/wsl.conf it worked again. It's been a long day of testing all this as I come from a Linux background and haven't looked at windows in years.

    I will post my setup details in the morning. Thanks to all the many posts I patiently trawled to come to my conclusion 11 hours into my upgrade lol.

  8. jimthedj65 commented on Nov 9, 2022

    @jimthedj65

    James Tervit (@jimthedj65) test with this version: https://github.com/microsoft/WSL/releases/tag/0.70.8

    thanks for the response, I ran the install for 0.70.8 and activated systemd and a slight improvement.

    Nvidia-smi is recognised

    error when running a X session
    [1196:1196:1109/220605.372613:ERROR:ozone_platform_x11.cc(239)] Missing X server or $DISPLAY
    [1196:1196:1109/220605.373167:ERROR:env.cc(255)] The platform failed to initialize. Exiting.

    WSL version: 0.70.8.0
    Kernel version: 5.15.74.2
    WSLg version: 1.0.47
    MSRDC version: 1.2.3575
    Direct3D version: 1.606.4
    DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
    Windows version: 10.0.22623.885

    cat /mnt/wslg/versions.txt
    WSLg ( x86_64 ): 1.0.47+Branch.main.Sha.77aa1e2f49e1253cde9ceb9124ca0873eb3eadf2
    Mariner: VERSION="2.0.20221010"
    DirectX-Headers:
    mesa:
    pulseaudio: 2f0f0b8c3872780f15e275fc12899f4564f01bd5
    FreeRDP: c574044a10003e50453acb4cf42801c5833fb572
    weston: e7e91e17f370702f386c843cf9014cc4bcef4179

    echo $DISPLAY
    :0

    ls -la /tmp/.X11-unix
    total 4
    drwxrwxrwt 2 root root 40 Nov 9 22:09 .
    drwxrwxrwt 27 root root 4096 Nov 9 22:09 ..

    weston.log

    Again when I disable systemd in wsl.conf it works again Ubuntu 22.04

    hope it helps

  9. jimthedj65 commented on Nov 9, 2022

    @jimthedj65

    result after deactivating systemd isan X sessions starts again.
    $ls -la /tmp/.X11-unix/
    total 4
    drwxrwxrwx 2 root root 60 Nov 9 22:16 .
    drwxrwxrwt 27 root root 4096 Nov 9 22:17 ..
    srwxrwxrwx 1 james james 0 Nov 9 22:16 X0

  10. jimthedj65 commented on Nov 10, 2022

    @jimthedj65

    I noticed that inxi -G was showing that I had no renderer installed and decided to rebuild my 21.04 and its now running chrome with hardware acceleration and no longer broken.

    Looks like a few rabbit holes with X breaking here and there.

    OpenGL: renderer: D3D12 (NVIDIA GeForce RTX 3080 Ti) v: 3.3 Mesa 21.2.6 Happy Days

  11. crramirez commented on Nov 10, 2022

    @crramirez
    Contributor

    I noticed that inxi -G was showing that I had no renderer installed and decided to rebuild my 21.04 and its now running chrome with hardware acceleration and no longer broken.

    Looks like a few rabbit holes with X breaking here and there.

    OpenGL: renderer: D3D12 (NVIDIA GeForce RTX 3080 Ti) v: 3.3 Mesa 21.2.6 Happy Days

    What did you rebuild? The kernel? mesa?

  12. ajkelsey commented on Nov 10, 2022

    @ajkelsey
    Author

    No improvement for me with 0.70.8.

  13. jimthedj65 commented on Nov 11, 2022

    @jimthedj65

    I noticed that inxi -G was showing that I had no renderer installed and decided to rebuild my 21.04 and its now running chrome with hardware acceleration and no longer broken.
    Looks like a few rabbit holes with X breaking here and there.
    OpenGL: renderer: D3D12 (NVIDIA GeForce RTX 3080 Ti) v: 3.3 Mesa 21.2.6 Happy Days

    What did you rebuild? The kernel? mesa?

    Hi crramirez,

    I scrubbed everything and went into the Microsoft store and downloaded the Ubuntu 20.04 (removing all other versions) and then carefully looked at all the communication out there between Nvidia, Ubuntu, Microsoft and realised there are a number of conflicts. I think previously I had installed the Nvidia drivers as I wasn't getting the nvidia-smi, then realised on the rebuild that nvidia-smi lived in /usr/lib/wsl/lib etc

    The only issue I now have is google-chrome build is inconsistently picking up hardware acceleration and then defaulting back to software acceleration through chrome://gpu . I think this is a misreport leading to a false - positive and it is actually running (I do get an error output on the screen WARNING: lavapipe is not a conformant vulkan implementation, testing use only.) as my renderer reports ok and glxgears runs fine as well as other apps like audio and 4k youtube playback. I am trying to figure out now if I can get vurtualgl to run and force hardware rendering on glxgears though vglrun glxgears etc.

    hope it helps, I think most of the issues with X and wslg are misunderstandings on what to build and in what sequence.

    Does virtualgl run under WSL ?

  14. 1 remaining item

  15. jimthedj65 commented on Nov 13, 2022

    @jimthedj65

    On the subject of Cuda when running latest ubuntu 22.04 and followng the standard nvidia instructions [https://docs.nvidia.com/cuda/wsl-user-guide/index.html]

    Dockerd runs as in the background (daemon)
    docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark

    NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.

    Error: only 0 Devices available, 1 requested. Exiting.
    when I RUN nvidia-smi dockker build
    docker run -it --gpus=all --rm nvidia/cuda:11.4.2-base-ubuntu20.04 nvidia-smidocker run -it --gpus=all --rm nvidia/cuda:11.4.2-base-ubuntu20.04 nvidia-smi

    Dameon reports
    ERRO[2022-11-13T22:39:04.629102170Z] copy shim log error="read /proc/self/fd/14: file already closed" ERRO[2022-11-13T22:39:04.631153170Z] stream copy error: reading from a closed fifo ERRO[2022-11-13T22:39:04.886924164Z] 751dd3ef0a1bbbdc1c1884e890cf8be249e3064c3053370380b4aea95d7ffeeb cleanup: failed to delete container from containerd: no such container

    when sunning hashcat docker
    docker run -it --gpus=all --rm dizcza/docker-hashcat //bin/bash
    The docker loads but reports an error

    hashcat -b
    hashcat (v6.2.6) starting in benchmark mode

    Benchmarking uses hand-optimized kernel code by default.
    You can use it in your cracking session by setting the -O option.
    Note: Using optimized kernel code limits the maximum supported password length.
    To disable the optimized kernel code in benchmark mode, use the -w option.

    cuInit(): no CUDA-capable device is detected

    clGetPlatformIDs(): CL_PLATFORM_NOT_FOUND_KHR

    ATTENTION! No OpenCL, HIP or CUDA compatible platform found.

    You are probably missing the OpenCL, CUDA or HIP runtime installation.

    • AMD GPUs on Linux require this driver:
      "AMDGPU" (21.50 or later) and "ROCm" (5.0 or later)
    • Intel CPUs require this runtime:
      "OpenCL Runtime for Intel Core and Intel Xeon Processors" (16.1.1 or later)
    • NVIDIA GPUs require this runtime and/or driver (both):
      "NVIDIA Driver" (440.64 or later)
      "CUDA Toolkit" (9.0 or later)

    Started: Sun Nov 13 22:45:02 2022
    Stopped: Sun Nov 13 22:45:02 2022

    nvidia-smi runs fine

    root@eb5bc0c0d375:~# nvidia-smi
    Sun Nov 13 22:45:14 2022
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 525.46 Driver Version: 526.86 CUDA Version: 10.2 |
    |-------------------------------+----------------------+----------------------+
    | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
    | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
    | | | MIG M. |
    |===============================+======================+======================|
    | 0 NVIDIA GeForce ... On | 00000000:01:00.0 On | N/A |
    | 47% 47C P8 20W / 350W | 637MiB / 12288MiB | 0% Default |
    | | | N/A |
    +-------------------------------+----------------------+----------------------+

    +-----------------------------------------------------------------------------+
    | Processes: |
    | GPU GI CI PID Type Process name GPU Memory |
    | ID ID Usage |
    |=============================================================================|
    | 0 N/A N/A 21 G /Xwayland N/A |
    | 0 N/A N/A 32 G /Xwayland N/A |
    +-----------------------------------------------------------------------------+
    root@eb5bc0c0d375:~#

    deviceQuery from the samples runs fine

    ./deviceQuery Starting...

    CUDA Device Query (Runtime API) version (CUDART static linking)

    Detected 1 CUDA Capable device(s)

    Device 0: "NVIDIA GeForce RTX 3080 Ti"
    CUDA Driver Version / Runtime Version 12.0 / 11.8
    CUDA Capability Major/Minor version number: 8.6
    Total amount of global memory: 12288 MBytes (12884377600 bytes)
    (080) Multiprocessors, (128) CUDA Cores/MP: 10240 CUDA Cores
    GPU Max Clock rate: 1695 MHz (1.70 GHz)
    Memory Clock rate: 9501 Mhz
    Memory Bus Width: 384-bit
    L2 Cache Size: 6291456 bytes
    Maximum Texture Dimension Size (x,y,z) 1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
    Maximum Layered 1D Texture Size, (num) layers 1D=(32768), 2048 layers
    Maximum Layered 2D Texture Size, (num) layers 2D=(32768, 32768), 2048 layers
    Total amount of constant memory: 65536 bytes
    Total amount of shared memory per block: 49152 bytes
    Total shared memory per multiprocessor: 102400 bytes
    Total number of registers available per block: 65536
    Warp size: 32
    Maximum number of threads per multiprocessor: 1536
    Maximum number of threads per block: 1024
    Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
    Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
    Maximum memory pitch: 2147483647 bytes
    Texture alignment: 512 bytes
    Concurrent copy and kernel execution: Yes with 1 copy engine(s)
    Run time limit on kernels: Yes
    Integrated GPU sharing Host Memory: No
    Support host page-locked memory mapping: Yes
    Alignment requirement for Surfaces: Yes
    Device has ECC support: Disabled
    Device supports Unified Addressing (UVA): Yes
    Device supports Managed Memory: Yes
    Device supports Compute Preemption: Yes
    Supports Cooperative Kernel Launch: Yes
    Supports MultiDevice Co-op Kernel Launch: No
    Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
    Compute Mode:
    < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >

    deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 12.0, CUDA Runtime Version = 11.8, NumDevs = 1
    Result = PASS

  16. hideyukn88 commented on Nov 17, 2022

    @hideyukn88
    Contributor

    Currently we are investigating X socket doesn't present when systemd is enabled, it is not happening every environment, such as specific distro, but we do observe in various situation, so as workaround, please try workaround mentioneed at microsoft/WSL#9158, or disable systemd if possible. If you are experiencing this issue without systemd enabled (and make sure on the latest WSL 1.0.0.0), please let us know, thanks!

  17. ajkelsey commented on Nov 17, 2022

    @ajkelsey
    Author

    I updated to WSL 1.0. Enabled systemd. Ran the following commands:

    sudo systemd-tmpfiles --boot --create
    sudo ln -sf /mnt/wslg/.X11-unix /tmp/.X11-unix

    This has not resolved my issue. I cannot open Firefox or Wireshark. However, I can open mousepad and mate-calc.

  18. imaginabit commented on Nov 17, 2022

    @imaginabit

    I updated to WSL 1.0. Enabled systemd. Ran the following commands:

    sudo systemd-tmpfiles --boot --create sudo ln -sf /mnt/wslg/.X11-unix /tmp/.X11-unix

    This has not resolved my issue. I cannot open Firefox or Wireshark. However, I can open mousepad and mate-calc.

    Thanks, I can open xeyes and other apps, but can't open Firefox installed via snap, but can open Firefox downloaded from AppImage

    looks like I can't open any app installed with snap

  19. hideyukn88 commented on Nov 18, 2022

    @hideyukn88
    Contributor

    If you are seeing X11 socket connection issue on Ubuntu, with systemd enabled, please check if gdm service is installed and running by systemctl -t service | grep gdm.service, please let us know, thanks!

  20. crramirez commented on Nov 18, 2022

    @crramirez
    Contributor

    Hideyuki Nagase (@hideyukn88) this means that it should or should not be installed and running?

  21. hideyukn88 commented on Nov 18, 2022

    @hideyukn88
    Contributor

    Carlos Rafael Ramirez (@crramirez), gdm.service is automatically installed when certain GNOME software is installed, and currently we are thinking this is conflicting with WSLg. Thus, if the service is running, please disable it by sudo systemctl disable gdm.service, then restart WSL. This should restore X connection by WSLg, thanks!

  22. rye2020 commented on Nov 19, 2022

    @rye2020
  23. jnusbaum commented on Nov 23, 2022

    @jnusbaum

    Carlos Rafael Ramirez (@crramirez), gdm.service is automatically installed when certain GNOME software is installed, and currently we are thinking this is conflicting with WSLg. Thus, if the service is running, please disable it by sudo systemctl disable gdm.service, then restart WSL. This should restore X connection by WSLg, thanks!

    Just a note that this worked for me.

  24. kasvith commented on Dec 3, 2022

    @kasvith

    Im having similar problem

    when i do ls /mnt i dont see wslg directory

  25. ajkelsey commented on Dec 23, 2022

    @ajkelsey
    Author

    Problem has been resolved with the latest WSL upgrade. I have enabled systemd and all appears to be functioning.

    WSL version: 1.0.3.0
    Kernel version: 5.15.79.1
    WSLg version: 1.0.47
    MSRDC version: 1.2.3575
    Direct3D version: 1.606.4
    DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
    Windows version: 10.0.22621.963

  26. kasvith commented on Dec 23, 2022

    @kasvith

    Problem has been resolved with the latest WSL upgrade. I have enabled systemd and all appears to be functioning.

    WSL version: 1.0.3.0 Kernel version: 5.15.79.1 WSLg version: 1.0.47 MSRDC version: 1.2.3575 Direct3D version: 1.606.4 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22621.963

    I also solved it the same way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions