mviereck / runx Goto Github PK
View Code? Open in Web Editor NEWProvide X server on MS Windows with cookie authentication.
License: MIT License
Provide X server on MS Windows with cookie authentication.
License: MIT License
Hi! First of all, really cool script! I was trying it out on my machine and noticed that I got an error:
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/
I looked into what the script was doing and realized my VcXsrv installation was in C:\Program Files (x86)
. It's a pretty easy fix but wanted to put up an issue for this in case anyone bumps into a similar issue. I can submit a quick patch to check that directory in a sec, but wondering if there's a better way to go about checking for the executable in Windows?
In WSL2, there is an internal network created between Windows and WSL2, with the range 172.16.0.0/12.
Whilst X-Windows servers such as VcSrv are likely to listen on the generic IP 0.0.0.0, port 6XXX, a security-minded PC setup should block all incoming connections from the externally-facing interfaces (e.g. Ethernet, WiFi) and only allow connections from the internal network.
Therefore, when looking for the Host IP of the X-Server running on Windows, WSL2 should connect to the internal IP.
There are multiple ways that this internal IP can be dynamically determined. One way is:
ip route list default | awk '{print $3}'
Every time that WSL2 is restarted (including when the PC is rebooted), the address assigned to the WSL2 instance and to the Windows host can potentially change, so the determination of the Host IP address should use one of the mechanisms for determining the changing IP.
(Note: This security mechanism of using the firewall to block incoming connections from externally-facing interfaces can be used to enhance the xauth mechanism - providing greater defense-in-depth for the system).
The copyright notice in the license file does not include the name of the copyright holder. This might lead to some confusion about attribution or the legal validity of the license statement in some jurisdictions if this script is distributed with, or incorporated in other software packages.
Hi, had one performance-issue (check_displayport) and 2 small other issues -> see my PR. Feel free to ask for more information.
The powershell-problem would also apply to x11docker: https://github.com/mviereck/x11docker/blob/f17a7d248dfab24f82fd5a67840e459028db9593/x11docker#L1296
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
Hello @eine ,
are you still using x11docker and runx?
Once we had the issue that MSYS2 does not provide package xauth
so x11docker and runx could only run with option --no-auth
.
These days I managed to create a cookie file without the need of xauth
.
I'd like to implement this in runx
and want to ask you if you could test it if it works.
Context, my system is an Ubuntu WSL2 system.
When I source runx
and pass the "-h" option, after the help output, I get the following errors:
Command 'main' not found, did you mean:
command 'maim' from deb maim (5.6.3-1)
command 'rain' from deb bsdgames (2.17-29)
command 'man' from deb man-db (2.10.2-1)
command 'mail' from deb mailutils (1:3.14-1)
Try: apt install <deb name>
finish: command not found
This is because in parse_options
, when the "-h" or "--help" option is detected, the finish
function is called, which uses "$Sourced" to detect that the script has been sourced and then unset
s all the variables and functions defined in the script.
After returning from parse_options
, the script tries to call the main
and then finish
functions, but these have already been unset, so the shell tries to find them as standard commands, which it can't.
As such, it then tries to suggest packages to install which could provide these functions as standard commands.
Furthermore, if a fix to issue #13 is implemented, moving the parse_options
function to before the check_host
function, this breaks the "$Sourced" logic because the detection of whether the script is "$Sourced" is performed in the check_host
function, so when "-h" is then detected and finish
is called, the finish
function no longer knows that the script has been "$Sourced".
So:
parse_options
function, because sourcing the function is a 'kind-of' option - and that detection should be done as early as possible, before there is any chance that the script will need to know that it has been "$Sourced".finish
function should not be called on detection of "-h" or "--help" by parse_options
. Instead, the parse_options
function should return as normal, but setting "$Exitcode" to a value (0 is suggested, because outputting help is a 'kind-of' success) and then testing "$Exitcode" to ensure that it is still unset before calling any of the subsequent functionality.finish
function is then called as the last function call in the script, and it can happily unset everything without there being any resulting errors.Environment: Win10, WSL2.
runx
bash script goes through ipconfig.exe
output and sets Hostip
var (needed for the DISPLAY
envvar) to the value from the first found "IPv4"-containing string.
But when there are multiple Virtual Switches the first found value may be not correct (my case) so runx
doesn't work because DISPLAY
is not set correctly.
Disabling additional Virtual Switches solves the problem but it took about an hour for me (not mentioning reading through code) to find the reason of the problem.
Please take this situation into account.
Thanks.
Great script! I've noted that your install instructions for cygwin point to the wrong url for getting the runx script.
You have:
wget https://github.com/mviereck/runx/blob/master/runx -O /usr/local/bin/runx
chmod +x /usr/local/bin/runx
When it should be:
wget https://raw.githubusercontent.com/mviereck/runx/master/runx -O /usr/local/bin/runx
chmod +x /usr/local/bin/runx
without using https://raw.githubusercontent.com/mviereck/runx/master/runx the runx scripts is just a bunch of HTML ;)
Hello Martin!
Could you enhance your script to get IP / display number from DISPLAY variable ?
How do I want to use it:
I need only one X-Server on my machine (I think it is most popular option)
set $DISPLAY=127.0.0.1:bla-bla
always on startup in bashrc
start X-Server manually, when I need it
run clients from several terminals
I prefer to have all of my instances of wsl consoles use the same xwindows session when I launch new terminals. Is there a way to tell runx to re-use a specific terminal if it exists at source time?
The options are parsed in the parse_options
function, but this function is called after the check_host
function is called.
The check_host
function looks to see if the "verbose" option has been passed and, if so, outputs debug information.
Because the parse_options
function is currently only called after the check_host
function has run, the "verbose" option is not detected until after the check_host
function is run and this additional debug information is not output even when the "verbose" option is passed.
Hence, it would be logical to call parse_options
before calling check_host
so that passing the "verbose" option can cause check_host
to output this additional debug information.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.