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 does not respect Windows-side symlinks #5701

Closed
elibarzilay opened this issue Aug 2, 2020 · 8 comments
Closed

wsl does not respect Windows-side symlinks #5701

elibarzilay opened this issue Aug 2, 2020 · 8 comments

Comments

@elibarzilay
Copy link

Environment

Windows build number: 10.0.20180.0
Your Distribution version: Ubuntu 18.04
WSL version: WSL 2

Steps to reproduce

Use CMD to create a synlink to somewhere inside the WSL FS, in my case:

mklink /d c:\eli \\wsl\Ubuntu-18.04\home\eli

Then cd into it, and use the wsl command -- it always starts with the root / as its working directory. For example:

C:\eli>wsl pwd
/

Expected behavior

Expected to resolve the windows-side link before resorting to using /.

Actual behavior

Uses /.

Use case

Just to clarify my use case: I use both Linux & Windows heavily, so I want to have an easy short path to my home directory on the WSL side. (In WSL1, my home directory was actually at c:\eli, with the WSL1 /home/eli being a symlink to it, and I now decided to try the switch to WSL2.) Using mklink as above works nicely (with a minor caveat that it doesn't exist until I start WSL), but using wsl itself to start stuff from windows doesn't get the correct directory. For example, I'd expect to just run wsl and get a linux shell at my directory, but if I'm in the symlink, it starts at /.

@therealkenc
Copy link
Collaborator

/dupe #5118 (with a tangential side order of #4868)

@ghost
Copy link

ghost commented Aug 3, 2020

Hi! We've identified this issue as a duplicate of another one that already exists in this repository. This specific instance is being closed in favor of tracking the concern over on the referenced thread.

Thanks for your report!

@ghost ghost added the duplicate label Aug 3, 2020
@elibarzilay
Copy link
Author

@therealkenc, I have seen #5118 before posting this, and I also read through #4868 now -- it looks to me like both of these are about making WSL-side symlinks work on the windows side, but this is not what I'm talking about here. This one is about the Windows-side wsl command not respecting a symlinked directory if you're in one (ie, I'm talking about a symlink that was created in CMD using mklink).

@razamatan
Copy link

i'm hitting this bug, but at a file level.

i currently have my windows terminal settings.json file (%LOCALAPPDATA%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json) linked to my dotfiles in wsl (dir output: <SYMLINK> settings.json [\\wsl$\Ubuntu\home\razamatan\.dotfiles\settings.json]).

since wsl2 switched to vhd's, if i try to open terminal w/o starting wsl to load the vhd, i get the "Encountered errors while loading user settings" error dialog. i have to remember to always start wsl to allow wt to be able to read from this (and any other) symlink to \wsl$ files.

it would be great to automatically load wsl if trying to access any symlink that points to wsl paths.

@elibarzilay
Copy link
Author

@razamatan, this is a separate issue (which I originally mentioned originally as a caveat).

BTW, I have a startup script (made in the Task Scheduler) that starts WSL when windows starts -- that would be an easy way to ensure that WSL starts automatically.

@razamatan
Copy link

ok.. i'll create a new issue.

@razamatan
Copy link

razamatan commented Feb 5, 2021 via email

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

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