-
Notifications
You must be signed in to change notification settings - Fork 822
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
[Question] How to remove Windows pathes from WSL PATH? #1493
Comments
This comment has been minimized.
This comment has been minimized.
There is also a registry key that just disables it entirely. |
When I wrote this feature I added a registry key to opt out of the behavior in case it caused people issues:
|
That's a super interesting feature, I'm surprised at how little it's been advertised. |
@benhillis I've just tried that registry key. It doesn't seem to be working anymore 😞. Closed/reopened Bash on Ubuntu on Windows after adding the key and EDIT: I've also found the other solution and decided to try that as well, since I actually had WSL installed from the Windows Store:
At first I thought it worked, but it turns out I still had the following line (which I had found in the mean time) in my
After commenting it, it looks like none of the 2 Registry fixes actually work anymore. |
Can we please have a fix for this issue (preferably one, that doesn't invole making changes to the registry)? I understand that interop might be useful for some people, but for me it just clutters up the PATH variable (and consequently auto complete in bash and leads to occasional issues when linux tools get confused. The way I see it, running windows binaries from inside Linux is the exception and not the rule, so I don't understand, why those paths get appended by default. As a general comment: It would be nice to have a more extensive configuration tool in which I can set such things on a per distribution basis and which preferably has a gui to it. |
There is a solution now in wsl.conf. |
See WSLENV usage. |
I've tried to look at the WSLENV usage or at |
Manually setting your path in your bashrc is probably your best bet. I am working on a change now to add this option to wsl.conf. |
I went with @ddfznt's override as it works well for me but it would be nice to see something elegant! 😄 |
If you use
|
This flag is stored in |
There is another DWORD registry |
We are not documenting the registry keys themselves, just the flags to the configure API. The keys are subject to change. |
@benhillis Should add a command to change this flag in wslconfig. |
As I said above, I will be adding this flag to wsl.conf. |
Insider Build 17713 contains wsl.conf additions to control this. |
@Brian-Perkins Just a question, isn't WSL getting too dependent on WSL.conf file. Isn't it takes some time to open that file and parsing all the options? |
The amount of time parsing wsl.conf is negligible considering everything else that is done during a WSL instance "boot". |
Fixed it by using the latest workaround based on this comment: #1493 (comment)
Change Now my path looks like this: |
@m00head The correct (through wsl configuration) is to edit the file
Then you have to relaunch ubuntu. |
Unfortunately, i even see other windows $PATH entries with spaces placed in my bash path.
I just don't want path entries added. I set |
I just added export |
@MostafaOkasha I think there's a disconnect here:
|
You need to restart the WSL console window for it to pick up the new setting in Using Registry Editor, navigate to the following key: What is the Have you tried the registry workaround I posted here previously? #1493 (comment)
Which OS build version of Windows 10 1809 are you on? e.g. |
Done. It didn't help.
Didn't help. These are the only values set:
I have not. SHouldn't wsl.conf work here?
I'm on this: |
Setting This may be because the location of your You should NOT edit this file from Windows because this will cause it to become corrupted (see #1662 and #3536) Instead, edit the file from within the WSL console window using Otherwise, try changing it manually from |
What's the status on wsl.conf for (not-insider) Build 17134 and friends? I am by all means updating to insider build, as this seems like part of WSL best practices for now. But it would be nice for a more out of box experience (for clueless users such as your truly.) Side note: For those arriving from this Stack/Exchange post looking for a registry hack - setting Looks like the wsl docs' Distro Management Section should have been my go-to. The docs are clean + well written, and mention Insider Build, |
After configuring
don't forget to open Powershell (as administrator) and put this command: Restart-Service LxssManager Windows-10 1809 |
I just installed wsl2 and now the flag's value is 15, not 7. what should I do? |
@SaeedShariati - use the /etc/wsl.conf method. The registry key method is unsupported. |
Thanks @ChinouneMehdi Note that you need to execute PowerShell as Administrator in order to be able to restart this service. |
Has the method to do this been documented anywhere? |
#To remove windows paths: in .bash_profile add: then to restart it simple as: (then just reconnect) #make sure to install pulseaudio on windows side, works great for kivy/python development then you can just do things like connect your pixel 4xl device and do things like: Personally I have 2 copies of flutter on windows side and kali linux wsl2 side one in c:/src/flutter and one in ~/src/flutter don't forget to add to .nanorc So you can tab to 4 spaces while editting code and add your color syntax highlighting. |
I guess the answer is no. |
echo 'appendWindowsPath=False' > /etc/wls.conf |
This happened to me after installing nvm ! Please document the right answer . |
I just changed the Flags in the registry and my Ubuntu WSL is completely gone. Reset. The VHDX file with the disk drive has been completely erased. The folder C:\Users<user>\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState is empty. I think I am going to pass out... The initial flag value was 15. I did test it out again, after setting up a new ubuntu wsl, and the same thing happened. |
I use |
Is there any way to remove Windows pathes from my WSL PATH? Like some statement in some startup script or something.
The text was updated successfully, but these errors were encountered: