Skip to content

Instantly share code, notes, and snippets.

@remlapmot
Created March 1, 2020 11:09
Show Gist options
  • Save remlapmot/5112cd5d032987d08de79863791bd0db to your computer and use it in GitHub Desktop.
Save remlapmot/5112cd5d032987d08de79863791bd0db to your computer and use it in GitHub Desktop.
XLaunch config file for X11 forwarding from Windows Subsystem for Linux. Run with VcXsrv for best results.
<?xml version="1.0" encoding="UTF-8"?>
<XLaunch WindowMode="MultiWindow" ClientMode="NoClient" LocalClient="False" Display="-1" LocalProgram="xcalc" RemoteProgram="xterm" RemotePassword="" PrivateKey="" RemoteHost="" RemoteUser="" XDMCPHost="" XDMCPBroadcast="False" XDMCPIndirect="False" Clipboard="True" ClipboardPrimary="True" ExtraParams="-ac" Wgl="True" DisableAC="False" XDMCPTerminate="False"/>
@remlapmot
Copy link
Author

remlapmot commented Mar 1, 2020

  • Download and install VcxSrv from https://sourceforge.net/projects/vcxsrv/
    • Note this XLaunch config is simply the default settings with additional parameters -ac
  • Note: I have only tested this under Ubuntu 18.04.4 LTS (bionic).
  • Under WSL 1
    • As per instructions here in your ~/.bashrc set (edit this with vi with sudo vi ~/.bashrc)
      export DISPLAY=localhost:0.0
      
      Then re-read in .bashrc with source ~/.bashrc
  • Under WSL 2
    • As per instructions here in your ~/.bashrc set
      export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'):0.0
      
    • And if you have replaced the SSH server as per the instructions here create /etc/ssh/sshd_config with the following settings.
      Port 222
      X11Forwarding yes
      X11DisplayOffset 10
      
  • Save in %appdata%\Microsoft\Windows\Start Menu\Programs\Startup to have this launched at login.
  • libGL error: If when you launch a graphical app from the Ubuntu Terminal you see an error as follows:
    libGL error: No matching fbConfigs or visuals found
    libGL error: failed to load driver: swrast
    
    this is fixed by installing Ubuntu Desktop as per the advice here as follows.
    sudo apt install ubuntu-desktop mesa-utils
    

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