specifying a directory on a mounted drive or a symbolic link to a directory on a mounted drive as the starting directory does not work #11221

Closed
opened 2026-01-31 02:41:50 +00:00 by claunia · 7 comments
Owner

Originally created by @gkamendje on GitHub (Oct 30, 2020).

Environment

Windows build number:  19041.572
Windows Terminal version (if applicable): 1.2.2381.0

Any other software?

In the Windows Terminal Json file, specifying a directory on a mounted drive or a symbolic link to a directory on a mounted drive as the starting directory does not work at all.

Steps to reproduce

For example for me, the following works well.
"startingDirectory" : "//wsl$/Ubuntu/home/<User>/"
This works also
"startingDirectory" : "//wsl$/Ubuntu/home/<User>/a_sub_dir_of_my_home"

However, setting a directory on a mounted drive as the starting directory does not work.
"startingDirectory" : "//wsl$/Ubuntu/mnt/e/mydir_on_drive_e"
This does not work either
"startingDirectory" : "//wsl$/Ubuntu/home/<User>/<Symbolic_link_to_a_directory_located_on_one_of_the_mounted_drives>"

Expected behavior

WSL should open in the specified directory

Actual behavior

WSL opens into the default directory

Originally created by @gkamendje on GitHub (Oct 30, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: 19041.572 Windows Terminal version (if applicable): 1.2.2381.0 Any other software? ``` In the Windows Terminal Json file, specifying a directory on a mounted drive or a symbolic link to a directory on a mounted drive as the starting directory does not work at all. # Steps to reproduce For example for me, the following works well. `"startingDirectory" : "//wsl$/Ubuntu/home/<User>/"` This works also `"startingDirectory" : "//wsl$/Ubuntu/home/<User>/a_sub_dir_of_my_home"` However, setting a directory on a mounted drive as the starting directory does not work. `"startingDirectory" : "//wsl$/Ubuntu/mnt/e/mydir_on_drive_e"` This does not work either `"startingDirectory" : "//wsl$/Ubuntu/home/<User>/<Symbolic_link_to_a_directory_located_on_one_of_the_mounted_drives>"` # Expected behavior WSL should open in the specified directory # Actual behavior WSL opens into the default directory
claunia added the Resolution-Duplicate label 2026-01-31 02:41:50 +00:00
Author
Owner

@skyline75489 commented on GitHub (Oct 30, 2020):

For what it's worth, you can actually use the Windows path directly instead of the transformed WSL path of the mounted drives:

{
    "startingDirectory": "D:/Projects"
}

Crazy, right? But it works pretty well.

@skyline75489 commented on GitHub (Oct 30, 2020): For what it's worth, you can actually use the Windows path directly instead of the transformed WSL path of the mounted drives: ```json { "startingDirectory": "D:/Projects" } ``` Crazy, right? But it works pretty well.
Author
Owner

@zadjii-msft commented on GitHub (Oct 30, 2020):

Out of curiosity, is there a reason you want to provide the path as the //wsl$/<distro>/mnt/<drive>/<path> format, over the <drive>:/<path> format? Because the second does seem like a lot less hassle...

#7197 seemed related, but that's more "WSL paths don't always work" rather than "a windows path inside the linux path to the mount doesn't work"

@zadjii-msft commented on GitHub (Oct 30, 2020): Out of curiosity, is there a reason you want to provide the path as the `//wsl$/<distro>/mnt/<drive>/<path>` format, over the `<drive>:/<path>` format? Because the second does seem like a lot less hassle... #7197 seemed related, but that's more "WSL paths don't always work" rather than "a windows path inside the linux path to the mount doesn't work"
Author
Owner

@ghost commented on GitHub (Nov 3, 2020):

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost commented on GitHub (Nov 3, 2020): This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**.
Author
Owner

@gkamendje commented on GitHub (Nov 3, 2020):

These are all valid workarounds. The only problem I see is the fact that with a symbolic link in the user home directory, the resulting prompt in the shell can be made arbitrarily short. Something like ~/my_sym_link_to_bar$ whereas with the Windows path option, the path becomes
/mnt/drive/project/dir/sub/foo/bar$. I am aware that there are ways to play around with the prompt but this is certainly another story. I was just curious to see if there was a way to make the symbolic link option work (It should work technically given that it is a valid path inside the Linux Distro).

@gkamendje commented on GitHub (Nov 3, 2020): These are all valid workarounds. The only problem I see is the fact that with a symbolic link in the user home directory, the resulting prompt in the shell can be made arbitrarily short. Something like ~/my_sym_link_to_bar$ whereas with the Windows path option, the path becomes /mnt/drive/project/dir/sub/foo/bar$. I am aware that there are ways to play around with the prompt but this is certainly another story. I was just curious to see if there was a way to make the symbolic link option work (It should work technically given that it is a valid path inside the Linux Distro).
Author
Owner

@skyline75489 commented on GitHub (Nov 6, 2020):

As far as I know, startingDirectory is a parameter that we passed to wsl.exe (or whatever program in the profile) for it to consume and and know where the desired working directory is. This happens on the Win32 level. This is also the reason why <drive>:/<path> works in the first place. Everything in startingDirectory strictly belongs to the Win32 realm. The transformed format //wsl$/<distro>/mnt/<drive>/<path> is in fact a network path that is mounted internally by Windows, to make files in Linux accessible.

A symbolic link, if I'm not mistaken, is a Linux OS & filesystem specific thing, that is currently not recognized in the process we described. Part of the reason why it's not supported might be the fact that Windows does not support ext4 or any Linux filesystem.

If you really want to know whether this will be supported in the future, https://github.com/microsoft/WSL is probably the best place to ask.

@skyline75489 commented on GitHub (Nov 6, 2020): As far as I know, `startingDirectory` is a parameter that we passed to `wsl.exe` (or whatever program in the profile) for it to consume and and know where the desired working directory is. This happens on the Win32 level. This is also the reason why `<drive>:/<path>` works in the first place. Everything in `startingDirectory` strictly belongs to the Win32 realm. The transformed format `//wsl$/<distro>/mnt/<drive>/<path>` is in fact a network path that is mounted internally by Windows, to make files in Linux accessible. A symbolic link, if I'm not mistaken, is a Linux OS & filesystem specific thing, that is currently not recognized in the process we described. Part of the reason why it's not supported might be the fact that Windows does not support ext4 or any Linux filesystem. If you really want to know whether this will be supported in the future, https://github.com/microsoft/WSL is probably the best place to ask.
Author
Owner

@DHowett commented on GitHub (Nov 20, 2020):

Sorry, yeah, this is ... complicated.

The starting directory is processed by wsl.exe before it actually boots linux. This is critical: it hasn't run any automounting, it hasn't even found most of your files. It's not ready to handle a path that symlinks into a mounted drive.

I can offer you this: we're working in /dup #7197 to handle this better and get support from WSL itself to take care of the starting directory. Hopefully that work will help your use case 😄

@DHowett commented on GitHub (Nov 20, 2020): Sorry, yeah, this is ... complicated. The starting directory is processed by wsl.exe _before it actually boots linux_. This is critical: it hasn't run any automounting, it hasn't even found most of your files. It's not _ready_ to handle a path that symlinks into a mounted drive. I can offer you this: we're working in /dup #7197 to handle this better and get support from WSL itself to take care of the starting directory. Hopefully that work will help your use case :smile:
Author
Owner

@ghost commented on GitHub (Nov 20, 2020):

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

@ghost commented on GitHub (Nov 20, 2020): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11221