Skip to content
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

[WSL2] Slow completion due to Windows PATH being appended to Linux PATH #4234

Closed
antoineco opened this issue Jun 25, 2019 · 4 comments
Closed

Comments

@antoineco
Copy link

antoineco commented Jun 25, 2019

  • Your Windows build number:

Version 10.0.18922.1000

  • What you're doing and what's happening:

The PATH environment variable contains both the Linux path and the Windows PATH in a single variable. On my machine, this makes PATH traversal extremely slow. The problem is very obvious when using auto-completion (type an incomplete command and press <TAB>).

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Users/Me/AppData/Local/Microsoft/WindowsApps

The AppendNtPath registry value suggested here, which disables this behavior on WSL1, does not work on WSL2.

  • What's wrong / what should be happening instead:

There should be a way to disable this automatic appending of the Windows PATH.

@benhillis
Copy link
Member

https://devblogs.microsoft.com/commandline/automatically-configuring-wsl/

/etc/wsl.conf

[interop]
appendWindowsPath = false

@antoineco
Copy link
Author

@benhillis Fantastic, thank you 👍 This blog post is gold, but very much hidden due to more recent articles on the blog.

For other users who may run into similar issues, please check
ℹ️ Docs / Windows / Manage and configure Windows Subsystem for Linux (Distro management)

@alvitawa
Copy link

I removed the path (and restarted the wsl2 distro) but my tab-completion is still quite slow at times. Here is a screencast of when it was still slow: https://recordit.co/VOIfPE6ihy

I think something is not working properly.

@tony
Copy link

tony commented Nov 28, 2022

If you use

[interop]
appendWindowsPath = false

It then hides wsl.exe, winget.exe, notepad.exe, etc.

It'd be nice to still have access to those somehow, while not incurring the penalty of scanning through windows related paths (directories like /mnt/c/Windows/System32/ existing in PATH are very slow apparently)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants