mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.62k stars 378 forks source link

docker-for-win: Cannot establish any listening sockets - Make sure an X server isn't already running #155

Closed eine closed 5 years ago

eine commented 5 years ago

I tried to run the checks #145 after updating to the latest master, and I found the following error:

x11check

VCXSrv.100.log x11docker.log

Then, I closed all the containers and X servers, and tried again. The interface of x11docker/check is now properly shown.

Last, I started the aptman/dbhi container again, and tried to execute x11docker/check after it. It fails again.

So, I'd say that some of the latest changes have broken the possibility to start multiple vcxsrv instances.

mviereck commented 5 years ago

Thanks for reporting!

It seems that x11docker somehow does not recognice X display numbers that are already in use. I successfully runs the first X server on display :100, but fails to run second one on :100. It should run the second X server with display number :101.

I'll have a look why the display number check fails.

Meanwhile it should work if you manually specify a different display number with --display 101.

eine commented 5 years ago

Meanwhile it should work if you manually specify a different display number with --display 101.

It works. I'm using this now to run the checks.

mviereck commented 5 years ago

Ok, this one is fixed in latest commit. I did some test runs in a Windows VM, --xwin in Cygwin was affected, too.

eine commented 5 years ago

I can confirm that it works now.

eine commented 5 years ago

I think I'm having this problem in Cygwin:

xwin_err

XWin.100.log x11docker.log

Note that there is no other Xwin server running, but there is an VcXsrv running at 100.

I can work around this issue with ./x11docker --clipboard --no-auth --display 101 x11docker/check.

mviereck commented 5 years ago

Note that there is no other Xwin server running, but there is an VcXsrv running at 100.

I did a test run yet with this setup, and it works. Maybe you forgot to run x11docker --update-master in Cygwin?

eine commented 5 years ago

I did a test run yet with this setup, and it works. Maybe you forgot to run x11docker --update-master in Cygwin?

x11docker is not 'installed', I clone/pull the git repo and execute the script from there. Note that the command I used is ./x11docker --clipboard --no-auth x11docker/check.

mviereck commented 5 years ago

I cannot reproduce the issue, works ok here. xauth (#145) works, too. My Windows installation just had an update, and my VcXsrv version is the same (1.20.1.4). I have no more idea what might be different on your machine except a different x11docker version.

eine commented 5 years ago

I'm using the latest master. Might it be related to the fact that Cygwin is not installed in C: here?

mviereck commented 5 years ago

Might it be related to the fact that Cygwin is not installed in C: here?

I'll look into that, but it is quite unlikely. If started within Cygwin, x11docker checks cygpath to find the location of Cygwin.

I'm using the latest master.

Could you please try an older version? v5.6.0 should have worked previously.

eine commented 5 years ago

Could you please try an older version? v5.6.0 should have worked previously.

I tried with v5.6.0, v5.5.2, v5.5.0 and v5.4.0. All of them produce the same result/error. All of them work with --display 101.

mviereck commented 5 years ago

Thank you. It seems the check with xwininfo.exe somehow fails on your system. The code Line is https://github.com/mviereck/x11docker/blob/master/x11docker#L2194

        --vcxsrv|--xwin) grep -q -E 'Authorization|Absolute' <<< "$(xwininfo.exe -display $Hostip:$Newdisplaynumber -root 2>&1)" || break ;;

Of interest is

xwininfo.exe -display $Hostip:$Newdisplaynumber -root 

Can you show me command -v xwininfo.exe? In Cygwin it should be /usr/bin/xwininfo.exe.

In MSYS2 this probably fails, but this should work:

command -v /c/Program\ Files/VcXsrv/xwininfo.exe

Maybe you can also run a check with xwininfo.exe with correct IP and display number?

eine commented 5 years ago

It seems the check with xwininfo.exe somehow fails on your system.

This was it. xwininfo.exe was installed/available in /c/Program\ Files/VcXsrv/xwininfo.exe but not in Cygwin. I installed it explicitly, and everything works as expected now.

Moreover, the authorization issue commented in #145 does not apply to cygwin (either with xwin or vcxsrv). It is still present with MSYS, tho.

mviereck commented 5 years ago

This was it. xwininfo.exe was installed/available in /c/Program\ Files/VcXsrv/xwininfo.exe but not in Cygwin.

Oh, ok. I thought it would be part of the xinit package. I'll add a dependency note in the wiki and a check for its availability in x11docker.

authorization issue

Does /c/Program\ Files/VcXsrv/xauth.exe exist? It should be distributed with VcXsrv.

eine commented 5 years ago

Oh, ok. I thought it would be part of the xinit package. I'll add a dependency note in the wiki and a check for its availability in x11docker.

Great!

authorization issue

Does /c/Program\ Files/VcXsrv/xauth.exe exist? It should be distributed with VcXsrv.

Yes, it does exist. The following executables are available in /c/Program\ Files/VcXsrv/: plink, vcxsrv, xauth, xcalc, xclock, xhost, xkbcomp, xlaunch, xrdb and xwininfo.

EDIT

# ./xauth.exe -h
usage:  C:\Program Files\VcXsrv\xauth.exe [-options ...] [command arg ...]

where options include:
    -f authfilename                name of authority file to use
    -v                             turn on extra messages
    -q                             turn off extra messages
    -i                             ignore locks on authority file
    -b                             break locks on authority file
    -n                             do not resolve host names in authority file
    -V                             show version number of xauth

and commands have the following syntax:

    add dpyname protoname hexkey   add entry
    exit                           save changes and exit program
    extract filename dpyname...    extract entries into file
    help [topic]                   print help
    info                           print information about entries
    list [dpyname...]              list entries
    merge filename...              merge entries from files
    nextract filename dpyname...   numerically extract entries
    nlist [dpyname...]             numerically list entries
    nmerge filename...             numerically merge entries
    quit                           abort changes and exit program
    remove dpyname...              remove entries
    source filename                read commands from file
    version                        show version number of xauth
    ?                              list available commands
    generate dpyname protoname [options]  use server to generate entry
    options are:
      timeout n    authorization expiration time in seconds
      trusted      clients using this entry are trusted
      untrusted    clients using this entry are untrusted
      group n      clients using this entry belong to application group n
      data hexkey  auth protocol specific data needed to generate the entry

A dash may be used with the "merge" and "source" to read from the
standard input.  Commands beginning with "n" use numeric format.

eine@DESKTOP-E1ER43H MINGW64 /c/Program Files/VcXsrv
# ./xauth.exe version
C:\Program Files\VcXsrv\xauth.exe:  file C:\msys64\home\eine\.Xauthority does not exist
1.0.10
mviereck commented 5 years ago

Closing this one, the origin issue is resolved.

Re: xauth / Authorization issue @1138-4EB Please let's discuss that in #160