Skip to content

GUI not working with WSL2 + Ubuntu 24.10 #1303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 2 tasks
Grufoony opened this issue Jan 21, 2025 · 12 comments
Open
1 of 2 tasks

GUI not working with WSL2 + Ubuntu 24.10 #1303

Grufoony opened this issue Jan 21, 2025 · 12 comments

Comments

@Grufoony
Copy link

Grufoony commented Jan 21, 2025

Windows Version

Version 10.0.26100.2894

WSL Version

2.3.26.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

No response

Distro Version

Ubuntu 24.10

Other Software

No response

Repro Steps

After upgrading from Ubuntu 24.04 to Ubuntu 24.10, GUI stopped working.
In python as example I get:

Traceback (most recent call last):
  File "/home/grufoony/DynamicalSystemFramework/utils/get_osm_data.py", line 118, in <module>
    ox.plot_graph(GRAPH, show=False, close=True, save=True, filepath="./original.png")
  File "/home/grufoony/.local/lib/python3.12/site-packages/osmnx/plot.py", line 251, in plot_graph
    fig, ax = _get_fig_ax(ax=ax, figsize=figsize, bgcolor=bgcolor, polar=False)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/grufoony/.local/lib/python3.12/site-packages/osmnx/plot.py", line 1045, in _get_fig_ax
    fig, ax = plt.subplots(figsize=figsize, facecolor=bgcolor, frameon=False)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/grufoony/.local/lib/python3.12/site-packages/matplotlib/pyplot.py", line 1775, in subplots
    fig = figure(**fig_kw)
          ^^^^^^^^^^^^^^^^
  File "/home/grufoony/.local/lib/python3.12/site-packages/matplotlib/pyplot.py", line 1042, in figure
    manager = new_figure_manager(
              ^^^^^^^^^^^^^^^^^^^
  File "/home/grufoony/.local/lib/python3.12/site-packages/matplotlib/pyplot.py", line 552, in new_figure_manager
    return _get_backend_mod().new_figure_manager(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/grufoony/.local/lib/python3.12/site-packages/matplotlib/backend_bases.py", line 3501, in new_figure_manager
    return cls.new_figure_manager_given_figure(num, fig)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/grufoony/.local/lib/python3.12/site-packages/matplotlib/backend_bases.py", line 3506, in new_figure_manager_given_figure
    return cls.FigureCanvas.new_manager(figure, num)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/grufoony/.local/lib/python3.12/site-packages/matplotlib/backend_bases.py", line 1783, in new_manager
    return cls.manager_class.create_with_canvas(cls, figure, num)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/grufoony/.local/lib/python3.12/site-packages/matplotlib/backends/_backend_tk.py", line 507, in create_with_canvas
    window = tk.Tk(className="matplotlib")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/tkinter/__init__.py", line 2349, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: couldn't connect to display ":0"

Expected Behavior

Correctly opening the figure

Actual Behavior

Error

Diagnostic Logs

WslLogs-2025-01-21_12-45-09.zip

Copy link

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@Grufoony
Copy link
Author

Grufoony commented Jan 21, 2025

EDIT: restarting the machine (not the WSL but the entire machine) I get the command xeyes working one time only. From the second exectution the error appears again

grufoony@Grufoony:~$ xeyes
grufoony@Grufoony:~$ xeyes
Error: Can't open display: :0
grufoony@Grufoony:~$

EDIT2: it seems to work more than one time (also restarting wsl) but for a limited amount time... it seems pretty random at the moment

Copy link

Diagnostic information
Issue was edited and new log file was found: https://github.com/user-attachments/files/18489928/WslLogs-2025-01-21_12-45-09.zip
Detected appx version: 2.3.26.0

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 21, 2025

Thank you for reporting this @Grufoony. I wonder if there's an issue with X. Could you share the output of echo $DISPLAY when you see that error ?

@Grufoony
Copy link
Author

Here it is:

grufoony@Grufoony:~$ echo $DISPLAY
:0

@OneBlue
Copy link
Collaborator

OneBlue commented Jan 21, 2025

Ok thank you, this looks correct. Transferring to wslg to investigate further

@OneBlue OneBlue transferred this issue from microsoft/WSL Jan 21, 2025
@Lucent
Copy link

Lucent commented Feb 10, 2025

I can confirm this issue on 5.15.167.4-microsoft-standard-WSL2 on WSL 2.4.10 after upgrade to 24.10 and that graphics was previously working before the upgrade. Using mirrored networking and Windows 11 24H2 (26100.3037).

@davidscholberg
Copy link

I am experiencing this as well after upgrading to Ubuntu 24.10 under WSL2. xclip will work fine directly after a windows reboot but then randomly stop working with the following error message:

$ date | xclip
Error: Can't open display: :0

@nardholio
Copy link

nardholio commented Mar 15, 2025

on 25.04 x11 apps not working but I can get Wayland (pretty much everything else) to work with the following commands

openssl genrsa -out ~/.weston-rdp-key.pem 2048 openssl req -new -x509 -key ~/.weston-rdp-key.pem -out ~/.weston-rdp-cert.pem -days 365 -subj "/CN=WestonRDP" /usr/bin/weston --backend=rdp-backend.so --socket=wayland-0 --xwayland --rdp-tls-cert=~/.weston-rdp-cert.pem --rdp-tls-key=~/.weston-rdp-key.pem --shell=desktop-shell.so & /usr/libexec/Xwayland :0 -listen unix & export XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir export WAYLAND_DISPLAY=wayland-0 export DISPLAY=:0 export QT_QPA_PLATFORM=wayland

WSL isn't creating the environment for Ubuntu to start Wayland properly for some reason but I have no idea why.

@erreing
Copy link

erreing commented Mar 30, 2025

seems like just setting up export XDG_RUNTIME_DIR=/mnt/wslg/runtime-dir works for wayland apps (it takes some time but it loads), this could be related to #57 (comment)

@ParadoxV5
Copy link

ParadoxV5 commented Apr 22, 2025

Microsoft gotta give this more attention now that many people are facing this issue or similar:


For me, after a wild goose chase, I found (with surprise) that the culprit is #43:

Ubuntu now ships upstream systemd’s tmp.mount by default. In effect this means that /tmp is now a tmpfs by default.
Ubuntu 24.10 release notes

$ mount | grep '/tmp'
none on /tmp/.X11-unix type tmpfs (ro,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,nr_inodes=1048576)

@Gabrielcarvfer
Copy link

I found the fix in another thread

sudo rm -r /tmp/.X11-unix && ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix
ln -sf /mnt/wslg/runtime-dir/wayland* /run/user/`id -u`/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants