Skip to content

No output from ls /tmp/.X11-unix when multiple Linux distro are installed #844

Open

Description

@zzehli

Windows build number:

Microsoft Windows [Version 10.0.22000.978]

Your Distribution version:

Ubuntu 18.04

Your WSL versions:

WSL version: 0.66.2.0
Kernel version: 5.15.57.1
WSLg version: 1.0.42
MSRDC version: 1.2.3401
Direct3D version: 1.606.4
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22000.978

Steps to reproduce:

Unable to open GUI softwares.

$ xcalc
Error: Can't open display: :0

Tried to solve the problem by following the steps outlined here, but no success.

WSL logs:

weston.log
stderr.log
pulseaudio.log

WSL dumps:

No response

Expected behavior:

The ls /tmp/.X11-unix should output X0

Actual behavior:

It output nothing.

$ echo $DISPLAY
:0
$ ls -la /tmp/.X11-unix
total 4
drwxrwxrwx 2 root root   60 Sep 26 17:14 .
drwxrwxrwt 3 root root 4096 Sep 26 17:17 ..
lrwxrwxrwx 1 jae  jae    19 Sep 26 17:14 .X11-unix -> /mnt/wslg/.X11-unix
$ ls /tmp/.X11-unix
$

Activity

  1. added
    bug
    on Sep 26, 2022
  2. zzehli commented on Sep 28, 2022

    @zzehli
    Author

    I have both Ubuntu 20 and 18 installed on my wsl2. Ubuntu 20 has no problem opening GUI apps, only 18 has problem. For now I am using VcXsrv to open GUIs on Ubuntu 18.

  3. oleksis commented on Sep 29, 2022

    @oleksis

    I wrote about this issue, having the same behaviour: X server display socket is being deleted

  4. oleksis commented on Oct 2, 2022

    @oleksis

    ✅ Update the sequence of steps and resolve this issue: Init /tmp/.X11-unix is overwritten by mounts

  5. hideyukn88 commented on Oct 12, 2022

    @hideyukn88
    Contributor

    Please update to WSL 0.70.0 by wsl --update, and check if this still occurs, we have addressed several X connection issues in this release, thanks!

  6. oleksis commented on Oct 13, 2022

    @oleksis

    I have updated and the issue continues

    ➜ wsl --version
    WSL version: 0.70.0.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.25211.1001
    ➜ ls -la /tmp/.X11-unix/
    total 24
    drwxrwxrwt  2 root root    40 Oct 13 04:49 .
    drwxrwxrwt 14 root root 20480 Oct 13 04:49 ..

    PD: Make this test removing sudo mv /etc/tmpfiles.d/wslg.conf ~ from the previous solution with WSL version 0.68.2.0

  7. hideyukn88 commented on Oct 13, 2022

    @hideyukn88
    Contributor

    Oleksis Fraga Menéndez (@oleksis), thanks for trying out, WSL 0.70.0 contains the fix for the issue like Jae (@zzehli) mentioned at #844 (comment) where multiple distros are installed, and one distro is working but other is not. But there is still some having missing X11-Unix socket issue after update to 0.70.0 like #853, I will continue to look into such issue, thanks!

  8. changed the title [-]No output from `ls /tmp/.X11-unix`[/-] [+]No output from `ls /tmp/.X11-unix` when multiple Linux distro are installed[/+] on Oct 13, 2022
  9. oleksis commented on Nov 16, 2022

    @oleksis

    Just update to wsl v1.0.0 from the web options and after few minutes the problem repeat. This time i fix like before. All the steps for Update to WSL v1.0.0

  10. hideyukn88 commented on Nov 16, 2022

    @hideyukn88
    Contributor

    Oleksis Fraga Menéndez (@oleksis), do you have systemd enabled? thanks!

  11. imaginabit commented on Nov 17, 2022

    @imaginabit

    I have the same problem with systemd enabled, All worked until update wsl, I have systemd enabled

    PS C:\Users\fernando.ramirez> wsl --version
    Versión de WSL: 1.0.0.0
    Versión de kernel: 5.15.74.2
    Versión de WSLg: 1.0.47
    Versión de MSRDC: 1.2.3575
    Versión de Direct3D: 1.606.4
    Versión DXCore: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
    Versión de Windows: 10.0.22621.819

    :~$ ls -la /tmp/.X11-unix/
    total 52
    drwxrwxrwt 2 root root 40 Nov 17 03:06 .
    drwxrwxrwt 14 root root 49152 Nov 17 03:09 ..

    :~$ ls -la /wslg/.X11-unix/
    total 0
    drwxrwxrwt 2 root root 40 Nov 17 03:06 .
    drwxrwxrwt 7 root root 300 Nov 17 03:06 ..

    I try editing /etc/tmpfiles.d/wslg.conf with

    #  This file is part of the debianisation of systemd.
    #
    #  systemd is free software; you can redistribute it and/or modify it
    #  under the terms of the GNU General Public License as published by
    #  the Free Software Foundation; either version 2 of the License, or
    #  (at your option) any later version.
    
    # See tmpfiles.d(5) for details
    
    # Type Path           Mode UID  GID  Age Argument
    L+     /tmp/.X11-unix -    -    -    -   /wslg/.X11-unix
    

    change /mnt/wslg for /wslg , in my system /mnt/wslg exist but is empty ,

    didn't solve it

  12. oleksis commented on Nov 17, 2022

    @oleksis

    Oleksis Fraga Menéndez (@oleksis), do you have systemd enabled? thanks!

    Systemd is enable by default. I thinks I have enabled. How verify?

  13. imaginabit commented on Nov 17, 2022

    @imaginabit

    Systemd is enable by default. I thinks I have enabled. How verify?

    you have to enable it on /etc/wsl.conf

    cat /etc/wsl.conf
    [boot]
    systemd=true
    # Automatically mount Windows drive when the distribution is launched
    [automount]
    # Set to true will automount fixed drives (C:/ or D:/) with DrvFs under the root directory set above. Set to false means drives won't be mounted automatically, but need to be mounted manually or with fstab.
    enabled = true
    # Sets the directory where fixed drives will be automatically mounted. This example changes the mount location, so your C-drive would be /c, rather than the default /mnt/c.
    root = /
    
  14. imaginabit commented on Nov 17, 2022

    @imaginabit

    Ok now works for me

    • I remove the [automount] lines in my /etc/wsl.conf
    • remove /etc/tmpfiles.d/wslg.conf
    • umount /tmp/.X11-unix
    • sudo rmdir /tmp/.X11-unix
    • wls --shutdown
    • execute
      sudo systemd-tmpfiles --boot --create
      sudo ln -sf /mnt/wslg/.X11-unix /tmp/.X11-unix

    ( see ajkelsey comment #880 (comment) )
    and now :
    xeyes -> works
    firefox ( from snap ) ->Error: cannot open display: :0
    firefox ( from Appimage file ) -> works

  15. hideyukn88 commented on Nov 18, 2022

    @hideyukn88
    Contributor

    Fernando (@imaginabit), would you please check if gdm.service is running on your system by systemctl -t service | grep gdm ? thanks!

  16. oleksis commented on Nov 18, 2022

    @oleksis

    Here my WSL2 configuration

    ➜ cat /etc/wsl.conf
    [boot]
    systemd=true
    
    ➜ systemctl -t service | grep gdm
      gdm.service                          loaded active running GNOME Display Manager
  17. oleksis commented on Nov 20, 2022

    @oleksis

    With the gdm service active and the last steps, all keep working. Using Docker 4.14.1 and WSL2

    ➜ wsl.exe --version
    WSL version: 1.0.0.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.25236.1010
    
    ➜ ls -la /tmp/.X11-unix/
    total 0
    drwxrwxrwx 2 root    root     60 Nov 19 21:25 .
    drwxrwxrwt 7 root    root    300 Nov 19 21:25 ..
    srwxrwxrwx 1 oleksis oleksis   0 Nov 19 21:25 X0
    
    ➜ systemctl -t service | grep gdm
      gdm.service                          loaded active running GNOME Display Manager
  18. oleksis commented on Nov 23, 2022

    @oleksis

    Testing in Windows 10 22H2 (OS Build 19045.2311)

    C:\>ver
    
    Microsoft Windows [Version 10.0.19045.2311]
    
    C:\>wsl --version
    Versión de WSL: 1.0.1.0
    Versión de kernel: 5.15.74.2
    Versión de WSLg: 1.0.47
    Versión de MSRDC: 1.2.3575
    Versión de Direct3D: 1.606.4
    Versión DXCore: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
    Versión de Windows: 10.0.19045.2311
    
    C:\>wsl -l -v
      NAME                   STATE           VERSION
    * Ubuntu                 Running         2
      docker-desktop-data    Stopped         2
      docker-desktop         Stopped         2

    Default distro Ububtu

    ➜ ll /tmp/.X11-unix/
    total 4
    drwxrwxrwx  2 root    root      60 Nov 22 19:30 ./
    drwxrwxrwt 15 root    root    4096 Nov 22 20:55 ../
    srwxrwxrwx  1 oleksis oleksis    0 Nov 22 19:30 X0=
    
    ➜ cat /etc/wsl.conf
    [boot]
    systemd=true
    
    ➜ systemctl -t service | grep gdm
      gdm.service                          loaded active     running       GNOME Display Manager

    Note the socket name add the equal sign in the name X0=

  19. Masamune3210 commented on Nov 23, 2022

    @Masamune3210

    did you mean to do ll instead of ls?

  20. AlphaScorpii-dev commented on Nov 25, 2022

    @AlphaScorpii-dev

    I have 3 distributions installed right now (Debian / Ubuntu / openSUSE Tumbleweed).
    Both Debian and Ubuntu are working, the openSUSE is the one that breaks after an initial update (works after a fresh install, not after a zypper dup)
    For some reason, /tmp won't be populated with the entries listed in usr/lib/tmpfiles.d/x11.conf

  21. imaginabit commented on Nov 28, 2022

    @imaginabit

    Fernando (@imaginabit), would you please check if gdm.service is running on your system by systemctl -t service | grep gdm ? thanks!

     systemctl -t service | grep gdm
     gdm.service                                            loaded active running GNOME Display Manager
    

    when I stop the service with systemctl stop gdm.service and try to execute firefox ,get again

    Error: cannot open display: :0

    sudo systemctl disable gdm.service 
    

    and

    wsl --shutdown
    

    and again get display error but also

    :~$ firefox
    update.go:85: cannot change mount namespace according to change mount (/var/lib/snapd/hostfs/tmp/.X11-unix /tmp/.X11-unix none bind,ro 0 0): cannot use "/var/lib/snapd/hostfs/tmp/.X11-unix" as bind-mount source: not a directory
    update.go:85: cannot change mount namespace according to change mount (/var/lib/snapd/hostfs/usr/share/gimp/2.0/help /usr/share/gimp/2.0/help none bind,ro 0 0): cannot write to "/var/lib/snapd/hostfs/usr/share/gimp/2.0/help" because it would affect the host in "/var/lib/snapd"
    update.go:85: cannot change mount namespace according to change mount (/var/lib/snapd/hostfs/usr/share/xubuntu-docs /usr/share/xubuntu-docs none bind,ro 0 0): cannot write to "/var/lib/snapd/hostfs/usr/share/xubuntu-docs" because it would affect the host in "/var/lib/snapd"
    Error: cannot open display: :0

    remove firefox and install it again with

    snap remove firefox
    
    # in other terminal 
    snap install firefox
    

    and now I get the same Error: cannot open display: :0 again without the other messages

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