Skip to content
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

runx does not detect WSL2 #2

Closed
Jawabiscuit opened this issue Jan 10, 2020 · 26 comments
Closed

runx does not detect WSL2 #2

Jawabiscuit opened this issue Jan 10, 2020 · 26 comments

Comments

@Jawabiscuit
Copy link

Jawabiscuit commented Jan 10, 2020

I get this error after I followed your instructions on the README. I'm running runx in a WSL2 in Windows Terminal. Running other GUI programs: startlxde or emacs work without using runx.

$ runx
runx ERROR: runx is designed to run on MS Windows in WSL, Cygwin or MSYS2.
  Did not detect WSL, Cygwin or MSYS2.

Windows systeminfo

Host Name:                 VREXTON
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.19035 N/A Build 19035
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Workstation
OS Build Type:             Multiprocessor Free
Registered Owner:          Windows User
Registered Organization:
Product ID:                00330-80000-00000-AA894
Original Install Date:     1/5/2020, 3:30:21 PM
System Boot Time:          1/5/2020, 6:22:15 PM
System Manufacturer:       System manufacturer
System Model:              System Product Name
System Type:               x64-based PC
Processor(s):              1 Processor(s) Installed.
                           [01]: Intel64 Family 6 Model 94 Stepping 3 GenuineIntel ~3504 Mhz
BIOS Version:              American Megatrends Inc. 3007, 11/29/2016
Windows Directory:         C:\WINDOWS
System Directory:          C:\WINDOWS\system32
Boot Device:               \Device\HarddiskVolume3
System Locale:             en-us;English (United States)
Input Locale:              en-us;English (United States)
Time Zone:                 (UTC-05:00) Eastern Time (US & Canada)
Total Physical Memory:     32,707 MB
Available Physical Memory: 19,122 MB
Virtual Memory: Max Size:  57,283 MB
Virtual Memory: Available: 40,712 MB
Virtual Memory: In Use:    16,571 MB
Page File Location(s):     C:\pagefile.sys
Domain:                    WORKGROUP
Logon Server:              \\VREXTON
Hotfix(s):                 N/A
Network Card(s): (...)
Hyper-V Requirements:      A hypervisor has been detected. Features required for Hyper-V will not be displayed.

Subsystem

Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:        18.04
Codename:       bionic

VcXsrv

VcXsrv X Server
Version "1.20.5.1" (27 Jul 2019)

XWin

$ startxwin

Welcome to the XWin X Server
Vendor: The Cygwin/X Project
Release: 1.20.5.0
OS: CYGWIN_NT-10.0-19035 vrexton 3.1.2-340.x86_64 2019-12-21 15:25 UTC x86_64
OS: Windows 10  [Windows NT 10.0 build 19035] (Win64)
Package: version 1.20.5-3 built 2019-09-06

XWin was started with the following command line:

/usr/bin/XWin :0 -multiwindow -auth /home/Jonas/.serverauth.1386

(II) xorg.conf is not supported
(II) See http://x.cygwin.com/docs/faq/cygwin-x-faq.html for more information
LoadPreferences: /home/Jonas/.XWinrc not found
LoadPreferences: Loading /etc/X11/system.XWinrc
LoadPreferences: Done parsing the configuration file...
winDetectSupportedEngines - RemoteSession: no
winDetectSupportedEngines - DirectDraw4 installed, allowing ShadowDDNL
winDetectSupportedEngines - Returning, supported engines 00000005
winSetEngine - Multi Window or Rootless => ShadowGDI
winScreenInit - Using Windows display depth of 32 bits per pixel
winAllocateFBShadowGDI - Creating DIB with width: 3000 height: 1920 depth: 32
winFinishScreenInitFB - Masks: 00ff0000 0000ff00 000000ff
winInitVisualsShadowGDI - Masks 00ff0000 0000ff00 000000ff BPRGB 8 d 24 bpp 32
MIT-SHM extension disabled due to lack of kernel support
XFree86-Bigfont extension local-client optimization disabled due to lack of shared memory support in the kernel
glWinSelectGLimplementation: Loaded 'cygnativeGLthunk.dll'
(II) AIGLX: Testing pixelFormatIndex 5
GL_VERSION:     4.6.0 NVIDIA 436.48
GL_VENDOR:      NVIDIA Corporation
GL_RENDERER:    GeForce GTX 1070/PCIe/SSE2
(II) GLX: enabled GLX_SGI_make_current_read
(II) GLX: enabled GLX_SGI_swap_control
(II) GLX: enabled GLX_MESA_swap_control
(II) GLX: enabled GLX_SGIX_pbuffer
(II) GLX: enabled GLX_ARB_multisample
(II) GLX: enabled GLX_SGIS_multisample
(II) GLX: enabled GLX_ARB_fbconfig_float
(II) GLX: enabled GLX_EXT_fbconfig_packed_float
(II) GLX: enabled GLX_ARB_create_context
(II) GLX: enabled GLX_ARB_create_context_profile
(II) GLX: enabled GLX_ARB_create_context_robustness
(II) GLX: enabled GLX_EXT_create_context_es2_profile
(II) AIGLX: enabled GLX_MESA_copy_sub_buffer
(II) 670 pixel formats reported by wglGetPixelFormatAttribivARB
(II) 634 fbConfigs
(II) ignored pixel formats: 0 not OpenGL, 0 unknown pixel type, 36 unaccelerated
(II) GLX: Initialized Win32 native WGL GL provider for screen 0
winPointerWarpCursor - Discarding first warp: 1500 960
(--) 16 mouse buttons found
(--) Setting autorepeat to delay=500, rate=31
(--) Windows keyboard layout: "00000409" (00000409) "US", type 4
(--) Found matching XKB configuration "English (USA)"
(--) Model = "pc105" Layout = "us" Variant = "none" Options = "none"
Rules = "base" Model = "pc105" Layout = "us" Variant = "none" Options = "none"
winInitMultiWindowWM - DISPLAY=:0.0
winMultiWindowXMsgProc - DISPLAY=:0.0
winInitMultiWindowWM - xcb_connect () returned and successfully opened the display.
winClipboardThreadProc - DISPLAY=:0.0
winProcEstablishConnection - winInitClipboard returned.
winMultiWindowXMsgProc - xcb_connect() returned and successfully opened the display.
winClipboardProc - xcb_connect () returned and successfully opened the display.
Using Composite redirection

@eine
Copy link

eine commented Jan 10, 2020

Running other GUI programs: startlxde or emacs work without using runx.

Do you mean after executing vcxsrv or xwin manually? Or is built-in X support available in WSL2?

@mviereck
Copy link
Owner

mviereck commented Jan 10, 2020

Thank you for the report!

So far I have no experience with WSL2.
Unfortunately I cannot test it myself because I have Windows in a VM only. Hyper-V is needed for WSL2 and does not work in the VM. So I depend on some information of you.


Probably runx would work in WSL2 if it could recognice it. Do you know how a linux program can detect WSL2?
WSL is checked with uname -r:

  uname -r | grep -q Microsoft                    && Winsubsystem="WSL"

Could you show me uname -a in WSL2?


Is the WSL2 file system accessible in Windows? E.g. somewhere visible in the file explorer? (WSL1 is somewhat hidden, but detectable). If not, runx could not provide cookie authentication and would run with --no-auth only.
With some luck the same trickery as for WSL1 will work in WSL2, too.


Are the Windows partitions still mounted as /c or /d like in WSL1?


Running other GUI programs: startlxde or emacs work without using runx.

That is quite interesting. Did you do some setup for this? If not, can you please show me the output of:

echo $DISPLAY
echo $XAUTHORITY
ls -l /tmp/.X11-unix
ps aux | grep X

@Jawabiscuit
Copy link
Author

Jawabiscuit commented Jan 11, 2020

My pleasure, happy to help!

Running other GUI programs: startlxde or emacs work without using runx.

Do you mean after executing vcxsrv or xwin manually? Or is built-in X support available in WSL2?

Yes

uname -r | grep -q Microsoft && Winsubsystem="WSL"

That works

Are the Windows partitions still mounted as /c or /d like in WSL1?

Yes

That is quite interesting. Did you do some setup for this? If not, can you please show me the output of:

This is how I need to set the display on WSL2 for it to work:
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0

172.26.64.1:0

There is essentially no output for any of the other commands.

My wsl.conf:

[automount]
enabled = true
mountFsTab = true
root = /
options = "metadata"

# Enable DNS  even though these are turned on by default, we ll specify here just to be explicit.     [network]
# Generate /etc/hosts, a static map of hostnames and their IP addresses
generateHosts = true
# Generate /etc/resolve.conf, to resolve hostname to its IP address
generateResolvConf = true

# [interop]
# Setting this key will determine whether WSL will suport launching Windows processes
# enabled = true
# WSL will add Windows path elements to the $PATH environment variable
# appendWindowsPath = true

Windows cmd.exe command I used to launch vcxsrv, the -ac is important to allow public connections with WSL2.

"C:\Program Files\VcXsrv\vcxsrv.exe" :0 -multiwindow -clipboard -wgl -ac

@eine
Copy link

eine commented Jan 11, 2020

Do you mean after executing vcxsrv or xwin manually? Or is built-in X support available in WSL2?

Yes

Is that an answer to the first question or the second?

@Jawabiscuit
Copy link
Author

Jawabiscuit commented Jan 11, 2020 via email

@mviereck
Copy link
Owner

My pleasure, happy to help!

Great!

uname -r | grep -q Microsoft && Winsubsystem="WSL"

That works

That's odd. In that case WSL would be detected and the reported error message should not appear:

runx ERROR: runx is designed to run on MS Windows in WSL, Cygwin or MSYS2.
Did not detect WSL, Cygwin or MSYS2.

Could you please show me the output of:

uname -a

?

@Jawabiscuit
Copy link
Author

Linux vrexton 4.19.84-microsoft-standard #1 SMP Wed Nov 13 11:44:37 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

mviereck added a commit that referenced this issue Jan 11, 2020
@mviereck
Copy link
Owner

Thanks. Ok, WSL2 shows microsoft while WSL1 shows Microsoft.
I've uploaded a new commit that detects both variations.
Could you please update and check again?
If it fails, please also try with --no-auth.

@Jawabiscuit
Copy link
Author

Jawabiscuit commented Jan 11, 2020

jonas@vrexton:~/runx$ runx --verbose --no-auth -- emacs
runx note: Script is being sourced yes/no: no

runx note: Host IP adress: 10.0.75.1

runx note: Found X servers:



runx ERROR: No X server found.
  Please either install X server VcXsrv:
      https://sourceforge.net/projects/vcxsrv
  or install Cygwin with packages xinit and xauth to provide XWin:
      https://www.cygwin.com/

runx note: Exitcode: 1

runx note: Exitcode: 0

jonas@vrexton:~/runx$ cat /etc/resolv.conf | grep nameserver | awk '{print $2}'
172.26.64.1

jonas@vrexton:~/runx$ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:4dff:fef2:b816  prefixlen 64  scopeid 0x20<link>
        ether 02:42:4d:f2:b8:16  txqueuelen 0  (Ethernet)
        RX packets 6850  bytes 4154356 (4.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8574  bytes 3947181 (3.9 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.26.67.7  netmask 255.255.240.0  broadcast 172.26.79.255
        inet6 fe80::215:5dff:fe76:6f0a  prefixlen 64  scopeid 0x20<link>
        ether 00:15:5d:76:6f:0a  txqueuelen 1000  (Ethernet)
        RX packets 517666  bytes 717716770 (717.7 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 127350  bytes 20612603 (20.6 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 6  bytes 300 (300.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6  bytes 300 (300.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

You are using ipconfig.exe, maybe check that?

@mviereck
Copy link
Owner

mviereck commented Jan 11, 2020

It seems runx does not detect vcxsrv.exe.
Can you show me:

echo $PATH
ls -l /c
ls -l "/c/Program Files/VcXsrv/vcxsrv.exe"
ls -l "/c/Program\ Files/VcXsrv/vcxsrv.exe"

How/Where did you install VcXsrv?
Is it somewhere different than ls -l "C:/Program Files/VcXsrv/vcxsrv.exe"?

You are using ipconfig.exe, maybe check that?

runx/ipconfig.exe found the IP of the Windows docker daemon 10.0.75.1. That should be ok.

@Jawabiscuit
Copy link
Author

jonas@vrexton:/c/Users/Jonas$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/c/ProgramData/DockerDesktop/version-bin:/c/Program Files/Docker/Docker/resources/bin:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.0/bin:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.0/libnvvp:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1/bin:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1/libnvvp:/c/Windows:/c/Windows/System32:/c/Windows/System32/wbem:/c/Windows:/c/Windows/System32:/c/Windows/System32/wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/c/Program Files/Microsoft MPI/Bin/:/c/ProgramData/Oracle/Java/javapath:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Program Files/MATLAB/R2016b/bin:/c/Program Files/Geth:/c/Program Files/dotnet/:/c/Program Files/Microsoft SQL Server/130/Tools/Binn/:/c/Program Files/PostgreSQL/10/bin:/c/Program Files (x86)/GnuPG/bin:/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit/:/c/Program Files/nodejs/:/c/Program Files (x86)/Yarn/bin:/c/Users/Jonas/Anaconda3:/c/Users/Jonas/Anaconda3/Scripts:/c/cudnn-9.0-windows10-x64-v7/cuda/bin:/c/Program Files (x86)/Calibre2/:/c/Program Files/Git/cmd:/c/Program Files/MiKTeX 2.9/miktex/bin/x64/:/c/Program Files/apache-ant-1.10.5/bin:/c/Program Files (x86)/Pico Technology/PicoScope6/:/c/Program Files/Git LFS:/c/Windows/System32/OpenSSH/:/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/c/Windows/System32:/c/Windows:/c/Windows/System32/wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/c/Windows/System32/OpenSSH/:/c/Users/Jonas/AppData/Local/Microsoft/WindowsApps:/c/Users/Jonas/AppData/Roaming/npm:/c/Users/Jonas/AppData/Local/Yarn/bin:/c/Users/Jonas/AppData/Local/Pandoc/:/snap/bin
jonas@vrexton:/c/Users/Jonas$ ls -l /c
ls: /c/DumpStack.log: Permission denied
ls: cannot access '/c/DumpStack.log.tmp': Permission denied
ls: cannot access '/c/hiberfil.sys': Permission denied
ls: cannot access '/c/pagefile.sys': Permission denied
ls: cannot access '/c/swapfile.sys': Permission denied
ls: '/c/System Volume Information': Permission denied
total 396
drwxrwxrwx 1 jonas jonas    512 Apr  1  2018  82ace7d6-0197-474d-bf4b-a2043e72329b
drwxrwxrwx 1 jonas jonas    512 Jul  5  2018  Autodesk
drwxrwxrwx 1 jonas jonas    512 Mar 31  2019  blur
-r-xr-xr-x 1 jonas jonas 384322 Jul 16  2016  bootmgr
-r-xr-xr-x 1 jonas jonas      1 Jul 16  2016  BOOTNXT
-rwxrwxrwx 1 jonas jonas     80 Sep 30 08:58  bootTel.dat
drwxrwxrwx 1 jonas jonas    512 Nov 25 21:06  cygwin64
drwxrwxrwx 1 jonas jonas    512 Nov 18  2018  Desktop
lrwxrwxrwx 1 jonas jonas      8 Nov 26  2016 'Documents and Settings' -> /c/Users
---------- 1 jonas jonas   8192 Jan  5 16:40  DumpStack.log
-????????? ? ?     ?          ?            ?  DumpStack.log.tmp
drwxrwxrwx 1 jonas jonas    512 Nov 27  2016  eclipse
drwxrwxrwx 1 jonas jonas    512 Jan  5 12:09  ESD
drwxrwxrwx 1 jonas jonas    512 Nov 18  2018  Fortnite
drwxrwxrwx 1 jonas jonas    512 Feb 22  2018 '$GetCurrent'
-r-xr-xr-x 1 jonas jonas   4214 Sep  5  2017  git-flow
-????????? ? ?     ?          ?            ?  hiberfil.sys
drwxrwxrwx 1 jonas jonas    512 Nov 27  2016  Intel
-r-xr-xr-x 1 jonas jonas   1031 Nov 20  2017  ipaddresses.txt
drwxrwxrwx 1 jonas jonas    512 Jun  4  2018  Microsoft
drwxrwxrwx 1 jonas jonas    512 Mar 31  2018  MongoDB
drwxrwxrwx 1 jonas jonas    512 Jan  5 09:55 'NVIDIA Corporation'
drwxrwxrwx 1 jonas jonas    512 Feb 17  2017  Octave
-????????? ? ?     ?          ?            ?  pagefile.sys
drwxrwxrwx 1 jonas jonas    512 Nov 27 03:34  PerfLogs
drwxrwxrwx 1 jonas jonas    512 Jan  5 17:53  ProgramData
dr-xr-xr-x 1 jonas jonas    512 Jan  5 18:21 'Program Files'
dr-xr-xr-x 1 jonas jonas    512 Jan  5 18:21 'Program Files (x86)'
drwxrwxrwx 1 jonas jonas    512 Jan 16  2019  qt_win_release_intel64_v140_shared
dr-xr-xr-x 1 jonas jonas    512 Jan  5 15:22  Recovery
drwxrwxrwx 1 jonas jonas    512 Mar 12  2018 '$Recycle.Bin'
drwxrwxrwx 1 jonas jonas    512 Jun 28  2017  solidangle
-????????? ? ?     ?          ?            ?  swapfile.sys
dr-xr-xr-x 1 jonas jonas    512 Nov 26  2016 '$SysReset'
d--x--x--x 1 jonas jonas    512 Jan  7 21:20 'System Volume Information'
drwxrwxrwx 1 jonas jonas    512 Apr 28  2018 'Telegram Desktop'
drwxrwxrwx 1 jonas jonas    512 Apr 30  2018  tmp
drwxrwxrwx 1 jonas jonas    512 Mar  9  2017 'Tor Browser'
dr-xr-xr-x 1 jonas jonas    512 Jan  5 15:23  Users
drwxrwxrwx 1 jonas jonas    512 Oct  4  2017  wamp
dr-xr-xr-x 1 jonas jonas    512 Jan  5 16:00  Windows
dr-xr-xr-x 1 jonas jonas    512 Feb 22  2018  Windows10Upgrade
drwxrwxrwx 1 jonas jonas    512 Jan  5 15:30  Windows.old
-r-xr-xr-x 1 jonas jonas     34 Jun 20  2017  windows-version.txt
dr-xr-xr-x 1 jonas jonas    512 Jan  5 12:04 '$Windows.~WS'
drwxrwxrwx 1 jonas jonas    512 Mar 15  2017  ZeroNet
jonas@vrexton:/c/Users/Jonas$ ls -l "/c/Program Files/VcXsrv/vcxsrv.exe"
-r-xr-xr-x 1 jonas jonas 3644928 Jul 27 11:21 '/c/Program Files/VcXsrv/vcxsrv.exe'
jonas@vrexton:/c/Users/Jonas$ ls -l "/c/Program\ Files/VcXsrv/vcxsrv.exe"
ls: cannot access '/c/Program\ Files/VcXsrv/vcxsrv.exe': No such file or directory

@Jawabiscuit
Copy link
Author

Jawabiscuit commented Jan 11, 2020

It seems runx does not detect vcxsrv.exe.
Can you show me:

echo $PATH
ls -l /c
ls -l "/c/Program Files/VcXsrv/vcxsrv.exe"
ls -l "/c/Program\ Files/VcXsrv/vcxsrv.exe"

How/Where did you install VcXsrv?
Is it somewhere different than ls -l "C:/Program Files/VcXsrv/vcxsrv.exe"?

You are using ipconfig.exe, maybe check that?

runx/ipconfig.exe found the IP of the Windows docker daemon 10.0.75.1. That should be ok.

Oh, I'm not running windows docker daemon! You don't need to with WSL2.

jonas@vrexton:/c/Users/Jonas$ docker version
Client: Docker Engine - Community
 Version:           19.03.5
 API version:       1.40
 Go version:        go1.12.12
 Git commit:        633a0ea838
 Built:             Wed Nov 13 07:29:52 2019
 OS/Arch:           linux/amd64
 Experimental:      false

@Jawabiscuit
Copy link
Author

jonas@vrexton:/c/Users/Jonas$ docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

@mviereck
Copy link
Owner

Oh, I'm not running windows docker daemon! You don't need to with WSL2.

ok, cool. Than that works indeed. I'll have to implement support for this in x11docker.

jonas@vrexton:/c/Users/Jonas$ ls -l "/c/Program Files/VcXsrv/vcxsrv.exe"
-r-xr-xr-x 1 jonas jonas 3644928 Jul 27 11:21 '/c/Program Files/VcXsrv/vcxsrv.exe'

It is odd that runx does not detect VcXsrv. Can you please check:

command -v "/c/Program Files/VcXsrv/vcxsrv.exe"

Can you directly execute:

/c/Program\ Files/VcXsrv/vcxsrv.exe

@Jawabiscuit
Copy link
Author

Jawabiscuit commented Jan 11, 2020

Yes, I would like to use x11docker too.

jonas@vrexton:/c/Users/Jonas$ command -v "/c/Program Files/VcXsrv/vcxsrv.exe"

/c/Program Files/VcXsrv/vcxsrv.exe

I can execute /c/Program\ Files/VcXsrv/vcxsrv.exe

@mviereck
Copy link
Owner

I am entirely confused why runx has an issue to detect vcxsrv.exe. Everything looks right.
Can you please run bash -x runx? That will give a lot of output. You can catch it in a file with:

runx >runx.log 2>&1

@Jawabiscuit
Copy link
Author

jonas@vrexton:/c/Users/Jonas$ bash -x runx
+ Version=v0.2.8
+ trap finish EXIT
+ declare_variables
+ Desktopmode=no
+ Screensize=
+ Shareclipboard=yes
+ Sharegpu=no
+ Verbose=no
+ Xauthentication=yes
++ printf '\033'
+ Esc=$'\E'
+ Colblue=''
+ Colyellow=''
+ Colgreen=''
+ Colgreenbg=''
+ Colred=''
+ Colredbg=''
+ Coluline=''
+ Colnorm=''
+ Exitcode=
+ Hostip=
+ Newdisplaynumber=
+ Sourced=
+ Vcxsrvexe=
+ Xserverwinpid=
+ Winsubmount=
+ Winsubpath=
+ Xcommand=
+ Xready=
+ Xserver=
+ Xserverexe=
+ Xserverpid=
+ Xwinexe=
+ parse_options
+ local Shortoptions Longoptions Parsererror
+ Shortoptions=dghv
+ Longoptions=cleanup,clipboard::,desktop,display:,gpu,help,no-auth,size:,vcxsrv,verbose,version,xwin ++ getopt --options dghv --longoptions cleanup,clipboard::,desktop,display:,gpu,help,no-auth,size:,vcxsrv,verbose,version,xwin --name runx --
+ Parsedoptions=' --'
+ '[' -e /tmp/runx_parsererror ']'
++ cat /tmp/runx_parsererror
+ Parsererror=
+ rm /tmp/runx_parsererror
+ '[' '' ']'
+ eval set -- ' --'
++ set -- --
+ verbose ' --'
+ '[' no = yes ']'
+ return 0
+ '[' 1 -gt 0 ']'
+ case "${1:-}" in
+ shift
+ Hostcommand=
+ break
+ check_host
+ command -v cygcheck.exe
+ uname -r
+ grep -q -i Microsoft
+ Winsubsystem=WSL
+ '[' runx = /usr/local/bin/runx ']'
+ Sourced=yes
+ verbose 'Script is being sourced yes/no: yes'
+ '[' no = yes ']'
+ return 0
+ case $Winsubsystem in
+ Winsubmount=/mnt
+ grep -q Windows
+++ getwslpath
+++ local RUN_ID= BASE_PATH=
++++ mcookie
+++ RUN_ID=/tmp/f593795d4b1b5a25b8be1c713aa9dc06
+++ touch /tmp/f593795d4b1b5a25b8be1c713aa9dc06
+++ powershell.exe -Command '(Get-ChildItem HKCU:\Software\Microsoft\Windows\CurrentVersion\Lxss | ForEach-Object {Get-ItemProperty $_.PSPath}).BasePath.replace(":", "").replace("\", "/")'
+++ IFS=
+++ read -r BASEPATH
+++ BASEPATH=C/Users/Jonas/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState
+++ BASEPATH=/mnt/c/Users/Jonas/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs
+++ ls /mnt/c/Users/Jonas/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs
+++ echo /mnt/c/Users/Jonas/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs
+++ break
+++ rm /tmp/f593795d4b1b5a25b8be1c713aa9dc06
+++ return 0
++ convertpath --unix /mnt/c/Users/Jonas/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs
++ local Mode= Path= Drive= Readwritemode=
++ Mode=--unix
++ Path=/mnt/c/Users/Jonas/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs
+++ echo /mnt/c/Users/Jonas/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs
+++ rev
+++ cut -c1-3
+++ rev
++ Readwritemode=tfs
+++ cut -c1
++ '[' t = : ']'
++ Readwritemode=:rw
+++ sed s%~%/home/jonas%
++ Path=/mnt/c/Users/Jonas/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs
++ '[' -z WSL ']'
+++ tr '\\' /
++ Path=/mnt/c/Users/Jonas/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs
++ Path=/c/Users/Jonas/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs
+++ cut -c1,3
++ '[' // = // ']'
+++ cut -c2
++ Drive=c
+++ cut -c3-
++ Path=/Users/Jonas/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs
+++ cut -c2
++ '[' U = : ']'
++ Drive=c
++ '[' WSL = WSL ']'
++ '[' -z c ']'
++ case $Drive in
++ case $Mode in
++ echo /c/Users/Jonas/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs
++ return 0
+ Winsubpath=/c/Users/Jonas/AppData/Local/Packages/CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc/LocalState/rootfs
++ ipconfig.exe
++ rmcr
++ case "${1:-}" in
++ grep -A6 DockerNAT
++ grep IPv4
+++ printf '\r'
++ rev
++ sed $'s/\r//g'
++ cut '-d ' -f1
++ rev
+ Hostip=10.0.75.1
+ '[' 10.0.75.1 ']'
+ '[' 10.0.75.1 ']'
+ verbose 'Host IP adress: 10.0.75.1'
+ '[' no = yes ']'
+ return 0
+ return 0
+ check_dependencies
+ local Line
+ case "$Winsubsystem" in
+ '[' WSL = MSYS2 ']'
+ '[' yes = yes ']'
+ check_dependency xauth
+ '[' xauth ']'
+ command -v xauth
+ return 0
++ command -v vcxsrv.exe
+ Vcxsrvexe=
+ '[' '' ']'
+++ convertpath --subsystem 'C:/Program Files/VcXsrv/vcxsrv.exe'
+++ local Mode= Path= Drive= Readwritemode=
+++ Mode=--subsystem
+++ Path='C:/Program Files/VcXsrv/vcxsrv.exe'
++++ echo 'C:/Program Files/VcXsrv/vcxsrv.exe'
++++ rev
++++ cut -c1-3
++++ rev
+++ Readwritemode=exe
++++ cut -c1
+++ '[' e = : ']'
+++ Readwritemode=:rw
++++ sed s%~%/home/jonas%
+++ Path='C:/Program Files/VcXsrv/vcxsrv.exe'
+++ '[' -z WSL ']'
++++ tr '\\' /
+++ Path='C:/Program Files/VcXsrv/vcxsrv.exe'
+++ Path='C:/Program Files/VcXsrv/vcxsrv.exe'
++++ cut -c1,3
+++ '[' C/ = // ']'
++++ cut -c2
+++ '[' : = : ']'
++++ cut -c1
+++ Drive=C
++++ cut -c3-
+++ Path='/Program Files/VcXsrv/vcxsrv.exe'
+++ Drive=c
+++ '[' WSL = WSL ']'
+++ '[' -z c ']'
+++ case $Drive in
+++ case $Mode in
+++ echo '/mnt/c/Program Files/VcXsrv/vcxsrv.exe'
+++ return 0
++ command -v '/mnt/c/Program Files/VcXsrv/vcxsrv.exe'
+ Vcxsrvexe=
++ command -v XWin
+ Xwinexe=
+ '[' -z '' ']'
+ '[' WSL = WSL ']'
+ for Drive in /mnt/*
++ command -v /mnt/c/cygwin64/bin/XWin.exe
+ Xwinexe=
+ '[' '' ']'
++ command -v /mnt/c/cygwin32/bin/XWin.exe
+ Xwinexe=
+ '[' '' ']'
+ for Drive in /mnt/*
++ command -v /mnt/q/cygwin64/bin/XWin.exe
+ Xwinexe=
+ '[' '' ']'
++ command -v /mnt/q/cygwin32/bin/XWin.exe
+ Xwinexe=
+ '[' '' ']'
+ for Drive in /mnt/*
++ command -v /mnt/s/cygwin64/bin/XWin.exe
+ Xwinexe=
+ '[' '' ']'
++ command -v /mnt/s/cygwin32/bin/XWin.exe
+ Xwinexe=
+ '[' '' ']'
+ for Drive in /mnt/*
++ command -v /mnt/wsl/cygwin64/bin/XWin.exe
+ Xwinexe=
+ '[' '' ']'
++ command -v /mnt/wsl/cygwin32/bin/XWin.exe
+ Xwinexe=
+ '[' '' ']'
+ verbose 'Found X servers:

  '
+ '[' no = yes ']'
+ return 0
+ '[' -z '' ']'
+ '[' -n '' ']'
+ '[' -z '' ']'
+ Xserver=vcxsrv
+ '[' WSL = MSYS2 ']'
+ case "$Xserver" in
+ Xserverexe=
+ '[' -z '' ']'
+ case $Winsubsystem in
+ error 'No X server found.
  Please either install X server VcXsrv:
      https://sourceforge.net/projects/vcxsrv
  or install Cygwin with packages xinit and xauth to provide XWin:
      https://www.cygwin.com/'
+ echo -e 'runx ERROR: No X server found.
  Please either install X server VcXsrv:
      https://sourceforge.net/projects/vcxsrv
  or install Cygwin with packages xinit and xauth to provide XWin:
      https://www.cygwin.com/
'
runx ERROR: No X server found.
  Please either install X server VcXsrv:
      https://sourceforge.net/projects/vcxsrv
  or install Cygwin with packages xinit and xauth to provide XWin:
      https://www.cygwin.com/

+ Exitcode=1
+ return 0
+ for Line in cmd.exe ipconfig.exe powershell.exe tasklist.exe taskkill.exe
+ check_dependency cmd.exe
+ '[' cmd.exe ']'
+ command -v cmd.exe
+ return 0
+ for Line in cmd.exe ipconfig.exe powershell.exe tasklist.exe taskkill.exe
+ check_dependency ipconfig.exe
+ '[' ipconfig.exe ']'
+ command -v ipconfig.exe
+ return 0
+ for Line in cmd.exe ipconfig.exe powershell.exe tasklist.exe taskkill.exe
+ check_dependency powershell.exe
+ '[' powershell.exe ']'
+ command -v powershell.exe
+ return 0
+ for Line in cmd.exe ipconfig.exe powershell.exe tasklist.exe taskkill.exe
+ check_dependency tasklist.exe
+ '[' tasklist.exe ']'
+ command -v tasklist.exe
+ return 0
+ for Line in cmd.exe ipconfig.exe powershell.exe tasklist.exe taskkill.exe
+ check_dependency taskkill.exe
+ '[' taskkill.exe ']'
+ command -v taskkill.exe
+ return 0
+ '[' '' = yes ']'
+ '[' -z 1 ']'
+ finish 1
+ verbose 'Exitcode: 1'
+ '[' no = yes ']'
+ return 0
+ case "$Sourced" in
+ unset -f usage finish
+ unset -f error warning note verbose
+ unset -f rmcr getwslpath escapestring convertpath
+ unset -f check_host check_dependency check_dependencies setup_cookie generate_xcommand
+ unset -f cleanup
+ unset -f declare_variables parse_options main
+ unset Desktopmode Screensize Shareclipboard Sharegpu Verbose Xauthentication
+ unset Esc Colblue Colyellow Colgreen Colgreenbg Colred Colredbg Coluline Colnorm
+ unset Exitcode Hostip Newdisplaynumber Sourced Vcxsrvexe Xserverwinpid Winsubmount Winsubpath Xcommand Xready Xserver Xserverexe Xserverpid Xwinexe
+ finish
/usr/local/bin/runx: line 1: finish: command not found

@mviereck
Copy link
Owner

Ok, likely I found the issue:
WSL1 mounts the Windows partitions in e.g. /mnt/c. But WSL2 mounts them in /c.
Of course runx could not find /mnt/c/Program\ Files/VcXsrv/vcxsrv.exe because it does not exist in WSL2.

I've uploaded a fixed version. Hopefully I did not introduce any syntax error.
Please update and try again.

@mviereck
Copy link
Owner

mviereck commented Jan 12, 2020

Does runx work now?

I've adjusted x11docker, too. Could you please check it, too? If it fails, please run it with --debug and open a ticket at x11docker.

@Jawabiscuit
Copy link
Author

Jawabiscuit commented Jan 12, 2020

I had time to try out runx --vcxsrv -- emacs and run --gpu --xwin -- emacs and they both work. I'm going to try x11docker later now that I got this working.

I couldn't get this Emacs docker image to display a GUI with just runx even though a GUI will display if I run vcxsrv before hand.

@mviereck
Copy link
Owner

mviereck commented Jan 13, 2020

I had time to try out runx --vcxsrv -- emacs and run --gpu --xwin -- emacs and they both work.

Great!

I couldn't get this Emacs docker image to display a GUI with just runx even though a GUI will display if I run vcxsrv before hand.

The command example of this emacs image only regards DISPLAY, but not XAUTHORITY. It will likely work if you either run runx --no-auth or run xhost+SI:localuser:$USER after runx.

@mviereck
Copy link
Owner

mviereck commented Jan 13, 2020

I've opened a WSL2 ticket at x11docker: mviereck/x11docker#214

@eine: Could you please try out, too? Some checks in x11docker have been changed that also affect MSYS2/Cygwin/WSL1. I hope I did not break anything. Ideally you should not note any difference. If it works well in one of them, the others should be ok, too, so one check would be enough.

@eine
Copy link

eine commented Jan 28, 2020

Hi @mviereck! I just pulled latest master of runx and x11docker. As you expected, nothing seems to have changed on MSYS2. The following command works: /t/runx/runx --no-auth -- /t/x11docker/x11docker --user=0 -i ghdl/ext bash. Unfortunately, that seems not to be true on Cygwin or WSL1:

$ /cygdrive/t/x11docker/x11docker --user=0 -i ghdl/ext bash
x11docker note: Using X server option --xwin

x11docker note: Windows firewall settings can forbid application access
  to the X server. If no application window appears, but no obvious error
  is shown, please check your firewall settings. Compare issue #108 on github.

x11docker note: Option --user=root: Enabling option --sudouser.

x11docker WARNING: Option --sudouser severly reduces container security.
  Container gains additional capabilities to allow sudo and su.
  If an application breaks out of container, it can harm your system
  in many ways without you noticing. Password: x11docker

x11docker note: Option --sudouser: Enabling option --newprivileges=yes.
  You can avoid this with --newprivileges=no

x11docker WARNING: Option --newprivileges=yes: x11docker does not set
  docker run option --security-opt=no-new-privileges.
  That degrades container security.
  However, this is still within a default docker setup.


x11docker ERROR: waitforlogentry(): dockerrc: Timeout waiting for entry "xinitrc is ready" in xinit.log
  Last lines of xinit.log:
winPointerWarpCursor - Discarding first warp: 1920 1080
(--) 5 mouse buttons found
(--) Setting autorepeat to delay=500, rate=31
(--) Windows keyboard layout: "0000040A" (0000040a) "Spanish", type 4
(--) Found matching XKB configuration "Spanish (Spain,Traditional Sort)"
(--) Model = "pc105" Layout = "es" Variant = "none" Options = "none"
Rules = "base" Model = "pc105" Layout = "es" Variant = "none" Options = "none"
winInitMultiWindowWM - DISPLAY=:2188.0
winMultiWindowXMsgProc - DISPLAY=:2188.0
winProcEstablishConnection - Clipboard is not enabled, returning.

  Type 'x11docker --help' for usage information
  Debug options: '--verbose' (full log) or '--debug' (log excerpt).
  Logfile will be: /home/eine/.cache/x11docker/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker

Hitting Ctrl+C is ignored. I need to close the terminal window. Moreover, the X server seems not to be closed. I need to do it manually from the task manager.

$ /mnt/t/runx/runx --no-auth -- /mnt/t/x11docker/x11docker --user=0 -i ghdl/ext bash
runx note: Using random X display number :1623.
  If this display number is already in use, X server startup  will fail.
  You can specify a display number N with option '--display N'.

runx note: Windows firewall settings can forbid application access
  to the X server. If no application window appears, but no obvious error
  is shown, please check your firewall settings.
  Compare:   https://github.com/mviereck/x11docker/issues/108

runx WARNING: Option --no-auth: Cookie authentication is disabled!
      SECURITY RISC!
  Your X server xwin listens on TCP connections without any protection.
  Others could try to access your system through network connections.
  Please use option --no-auth for debugging only.

DISPLAY=10.0.75.1:1623

x11docker ERROR: Cache root folder must not contain whitespaces.
  '//wsl$/Debian/home/eine'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
C:/Users/eine/x11docker/cache

  Type 'x11docker --help' for usage information
  Debug options: '--verbose' (full log) or '--debug' (log excerpt).
  Logfile will be:
  Please report issues at https://github.com/mviereck/x11docker

SUCCESS: The process with PID 18716 has been terminated.

In this case, the process is terminated alone and the X server is closed.

Let me know if this makes any sense to you. I'll get a full debug log otherwise.

@mviereck
Copy link
Owner

@eine Thank you for the tests!
It seems that runx works so far but I've introduced issues in x11docker.
Could you please open two tickets at x11docker, one for Cygwin and one for WSL1?
Both with a logfile attached.

Note that -i, --interactive is not supported in Cygwin and WSL because winpty is needed. I am surprised that x11docker does not give a note. The check in x11docker is:

      [ "$Winsubsystem" ] && {
        Winpty="$(command -v winpty)"
        Winpty="$(escapestring "$Winpty")"
        [ "$Winpty" ] || {
          note "Option -i, --interactive: On MS Windows you need 'winpty'
  to run x11docker in interactive mode. MSYS2 provides winpty as a package.
  On Cygwin it can be compiled from source. WSL isn't supported yet.
  Fallback: disabling option --interactive."
          Interactive="no"
        }
      }

Do you have winpty in Cygwin or WSL?
Please run your tests without -i for now.

@eine
Copy link

eine commented Jan 28, 2020

Do you have winpty in Cygwin or WSL?
Please run your tests without -i for now.

Done. No, I don't have winpty in any of Cygwin or WSL1. It is only available in MSYS2.

@mviereck
Copy link
Owner

I assume that runx works in all setups now.

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

3 participants