Changing Ubuntu WSL starting directory keeps it set to the defualt
When editing the the settings, I have tried to chang the default starting directory for the Ubuntu WSL Terminal profile as follows
"startingDirectory": "/mnt/D/Folder/SubFolder/",
and while it doesnt cause any issues or causes the Terminal to resort to default configuration, it does not set the default starting directory to the specified path.
Also it seems that most settings for the profile do literally nothing when changing them, from color, to acrylic or scheme settings.
Note: changing the setting for power shell, cmd, of Kali-Linux does work and change things respectively
startingDirectory Should be a windows path, not a *nix path. Try D:\Folder\SubFolder instead.
Could you be specific which settings don't seem to work for that profile? Maybe share the profile from the profiles.json file?
@zadjii-msft Just checked into this & verified that, yes, specifying a Windows path does work, and for WSL distros, specifying a Windows-relative path to a distro also works.
For example, \\\\wsl$\Ubuntu\home\\rich\\ opens my Ubuntu home folder! 😁
This is a duplicate of another bug in the db somewhere. We need to clarify in the documentation that startingDirectory is a Windows path, and since Terminal doesn't actually know anything about the connected application on the other end we can't assume that it's WSL and do path translation and all that stuff.
It's gotta be a Windows path. :smile:
I'm re-tagging this with Issue-Docs
I am working on submitting a PR to add that bit of detail, if that is alright with everyone.
Sure!
@zadjii-msft Just checked into this & verified that, yes, specifying a Windows path does work, and for WSL distros, specifying a Windows-relative path to a distro also works.
For example,
\\\\wsl$\Ubuntu\home\\rich\\opens my Ubuntu home folder! 😁
You may want to use wsl -l first, in order to determine which Ubuntu version you are running.
For example:
"startingDirectory": "\\\\wsl$\\Ubuntu-18.04\\home\\[linux-user]"
non-escaped also works:
"startingDirectory" : "//wsl$/Ubuntu-18.04/home/<user>"
The problem isn't the documentation, it's the default JSON provided. That's why everyone keeps complaining about the same thing. Here's mine:
"startingDirectory" : "\\\\wsl$\\Debian\\home\\<linuxuser>"
which instead takes me to /mnt/c/Users/<windowsuser>. So it looks like that string is entirely ignored and a default that has nothing to do with it is picked. It's not even the same username.
@Boobies weirdly enough, I've used "startingDirectory": "\\\\wsl$\\Ubuntu\\home\\[linux username]" in my config for a while now with no issue. Could there be any other setting that might be conflicting with it?
I've tried all of these and it still seems to be defaulting to c/Users/{user} as well. Any suggestions?
I've tried all of these and it still seems to be defaulting to
c/Users/{user}as well. Any suggestions?
start by using this -> //wsl$/Ubuntu/ and then recursively find the directory where you want to go.
If you wanna change drives like go to D:/ its not picking up, moreover you can change to your starting directory whose write access is done by root. Check the folder permission also by using ls -l if its root it can be your startingDirectory else not possible right now
@bitcrazed
For example, \\wsl$\Ubuntu\home\rich\ opens my Ubuntu home folder! 😁
I did this, and it works for me, but now I get this message every time I create a new window
wslpath: '\\wsl$\WLinux\home\tnguyen14'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
C:\Users\NguyenTri
It still cd to the right directory though. Is this error message expected? Any way I can fix it?
@tnguyen14 what commandline are you using to launch wsl?
@zadjii-msft The Windows Terminal app - is that what you meant?
I meant the commandline in your profiles.json file - could you share that with me?
It's not specified. Here's the profile object:
{
"guid": "{7f586916-8357-53d4-bb2b-ca96f639898a}",
"hidden": false,
"name": "WLinux",
"source": "Windows.Terminal.Wsl",
"fontSize": 10,
"fontFace": "SauceCodePro NF",
"startingDirectory": "//wsl$/WLinux/home/tnguyen14",
"padding": "0, 0, 0, 0"
},
Okay, well that's exactly what I'd expect that to look like. I'm not sure why that error message is getting displayed, but you might be able to get answers over at https://github.com/microsoft/WSL
This is because wslu, the WSL integration bridge that ships with Ubuntu, is running cmd.exe on startup. There's nothing we can do about that. This will happen any time WSL is started outside of the Windows filesystem.
More info here: https://github.com/microsoft/terminal/issues/4214
@DHowett-MSFT Interesting. I don't see if from windows when I use other terminal apps, like wsltty or the default Pengwin app - is that launched differently somehow?