Skip to content

Symlink woes #6

Closed
Closed

Description

@kobaltz

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.

Activity

  1. mizzle-mo commented on Apr 7, 2016

    @mizzle-mo

    NTFS has supported symlinks since Windows 2000. NTFS Junction Point

  2. jokeyrhyme commented on Apr 7, 2016

    @jokeyrhyme

    Related to #3 and/or #9 ?

  3. robertsmieja commented on Apr 7, 2016

    @robertsmieja

    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.

  4. denisw commented on Apr 7, 2016

    @denisw

    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.

  5. mizzle-mo commented on Apr 7, 2016

    @mizzle-mo

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

    image

  6. denisw commented on Apr 7, 2016

    @denisw

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

  7. poizan42 commented on Apr 7, 2016

    @poizan42

    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.

  8. spichardo commented on Apr 7, 2016

    @spichardo

    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

  9. spichardo commented on Apr 7, 2016

    @spichardo

    and this is also related to #50

  10. tinysun212 commented on Apr 8, 2016

    @tinysun212

    pointed the same thing to #9

  11. hacst commented on Apr 9, 2016

    @hacst

    What Kasper Fabæch Brandt (@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.

  12. JonHerr commented on Apr 11, 2016

    @JonHerr

    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.

  13. MadcowD commented on Apr 12, 2016

    @MadcowD

    This issue has been closed #9 Rich Turner (@bitcrazed) please closed this #6

  14. russalex commented on Apr 19, 2016

    @russalex
    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
    
  15. 4 remaining items

  16. russalex commented on May 11, 2016

    @russalex
    Contributor

    Stefan Hacker (@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.

  17. drvink commented on Jun 2, 2016

    @drvink

    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!

  18. russalex commented on Jun 2, 2016

    @russalex
    Contributor

    Mark Laws (@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.

  19. drvink commented on Jun 3, 2016

    @drvink

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

  20. drvink commented on May 20, 2017

    @drvink

    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, Russ Alexander (@russalex)!

  21. wclr commented on Jun 3, 2017

    @wclr

    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?

  22. wclr commented on Jun 3, 2017

    @wclr

    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 =)

  23. nick4fake commented on Jul 20, 2017

    @nick4fake

    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.

  24. nick4fake commented on Jul 20, 2017

    @nick4fake

    Sorry, just saw #353

  25. jan4984 commented on Nov 19, 2018

    @jan4984

    I have a removable ntfs driver, it worked in a ubuntu, on which symbolic links created. now when I connect the ntfs driver to windows and wsl, the links all not work.

    is any way keep my links between ubuntu and wsl?

  26. cavaunpeu commented on Dec 2, 2018

    @cavaunpeu
    $ cd /mnt/c/foo
    $ echo "bar" > baz
    $ ln -s baz bazlink
    
    ...Open Powershell...
    
    $ PS C:\foo> cat bazlink
    bar
    

    However, when I:

    $ cd ~
    $ echo "pickles" > skittles
    $ cd /mnt/c/foo
    $ ln -s ~/skittles skittleslink
    
    ...Open Powershell...
    
    $ PS C:\foo> cat .\skittleslink
    cat : The file cannot be accessed by the system.
    At line:1 char:1
    + cat .\skittleslink
    + ~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ReadError: (C:\foo\skittleslink:String) [Get-Content], IOException
        + FullyQualifiedErrorId : GetContentReaderIOError,Microsoft.PowerShell.Commands.GetContentCommand
    
  27. DynConcepts commented on Feb 27, 2024

    @DynConcepts
    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
    

    Yes, but now exit WSL [or simply open a CMD prompt window and go to D:\temp and try to access things....

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions