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

🤯 WSL symlink is different from Native Linux (VM/Container) symlink #3611

Closed
safizn opened this issue Oct 12, 2018 · 6 comments
Closed

🤯 WSL symlink is different from Native Linux (VM/Container) symlink #3611

safizn opened this issue Oct 12, 2018 · 6 comments

Comments

@safizn
Copy link

safizn commented Oct 12, 2018

Symlinks interoperability is a must ! Creating symbolic links files either on WSL or from other Linux distributions should be able to work between them (not mentioning Windows OS, only Linux distributions, i.e. VM/Container with shared files with WSL host machine).

It is really weird that for allowing Windows Subsystem for Linux symlinks to work with Windows OS symlinks, interoperability is dropped for Native Linux Kernel. A huge bottleneck for adopting WSL and subsequently Windows for development.
Personally I'm on the verge of switching to a Linux setup for development and dropping Windows as development/user OS altogether, was using Cygwin & Bash.exe till now. It seems that there will always be issues that requires days of searching for a solution, but this one was enough for me (wish I could find this mentioned in the docs before attempting to change my setup).

Use case:

Working with node_modules/.bin/<symlinks> that where installed with WSL or using native Linux. In such case NPM/Yarn on Linux creates relative symlinks for the .bin scripts.

Symlinks support between WSL, Native Linux, Windows OS:

○ WSL created symlink:
wsl

  • WSL - ✔️ Symlink
  • Docker container - ❌permission denied (No such file or directory).
  • Ubuntu Hyper-V VM - ❌ shows as a text file.
  • Windows - ✔️ Symlink

○ Linux Container/VM created symlink:
linuxmobyvm or container

  • WSL - ❌ shows as a text file.
  • Docker container - ✔️ Symlink
  • Ubuntu Hyper-V VM - ✔️ Symlink
  • Windows - ❌ shows as a text file.

○ Windows created symlink: Regular soft symbolic link (not Junction)
windows

  • WSL - ✔️ Symlink
  • Docker container - ❌permission denied (No such file or directory).
  • Ubuntu Hyper-V VM - ❌ shows as text file.
  • Windows - ✔️ Symlink

Versions:

  • Windows 10 Pro 1803, OS build 17134.345, Developer mode turned on.
  • WSL Debian GNU/Linux 9.5 (stretch)
  • Docker for Windows 2.0.0.0-beta1-win75 (19925) edge 915f68b
  • MobyLinuxVM kernel 4.9.125-linuxkit
  • Docker Engine: 18.09.0-ce-beta1
  • Container - any Linux container.
  • Hyper-V VM Ubuntu 18.04.1

😟 Will symlinks ever be supported between WSL and native Linux ?

@safizn safizn changed the title 🤯 WSL symlink is different from VM/Container Linux symlink 🤯 WSL symlink is different from Native Linux symlink (VM/Container) Oct 12, 2018
@safizn safizn changed the title 🤯 WSL symlink is different from Native Linux symlink (VM/Container) 🤯 WSL symlink is different from Native Linux (VM/Container) symlink Oct 12, 2018
@therealkenc
Copy link
Collaborator

#1475

@safizn
Copy link
Author

safizn commented Oct 12, 2018

@therealkenc Have you even looked at the issue ? It is not fixed.
Symlinks created by WSL cannot be opened on native Linux (like in containers or VMs).

@RDeluxe
Copy link

RDeluxe commented Oct 21, 2018

I think this issue should be still opened.

I'm encountering the exact same issue:

  • npm install in WSL (creates symlinks in node_modules/.bin/)
  • docker-compose up mounts my app in a volume in a alpine container
  • inside the container, all the symlinks are broken

In this case, I'm not quite sure who to blame : WSL or Docker.

@devoto13
Copy link

devoto13 commented Nov 6, 2018

@therealkenc I experience exactly the same issue as @RDeluxe using build 17134.376. #1475 (comment) mentions that fix is included in 17046, so I assume it should already have it. Or is it not the case?

If the fix is already included, please, consider re-opening this issue as at least part of it is still not working as desired.

Anyway here are steps to reproduce the issue without Node/Npm and Docker Compose:

  1. Install Docker for Windows and configure Docker client inside WSL to connect to it (guide).
  2. Open WSL bash and follow the steps:
WSL $ cat 1.sh
#!/bin/sh
echo 1
WSL $ chmod +x 1.sh
WSL $ ln -s ./1.sh 2.sh
WSL $ ls -la
total 0
drwxrwxrwx 1 kushtrim kushtrim 4096 Nov  6 12:58 .
drwxrwxrwx 1 kushtrim kushtrim 4096 Nov  6 11:57 ..
-rwxrwxrwx 1 kushtrim kushtrim   18 Nov  6 12:57 1.sh
lrwxrwxrwx 1 kushtrim kushtrim    6 Nov  6 12:58 2.sh -> ./1.sh
# Both work under WSL
WSL $ ./1.sh
1
WSL $ ./2.sh
1

WSL $ docker run -it --rm -v `pwd`:/opt/test alpine sh
/ # cd opt/test/
/opt/test # ls -la
total 5
drwxrwxrwx    2 root     root             0 Nov  6 11:58 .
drwxr-xr-x    3 root     root          4096 Nov  6 12:03 ..
-rwxr-xr-x    1 root     root            18 Nov  6 11:57 1.sh
ls: ./2.sh: cannot read link: No such file or directory
l---------    1 root     root             0 Nov  6 11:58 2.sh
# Symlink does not work when run inside Docker container being mounted as a volume
/opt/test # ./1.sh
1
/opt/test # ./2.sh
sh: ./2.sh: not found

@therealkenc
Copy link
Collaborator

@devoto13 - do you have developer mode enabled in your Windows 10.

@devoto13
Copy link

devoto13 commented Nov 7, 2018

@therealkenc Yes, enabling developer mode fixes the symlink problem. Sorry for the false alarm.

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

4 participants