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

Symlink woes #6

Closed
kobaltz opened this Issue Apr 7, 2016 · 27 comments

Comments

Projects
None yet
@kobaltz

kobaltz commented Apr 7, 2016

While I understand that NTFS does not support Symlinks, it is something that would be extremely helpful. The issue that i've found is that any tarball package that has symlinks will simply be broken in the sense that the link is never created. Granted that packages/installers should be able to work around this, but I've already come across this issue within hours of playing around. I can see this causing several issues down the road.

Think of an installer that installs something to /opt/software but creates a symlink to the executable to /usr/local/bin so it would be ready for use immediately without explicitly specifying the path.

@mike-morr

This comment has been minimized.

Show comment
Hide comment
@mike-morr

mike-morr Apr 7, 2016

NTFS has supported symlinks since Windows 2000. NTFS Junction Point

mike-morr commented Apr 7, 2016

NTFS has supported symlinks since Windows 2000. NTFS Junction Point

@jokeyrhyme

This comment has been minimized.

Show comment
Hide comment
@jokeyrhyme

jokeyrhyme Apr 7, 2016

Related to #3 and/or #9 ?

jokeyrhyme commented Apr 7, 2016

Related to #3 and/or #9 ?

@robertsmieja

This comment has been minimized.

Show comment
Hide comment
@robertsmieja

robertsmieja Apr 7, 2016

Look under "Is there any distinction between files in the Linux drive and the mounted Windows drives?" at https://msdn.microsoft.com/en-us/commandline/wsl/faq

I don't believe they intend for Linux symlinks to be able to point to Windows, but Linux symlinks from the Linux filesystem to the Linux filesystem should be fine.

robertsmieja commented Apr 7, 2016

Look under "Is there any distinction between files in the Linux drive and the mounted Windows drives?" at https://msdn.microsoft.com/en-us/commandline/wsl/faq

I don't believe they intend for Linux symlinks to be able to point to Windows, but Linux symlinks from the Linux filesystem to the Linux filesystem should be fine.

@denisw

This comment has been minimized.

Show comment
Hide comment
@denisw

denisw Apr 7, 2016

The inability to have symlinks between the Linux and Windows filesystems is unfortunate. For instance, this means that you cannot create a Python virtual environment on a Windows drive because that requires the venv tool to symlink /usr/bin/python and other stuff into the environment directory. It would be great if this restriction could somehow be relaxed!

More serious, though, is not being able to create symlinks within the Windows mount. Even when running Bash as an administrator, I wasn't able to create, a symlink /mnt/c/bar.txt to a file /mnt/c/foo.txt. This is absolutely required for installing many Node packages via NPM, for instance.

denisw commented Apr 7, 2016

The inability to have symlinks between the Linux and Windows filesystems is unfortunate. For instance, this means that you cannot create a Python virtual environment on a Windows drive because that requires the venv tool to symlink /usr/bin/python and other stuff into the environment directory. It would be great if this restriction could somehow be relaxed!

More serious, though, is not being able to create symlinks within the Windows mount. Even when running Bash as an administrator, I wasn't able to create, a symlink /mnt/c/bar.txt to a file /mnt/c/foo.txt. This is absolutely required for installing many Node packages via NPM, for instance.

@mike-morr

This comment has been minimized.

Show comment
Hide comment
@mike-morr

mike-morr Apr 7, 2016

I just created a symlink from ~/home -> /mnt/c/Users/tellm and it worked fine.

image

mike-morr commented Apr 7, 2016

I just created a symlink from ~/home -> /mnt/c/Users/tellm and it worked fine.

image

@denisw

This comment has been minimized.

Show comment
Hide comment
@denisw

denisw Apr 7, 2016

This direction (symlink from Linux to Windows) indeed works - the other one (symlink from Windows to Linux) doesn't.

denisw commented Apr 7, 2016

This direction (symlink from Linux to Windows) indeed works - the other one (symlink from Windows to Linux) doesn't.

@poizan42

This comment has been minimized.

Show comment
Hide comment
@poizan42

poizan42 Apr 7, 2016

There may be a bit of a problem with that since users on Windows by default don't have SeCreateSymbolicLinkPrivilege. As I understand this was done because as lots of applications and maybe even device drivers out there may have subtle security issues with symbolic links.

Requiring users to hold a certain privilege to create symlinks doesn't goes well with posix compatibility either.

poizan42 commented Apr 7, 2016

There may be a bit of a problem with that since users on Windows by default don't have SeCreateSymbolicLinkPrivilege. As I understand this was done because as lots of applications and maybe even device drivers out there may have subtle security issues with symbolic links.

Requiring users to hold a certain privilege to create symlinks doesn't goes well with posix compatibility either.

@spichardo

This comment has been minimized.

Show comment
Hide comment
@spichardo

spichardo Apr 7, 2016

The issue with symlinks happens when you either try to tar to directory with symlinks or untar that contains them, look the simple example:

root@localhost:# mkdir test
root@localhost:
# cd test
root@localhost:/test# echo "this is a file" > t.xt
root@localhost:
/test# ln -s t.xt link_to_file
root@localhost:/test# ls -l
total 0
lrwxrwxrwx 1 root root 4 Apr 7 23:43 link_to_file -> t.xt
-rw-rw-rw- 1 root root 15 Apr 7 23:43 t.xt
root@localhost:
/test# cd ..
root@localhost:~# tar cfz test.gz test/
tar: test/link_to_file: Cannot readlink: Invalid argument
tar: Exiting with failure status due to previous errors

spichardo commented Apr 7, 2016

The issue with symlinks happens when you either try to tar to directory with symlinks or untar that contains them, look the simple example:

root@localhost:# mkdir test
root@localhost:
# cd test
root@localhost:/test# echo "this is a file" > t.xt
root@localhost:
/test# ln -s t.xt link_to_file
root@localhost:/test# ls -l
total 0
lrwxrwxrwx 1 root root 4 Apr 7 23:43 link_to_file -> t.xt
-rw-rw-rw- 1 root root 15 Apr 7 23:43 t.xt
root@localhost:
/test# cd ..
root@localhost:~# tar cfz test.gz test/
tar: test/link_to_file: Cannot readlink: Invalid argument
tar: Exiting with failure status due to previous errors

@spichardo

This comment has been minimized.

Show comment
Hide comment
@spichardo

spichardo Apr 7, 2016

and this is also related to #50

spichardo commented Apr 7, 2016

and this is also related to #50

@tinysun212

This comment has been minimized.

Show comment
Hide comment
@tinysun212

tinysun212 Apr 8, 2016

pointed the same thing to #9

tinysun212 commented Apr 8, 2016

pointed the same thing to #9

@hacst

This comment has been minimized.

Show comment
Hide comment
@hacst

hacst Apr 9, 2016

What @poizan42 mentioned about permissions is exacerbated by the fact that - as far as I understand split tokens in UAC - non-elevated processes of users in admin groups (it's RID based, msdn has the details) can never have that privilege. Even if you edit the group policy to add it for everyone that just gets filtered out with no way to override it. Imho this is a major pita and it has bitten me outside of this specific issue. It makes using symlinks on dev setups (whose accounts tend to have admin rights) nearly impossible. Basically you can make it work for the Guest account but not without elevation for an admin :( Would love to see that resolved.

hacst commented Apr 9, 2016

What @poizan42 mentioned about permissions is exacerbated by the fact that - as far as I understand split tokens in UAC - non-elevated processes of users in admin groups (it's RID based, msdn has the details) can never have that privilege. Even if you edit the group policy to add it for everyone that just gets filtered out with no way to override it. Imho this is a major pita and it has bitten me outside of this specific issue. It makes using symlinks on dev setups (whose accounts tend to have admin rights) nearly impossible. Basically you can make it work for the Guest account but not without elevation for an admin :( Would love to see that resolved.

@JonHerr

This comment has been minimized.

Show comment
Hide comment
@JonHerr

JonHerr Apr 11, 2016

I will add to the symlink issue. I tried to install NVM (node version manager) and RVM (ruby version manager) I ran into issues with cannot create symlink to "" Invalid argument. these tools are essential as working with multiple products I need to be able to easily change which verion of node and ruby I am using.

JonHerr commented Apr 11, 2016

I will add to the symlink issue. I tried to install NVM (node version manager) and RVM (ruby version manager) I ran into issues with cannot create symlink to "" Invalid argument. these tools are essential as working with multiple products I need to be able to easily change which verion of node and ruby I am using.

@MadcowD

This comment has been minimized.

Show comment
Hide comment
@MadcowD

MadcowD Apr 12, 2016

This issue has been closed #9 @bitcrazed please closed this #6

MadcowD commented Apr 12, 2016

This issue has been closed #9 @bitcrazed please closed this #6

@russalex

This comment has been minimized.

Show comment
Hide comment
@russalex

russalex Apr 19, 2016

Contributor

Wanted to update this one since it's one of our oldest threads.

We have much better symlink support checked into our dev branches. No ETA on when it will hit Insiders, and I expect that the support will roll out slowly (we did not fix all the issues at once). What I can show is what ran on an internal branch:

russ@RUSSALEX-DESK:/mnt/d/temp$ touch file
russ@RUSSALEX-DESK:/mnt/d/temp$ ln -s file filelink
russ@RUSSALEX-DESK:/mnt/d/temp$ ln -s ~ home
russ@RUSSALEX-DESK:/mnt/d/temp$ ll
total 4
drwxrwxrwx 2 root root  0 Apr 19 23:33 ./
drwxrwxrwx 2 root root  0 Apr 19 20:17 ../
-rwxrwxrwx 1 root root  0 Apr 19 23:33 file*
lrwxrwxrwx 1 root root  4 Apr 19 23:33 filelink -> file*
lrwxrwxrwx 1 root root 10 Apr 19 23:33 home -> /home/russ/
russ@RUSSALEX-DESK:/mnt/d/temp$ cd home
russ@RUSSALEX-DESK:/mnt/d/temp/home$ ll
total 24
drwxr-xr-x 2 russ russ    0 Apr 19 19:34 ./
drwxr-xr-x 2 root root    0 Jan  1  1970 ../
-rw------- 1 russ russ 2043 Apr 19 23:03 .bash_history
-rw-r--r-- 1 russ russ  220 Apr 18 18:40 .bash_logout
-rw-r--r-- 1 russ russ 3636 Apr 18 18:41 .bashrc
lrwxrwxrwx 1 russ russ    4 Apr 19 23:32 home -> home
-rw-r--r-- 1 russ russ  675 Apr 18 18:40 .profile
drwxrwxrwx 2 russ russ    0 Apr 19 22:53 tmp/
-rw------- 1 russ russ 1159 Apr 18 18:43 .viminfo
Contributor

russalex commented Apr 19, 2016

Wanted to update this one since it's one of our oldest threads.

We have much better symlink support checked into our dev branches. No ETA on when it will hit Insiders, and I expect that the support will roll out slowly (we did not fix all the issues at once). What I can show is what ran on an internal branch:

russ@RUSSALEX-DESK:/mnt/d/temp$ touch file
russ@RUSSALEX-DESK:/mnt/d/temp$ ln -s file filelink
russ@RUSSALEX-DESK:/mnt/d/temp$ ln -s ~ home
russ@RUSSALEX-DESK:/mnt/d/temp$ ll
total 4
drwxrwxrwx 2 root root  0 Apr 19 23:33 ./
drwxrwxrwx 2 root root  0 Apr 19 20:17 ../
-rwxrwxrwx 1 root root  0 Apr 19 23:33 file*
lrwxrwxrwx 1 root root  4 Apr 19 23:33 filelink -> file*
lrwxrwxrwx 1 root root 10 Apr 19 23:33 home -> /home/russ/
russ@RUSSALEX-DESK:/mnt/d/temp$ cd home
russ@RUSSALEX-DESK:/mnt/d/temp/home$ ll
total 24
drwxr-xr-x 2 russ russ    0 Apr 19 19:34 ./
drwxr-xr-x 2 root root    0 Jan  1  1970 ../
-rw------- 1 russ russ 2043 Apr 19 23:03 .bash_history
-rw-r--r-- 1 russ russ  220 Apr 18 18:40 .bash_logout
-rw-r--r-- 1 russ russ 3636 Apr 18 18:41 .bashrc
lrwxrwxrwx 1 russ russ    4 Apr 19 23:32 home -> home
-rw-r--r-- 1 russ russ  675 Apr 18 18:40 .profile
drwxrwxrwx 2 russ russ    0 Apr 19 22:53 tmp/
-rw------- 1 russ russ 1159 Apr 18 18:43 .viminfo
@denisw

This comment has been minimized.

Show comment
Hide comment
@denisw

denisw Apr 20, 2016

Awesome! That is pretty much the missing link (pun intended) to make Bash on Windows work for me. Looking forward to seeing these changes in future Insider builds!

denisw commented Apr 20, 2016

Awesome! That is pretty much the missing link (pun intended) to make Bash on Windows work for me. Looking forward to seeing these changes in future Insider builds!

@sunilmut

This comment has been minimized.

Show comment
Hide comment
@sunilmut

sunilmut Apr 22, 2016

Member

symlink improvements were made in the new Windows build 14328, WSL specific release notes are here
If this build resolves the issue, we would like to close this out.

Member

sunilmut commented Apr 22, 2016

symlink improvements were made in the new Windows build 14328, WSL specific release notes are here
If this build resolves the issue, we would like to close this out.

@hacst

This comment has been minimized.

Show comment
Hide comment
@hacst

hacst Apr 22, 2016

Awesome work. Could you talk a bit about how this is implemented technically? Are those symlinks backed by NTFS or something special to WSL? In case of the former I would love to know how the permissions are handled w.r.t SeCreateSymbolicLinkPrivilege and dual/split tokens in admin accounts.

hacst commented Apr 22, 2016

Awesome work. Could you talk a bit about how this is implemented technically? Are those symlinks backed by NTFS or something special to WSL? In case of the former I would love to know how the permissions are handled w.r.t SeCreateSymbolicLinkPrivilege and dual/split tokens in admin accounts.

@russalex russalex added the fixinbound label Apr 25, 2016

@russalex russalex added fixed and removed fixinbound labels May 11, 2016

@russalex

This comment has been minimized.

Show comment
Hide comment
@russalex

russalex May 11, 2016

Contributor

@hacst, We have a few more blog posts in the works with one of them being a deep dive into the filesystem. Stay tuned.

To answer your immediate question, these symlinks are not backed by NTFS.

I'll be closing this issue out soon to keep things clean.

Contributor

russalex commented May 11, 2016

@hacst, We have a few more blog posts in the works with one of them being a deep dive into the filesystem. Stay tuned.

To answer your immediate question, these symlinks are not backed by NTFS.

I'll be closing this issue out soon to keep things clean.

@russalex russalex closed this May 16, 2016

@drvink

This comment has been minimized.

Show comment
Hide comment
@drvink

drvink Jun 2, 2016

This is only barely related, but it has been a thorn in my (and many, many others) side for years, and I don't know where else to bring it up, but: since we're now getting sane symlink behavior in one Windows subsystem, can we please, please, please for the love of god, finally correct the behavior in which UAC removes SeCreateSymbolicLinkPrivilege from users' tokens if they're in the Administrators group, even if they've explicitly been given the privilege in some other way? Remember, this insane behavior is ONLY applied to members of the Administrators group--if you give a normal user account permission to create symlinks, they can do it just fine, with no need to elevate!

drvink commented Jun 2, 2016

This is only barely related, but it has been a thorn in my (and many, many others) side for years, and I don't know where else to bring it up, but: since we're now getting sane symlink behavior in one Windows subsystem, can we please, please, please for the love of god, finally correct the behavior in which UAC removes SeCreateSymbolicLinkPrivilege from users' tokens if they're in the Administrators group, even if they've explicitly been given the privilege in some other way? Remember, this insane behavior is ONLY applied to members of the Administrators group--if you give a normal user account permission to create symlinks, they can do it just fine, with no need to elevate!

@russalex

This comment has been minimized.

Show comment
Hide comment
@russalex

russalex Jun 2, 2016

Contributor

@drvink, I feel your pain here and have forwarded this along to the correct team.

Additionally, you should start something over on our User Voice. We have a number of symlink suggestions over there but they are all around WSL. Getting this as a separate item may be helpful.

Contributor

russalex commented Jun 2, 2016

@drvink, I feel your pain here and have forwarded this along to the correct team.

Additionally, you should start something over on our User Voice. We have a number of symlink suggestions over there but they are all around WSL. Getting this as a separate item may be helpful.

@drvink

This comment has been minimized.

Show comment
Hide comment
@drvink

drvink Jun 3, 2016

@russalex, this is wonderful to hear. Thank you so much! I'll add a UV suggestion too.

drvink commented Jun 3, 2016

@russalex, this is wonderful to hear. Thank you so much! I'll add a UV suggestion too.

@drvink

This comment has been minimized.

Show comment
Hide comment
@drvink

drvink May 20, 2017

Updating this thread with some good news for anyone who finds it: it is possible to create symlinks without elevation as of Windows 10 build 14972 if "developer mode" is enabled. Thanks again, @russalex!

drvink commented May 20, 2017

Updating this thread with some good news for anyone who finds it: it is possible to create symlinks without elevation as of Windows 10 build 14972 if "developer mode" is enabled. Thanks again, @russalex!

@whitecolor

This comment has been minimized.

Show comment
Hide comment
@whitecolor

whitecolor Jun 3, 2017

I have currently build 15063 on Windows Insiders Preview, I create sysmlink in windows (symlink target is on the same drive) and I can not read it on WSL. When it is going to be working?

whitecolor commented Jun 3, 2017

I have currently build 15063 on Windows Insiders Preview, I create sysmlink in windows (symlink target is on the same drive) and I can not read it on WSL. When it is going to be working?

@whitecolor

This comment has been minimized.

Show comment
Hide comment
@whitecolor

whitecolor Jun 3, 2017

Hm it seems it works but in strange manner: I can not see linked directory when I do ls -a, can I can not readlink /path/to/linked_folder but I can work with nested folders and files, ls or read them =)

whitecolor commented Jun 3, 2017

Hm it seems it works but in strange manner: I can not see linked directory when I do ls -a, can I can not readlink /path/to/linked_folder but I can work with nested folders and files, ls or read them =)

@nick4fake

This comment has been minimized.

Show comment
Hide comment
@nick4fake

nick4fake Jul 20, 2017

Hey,

Good work guys, thank you a lot for all your patience bringing this up into windows!

I have just a small follow-up question: what about cross windows/wsl symlinks?

I'd really love the symlink to be created from bash as NTFS symlink on real drive for compatibility.

nick4fake commented Jul 20, 2017

Hey,

Good work guys, thank you a lot for all your patience bringing this up into windows!

I have just a small follow-up question: what about cross windows/wsl symlinks?

I'd really love the symlink to be created from bash as NTFS symlink on real drive for compatibility.

@nick4fake

This comment has been minimized.

Show comment
Hide comment
@nick4fake

nick4fake Jul 20, 2017

Sorry, just saw #353

nick4fake commented Jul 20, 2017

Sorry, just saw #353

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