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

Fix $HOME Mounting for WSL #199

Closed
osterman opened this issue Jul 30, 2018 · 4 comments
Closed

Fix $HOME Mounting for WSL #199

osterman opened this issue Jul 30, 2018 · 4 comments
Assignees
Labels
bug 🐛 An issue with the system

Comments

@osterman
Copy link
Member

osterman commented Jul 30, 2018

what

  • Mounting $HOME to /localhost is not working on WSL (Windows Shell for Linux)

why

  • Explain why this is a problem and what is the expected behavior.
  • Explain why this feature request or enhancement is beneficial.

examples

This works:

docker run -it --rm -v /C/Users/sebas_000/AppData/Local/lxss/home/martaver:/test alpine sh

This does not:

docker run -it --rm -v /home/martaver:/test alpine sh

Maybe we should do something like in the wrapper script if we detect WSL:

mount --bind /mnt/c /c

or

mount --bind /C/Users/sebas_000/AppData/Local/lxss/home/martaver /home/martaver

references

@martaver
Copy link
Contributor

martaver commented Aug 1, 2018

There's a current explicit workaround that treats WSL as a special case. The make install script needs to be updated to ensure the vendor script uses the following at line 92:

echo "# Mounting ${HOME} into container"      
      if  [[ $(cat /proc/version) =~ Microsoft ]] ;
      then        
        localHome=/$(cmd.exe /c echo %LOCALAPPDATA% | tr -d '\r' | sed -e 's/\\/\//g' -e 's/://')/lxss$HOME
        echo Detected Windows Subsystem for Linux, mounting $localHome instead of $HOME
      else
        localHome=$HOME
      fi
      DOCKER_ARGS+=(--volume=${localHome}:/localhost)

@martaver
Copy link
Contributor

martaver commented Aug 1, 2018

This script detects WSL, and if it is, figures out the local (windows) directory path to $HOME.

This works because Docker for Windows can see /c as a volume. Using Docker for Windows on hyper-v, hyper-v does not mount any volume as /home/username as in $HOME, and so using the plain $HOME var from WSL fails.

@vadim-hleif
Copy link
Contributor

vadim-hleif commented Aug 2, 2018

@martaver Hello,

  • Why do you use lxss directory?
  • Did you install wsl from market?
  • Which version of wsl do you use?

references

@vadim-hleif
Copy link
Contributor

Fixed

leb4r pushed a commit that referenced this issue Jan 25, 2022
* Upgrade to 0.6.3

* Upgrade readme

* abuild does not support masked deps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
Development

No branches or pull requests

3 participants