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

Windows 10 WSL installation problem - powershell.exe / ipconfig.exe #249

Closed
tomaroberts opened this issue May 11, 2020 · 23 comments
Closed

Comments

@tomaroberts
Copy link

Hi there,

I'd love to get this working, but I've been trying for several hours now and can't get it installed.

I'm running WSL on Windows 10. I've got VcXsrv running. Docker is installed for Windows and works in WSL.

When I run the curl installation line, I get the following:

image

There are many more lines to the error, but I'm guessing it's related to finding the .exes. Looks a little similar to issue #153 . Probably file directory related.

Would you be able to help? Happy to test things out.

Thanks a lot.

@mviereck mviereck added the bug label May 11, 2020
@mviereck
Copy link
Owner

Thank you for the bug report!
This bug should have been fixed in ticket #153 as you already found. I am not sure why it does not work.
Could you please try out this code snippet, with and without sudo?

#! /bin/bash

echo "PATH: $PATH"
uname -r

### some code from x11docker ###
  # Check for MS Windows subsystem
  command -v cygcheck.exe >/dev/null && {
    cygcheck.exe -V | rmcr | grep -q "(cygwin)"   && Winsubsystem="CYGWIN"
    cygcheck.exe -V | rmcr | grep -q "(msys)"     && Winsubsystem="MSYS2"
  }
  uname -r | grep -q "Microsoft"                  && Winsubsystem="WSL1"
  uname -r | grep -q "microsoft"                  && Winsubsystem="WSL2"
  case $Winsubsystem in
    MSYS2|CYGWIN) 
      Winsubmount="$(cygpath. exe -u "c:/" | rmcr | sed s%/c/%%)"
#      Winsubpath="$(convertpath unix "$(cygpath.exe -w "/" | rmcr)" )"
      Mobyvm="yes"
    ;;
    WSL1)          
      Winsubmount="/mnt"
      grep -q "Windows" <<< "${PATH:-}" || export PATH="${PATH:-}:$Winsubmount/c/Windows/System32:$Winsubmount/c/Windows/System32/WindowsPowerShell/v1.0" # can miss after sudo in WSL
#       Winsubpath="$(convertpath unix "$(getwslpath)")"
      Mobyvm="yes"
    ;;
    WSL2)
      Winsubmount=""
      grep -q "Windows" <<< "${PATH:-}" || export PATH="${PATH:-}:$Winsubmount/c/Windows/System32:$Winsubmount/c/Windows/System32/WindowsPowerShell/v1.0" # can miss after sudo in WSL
#       Winsubpath="$(convertpath unix "$(getwslpath)")" 
    ;;
  esac
  Winsubmount="${Winsubmount%/}"
  Winsubpath="${Winsubpath%/}"
  [ "$Winsubsystem" ] && Hostsystem="MSWindows-$Winsubsystem"
###

echo "
Winsubsystem: $Winsubsystem
Winsubmount: $Winsubmount
Mobyvm: $Mobyvm
PATH: $PATH"

@tomaroberts
Copy link
Author

Thanks for the quick reply.

Without sudo:


PATH: /home/ubutar/bin:/home/ubutar/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/mnt/c/Users/tr17/Documents/CODE_Projects/fetal_cmr_4d/4drecon:/mnt/c/Users/tr17/Documents/CODE_Projects/fetal_cmr_4d/irtk_cardiac4d/build/bin:/opt/mirtk/bin:/mnt/c/Users/tr17/Documents/CODE_Projects/fetal_cmr_4d/irtk_cardiac4d_build/bin:/mnt/c/Windows/System32:/mnt/c/Windows/System32/WindowsPowerShell/v1.0
4.4.0-17763-Microsoft

Winsubsystem: WSL1
Winsubmount: /mnt
Mobyvm: yes
PATH: /home/ubutar/bin:/home/ubutar/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/mnt/c/Users/tr17/Documents/CODE_Projects/fetal_cmr_4d/4drecon:/mnt/c/Users/tr17/Documents/CODE_Projects/fetal_cmr_4d/irtk_cardiac4d/build/bin:/opt/mirtk/bin:/mnt/c/Users/tr17/Documents/CODE_Projects/fetal_cmr_4d/irtk_cardiac4d_build/bin:/mnt/c/Windows/System32:/mnt/c/Windows/System32/WindowsPowerShell/v1.0

With sudo:

PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
4.4.0-17763-Microsoft

Winsubsystem: WSL1
Winsubmount: /mnt
Mobyvm: yes
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/mnt/c/Windows/System32:/mnt/c/Windows/System32/WindowsPowerShell/v1.0

@mviereck
Copy link
Owner

mviereck commented May 11, 2020

That's odd. Everything looks as it should.
Can you please run (as normal user):

command -v ipconfig.exe
ls -l /mnt/c/Windows/System32/ipconfig.exe
ipconfig.exe
/mnt/c/Windows/System32/ipconfig.exe

command -v cmd.exe
ls -l /mnt/c/Windows/System32/cmd.exe

command -v powershell.exe
ls -l /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe

@tomaroberts
Copy link
Author

Thanks. Here we go:

ubutar@perinatal151-lap:~$ command -v ipconfig.exe
ubutar@perinatal151-lap:~$ ls -l /mnt/c/Windows/System32/ipconfig.exe
ls: cannot access '/mnt/c/Windows/System32/ipconfig.exe': No such file or directory
ubutar@perinatal151-lap:~$ ipconfig.exe
ipconfig.exe: command not found
ubutar@perinatal151-lap:~$ /mnt/c/Windows/System32/ipconfig.exe
-bash: /mnt/c/Windows/System32/ipconfig.exe: No such file or directory
ubutar@perinatal151-lap:~$
ubutar@perinatal151-lap:~$ command -v cmd.exe
ubutar@perinatal151-lap:~$ ls -l /mnt/c/Windows/System32/cmd.exe
ls: cannot access '/mnt/c/Windows/System32/cmd.exe': No such file or directory
ubutar@perinatal151-lap:~$
ubutar@perinatal151-lap:~$ command -v powershell.exe
ubutar@perinatal151-lap:~$ ls -l /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe
ls: cannot access '/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe': No such file or directory
ubutar@perinatal151-lap:~$

One thing possibly relevant: when setting up Docker etc, I followed this guide: https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly

There is a section titled Ensure Volume Mounts Work where it's recommended to change the WSL root path. Possibly related?

@eine
Copy link
Contributor

eine commented May 12, 2020

FTR, since some days ago (I don't know exactly), Docker Desktop does not work on WSL1. Trying to run docker ps -a returns:

The command 'docker' could not be found in this WSL 1 distro.
We recommend to convert this distro to WSL 2 and activate
the WSL integration in Docker Desktop settings.

See https://docs.docker.com/docker-for-windows/wsl/ for details.

However, the command exists. Using the explicit path to the docker.exe client does not work either. Hence, I'll need to wait until WSL2 is provided to non-insiders.

@mviereck
Copy link
Owner

There is a section titled Ensure Volume Mounts Work where it's recommended to change the WSL root path. Possibly related?

Very likely that it is. The default WSL configuration to mount Windows drives is changed, but variable PATH is not adjusted, too.
Please check:

ls -l /c/Windows/System32/ipconfig.exe

As a quick fix, run:

ln -s /c /mnt/c

This creates a softlink at the default mount path to your custom mount path from the blog post.

@tomaroberts
Copy link
Author

As requested:

ubutar@perinatal151-lap:~$ ls -l /c/Windows/System32/ipconfig.exe
-r-xr-xr-x 2 ubutar ubutar 34816 Sep 15  2018 /c/Windows/System32/ipconfig.exe

@mviereck
Copy link
Owner

ok, than that is is really the core issue.
With the quick fix ln -s /c /mnt/c x11docker should already work.

I'll think how to fix this in x11docker, too. Maybe x11docker should check several pathes to decide which one is valid instead of assuming the default one (that would have been /mnt/c in this case.

@tomaroberts
Copy link
Author

Do I need to roll undo the changes to root made in the blog post then?

Thanks again for your help.

@mviereck
Copy link
Owner

Do I need to roll undo the changes to root made in the blog post then?

No; the softlink should just allow to access the files at /mnt/c as well as in /c, so you can keep your custom setup.
The blog post suggests some setups with sudo mount to adress this issue, but that is not needed.

@mviereck
Copy link
Owner

I've implemented a check for both /mnt/c and /c in x11docker master branch.
This should work even without my softlink suggestion.
Please try out:

curl -fsSL https://raw.githubusercontent.com/mviereck/x11docker/master/x11docker | sudo bash -s -- --update-master

@tomaroberts
Copy link
Author

Seems to have worked! x11docker / x11docker-gui / etc in /usr/bin and x11docker runs.

I assume that means it's all good. I'm bit busy right now, but can do any other tests later if helpful.

Thanks!

@mviereck
Copy link
Owner

Great that it works so far! Thanks for reporting and testing.

Please open a new ticket if you encounter other issues.

@mviereck
Copy link
Owner

runx was affected by the same path issue. I've updated it yet. If you've already installed runx, please install it again.

@tomaroberts
Copy link
Author

Hi again,

Sorry for delay in testing, but I'm still not able to get this running. Have reinstalled runx and updated x11docker. Thought I'd use the jess/cathode example to test, but it's not working. Output below:

ubutar@perinatal151-lap:~$ x11docker jess/cathode
x11docker WARNING: User ubutar is member of group docker.
  That allows unprivileged processes on host to gain root privileges.

Failed to connect to bus: No such file or directory
x11docker note: Using X server option --runx

x11docker note: With MobyVM and WSL x11docker stores its cache files on drive C:
  to allow cache file sharing.
  Your Docker setup might not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for
  cache storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

x11docker WARNING: Request of Windows path to path within WSL:
  /mnt/c/Users/tr17/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs
  Write access from Windows host to WSL files can damage the WSL file system.
  Read-only access is ok.
  Option --share: You can add :ro to the path to allow read-only access.
  Example: --share='/mnt/c/Users/tr17/AppData/Local/Packages/CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc/LocalState/rootfs:ro'

x11docker note: Found 'WORKDIR /src' in image.
  You can change it with option --workdir=DIR.

QQmlApplicationEngine failed to load component
qrc:/main.qml:137 Type TerminalContainer unavailable
qrc:/TerminalContainer.qml:23 Type PreprocessedTerminal unavailable
qrc:/PreprocessedTerminal.qml:24 module "QMLTermWidget" is not installed

Cannot load QML interface
/usr/bin/x11docker: line 874: 13383 Terminated              watchmessagefifo

Thanks again.

@mviereck
Copy link
Owner

Could you please try:

  • Install a regular application like xterm and run runx --verbose -- xterm
  • Run x11docker x11docker/check
  • If the latter fails, please give me the output of x11docker --verbose x11docker/check at www.pastebin.com.

@mviereck mviereck reopened this May 19, 2020
@tomaroberts
Copy link
Author

tomaroberts commented May 20, 2020

It appears to have worked:

image

Also works straight from WSL.

@mviereck
Copy link
Owner

It appears to have worked:

Great!
Maybe there is an issue especially with the jess/cathode image. I cannot check it yet due to low bandwidth for download.

@tomaroberts
Copy link
Author

Hi again,

Ultimately, I want to get Ubuntu running with x11docker. Currently, the X window will open, but nothing will appear:

image

I've tried some of the other desktop environments you suggested on the x11docker landing page and have had varying degrees of success:

  • LXDE works
  • Cinnamon partially works. When it first runs, it says there is an error and needs to reboot. Rebooting gives the same error. Clicking Cancel enables you to get through to the desktop environment, but it's completely black. I can open a terminal, create new folders and view system preferences and things, but can't actually interact properly or see a toolbar.
  • Gnome doesn't work

I've also tested:

  • XaoS - this works
  • glxgears - this displays, but the cogs turn really slowly... When I run it using via the button within x11docker/check the cogs spin quickly.

There are so many things to test/try, I'm a bit lost. As I say, ultimately I want to create an ubuntu:bionic container which i can access with x11docker, so would be great if you could advise.

Thanks a lot!

@eine
Copy link
Contributor

eine commented Jun 12, 2020

@tomaroberts I think this a PEBCAK. You are starting the container without option -i and without providing a command to be executed in the container. Hence, everything starts as expected, the default entrypoint/command is executed (which is bash/dash), and it remains open. Because it is a shell, it shows/does nothing. Since it is not interactive, you cannot tell it to do anything.

However, you can docker exec from a separate shell to start some GUI app, and it should show in the Desktop window. Alternatively, just add option -i or append an app name at the end (say xterm).

@tomaroberts
Copy link
Author

Thanks for quick suggestion.

So the following significant looking error comes up if I try: x11docker -i --desktop --size 1920x1080 ubuntu:bionic

x11docker ERROR: 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. WSL1 isn't supported yet.
  WSL2 might work, but is not tested yet.

I'm on WSL1, so doesn't look like I can use this?

If I try x11docker --desktop --size 1920x1080 ubuntu:bionic xterm, then it says

/x11docker/containerrc: 168: /x11docker/containerrc: xterm: not found

Have I interpreted your message properly?

@mviereck
Copy link
Owner

@tomaroberts This is a different issue than the topic above. Please open new tickets for new issues.

@eine explained some core points. Thanks @eine!

Some basics:
You can only run applications that are installed in the image. The image ubuntu:bionic contains a core ubuntu system only. It does not contain a desktop environment and does not contain xterm. So you can't run a GUI with ubuntu:bionic.

You can build images based on ubuntu:bionic containing GUI applications.
Dockerfile example:

FROM ubuntu:bionic
RUN apt-get update
RUN apt-get install -y xterm
CMD xterm

x11docker on MS Windows has some restrictions and does not support all features that it provides on Linux.
For example, option --interactive fails in WSL as you have seen.

Cinnamon partially works.
Gnome doesn't work

Images x11docker/gnome and x11docker/cinnamon need option --init=systemd.
This is not supported in WSL; x11docker should have shown you a message if you have set --init=systemd.

LXDE works

Desktop environments not depending on systemd like Xfce, LXDE, LXQt, Mate and others should work well on MS Windows.

glxgears - this displays, but the cogs turn really slowly... When I run it using via the button within x11docker/check the cogs spin quickly.

Maybe you run it one time with --gpu and another time without?

@tomaroberts
Copy link
Author

I'm fairly new to this including Docker, so thanks for explanations. Sounds like everything is behaving as it should then. I will have a play! Cheers.

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

No branches or pull requests

3 participants