Closed gaia closed 4 years ago
$ echo $PATH
There are no win32 paths in your $PATH
so interop isn't going to find explorer.exe
.
Something is replacing the path. Try this and post the output:
cd ~
grep -i -e 'PATH' .*
I don't see anything weird there. Is that the root user?
Resetting the baseline, there is no appendWindowsPath=false
in wsl.conf, right? Also do you happen to be using WSLENV
?
You can push through this doing a export PATH=$PATH:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32
in .profile
.
But it would be nice to know what happened here for the collective knowledge-base. No guesses from me. The grep
was a good stab, thanks onomatopellan. Maybe grep -ril
😏. Actually it would be somewhat weird for something to cleanly sever the Windows paths (and only the Windows paths). Anything possible I guess.
I don't see anything weird there. Is that the root user?
nope. but the root user has the same issue, no win32 in PATH, no explorer.
Resetting the baseline, there is no
appendWindowsPath=false
in wsl.conf, right? Also do you happen to be usingWSLENV
?
no /etc/wsl.conf
. no windows env variable called WSLENV, if that's what you meant?
You can push through this doing a
export PATH=$PATH:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32
in.profile
.
this does it.
Maybe
grep -ril
😏.
too many results with -ril
happy to get to the bottom of this.
no windows env variable called WSLENV, if that's what you meant?
Yes. If you don't use WSLENV
forget I asked.
too many results with -ril
Yeah, wasn't being real serious about that.
What is needed is to figure out what steps happened leading up to you not seeing your Windows paths automatically marshalled into WSL (or being blown away after getting there). I don't have any easy guesses to offer unfortunately.
same for me with node.exe. node - command not found.
although node is installed in my windows10 computer. I think something is not right with the path variable.
How to set the $PATH to know the paths in windows?
DESKTOP-BVRD:/tmp/docker-desktop-root/mnt/host/c/Users/myuser# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
So I had the paths stripped even with the append option enabled using a custom imported distro automatically set up for WSL2 (though I saw this before on WSL1 before upgrade using Pengwin, FedoraRemix, Ubuntu, etc. from Store). I had also turned case=on
and as well as having fstab turned on in /etc/wsl.conf
. After manually setting the custom distro to version 2 again (even though in wsl --list --verbose
, it shows version 2) and also switching case=off
and turning fstab off) then doing a wsl --shutdown
, interop worked again (you can immediately notice it because it automatically goes to the windows home instead of linux home when interop is working properly.)
For it was my .zshenv
file that was setting PATH
like this:
export PATH="some/paths/here"
instead of
export PATH="some/paths/here:$PATH"
(Notice the appended :$PATH
at the end)
I didn't know $PATH already had content when WLS2 first started, and that it had precisely the Windows PATH
s. So my script was overriding that instead of appending to it.
Hopefully this will help others.
For Debian, /etc/profile contributed to this problem.
Here is the path definition in /etc/profile
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
fi
You can delete above lines, then wsl --shutdown
to restart Debian.
If you would like to keep these lines, you can also append ":$PATH" to each path like below, then wsl --shutdown
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:$PATH"
fi
I ran into the same issue after upgrading to windows 2004 and WSL2. System32 was in the PATH but I couldn't execute the commands. Running WSL as an administrator solved the issue.
I had a workaround for WSL1, but the dang /proc/version output changed case and broke my grep expression. Added -i
to account for WSL2.
Resetting the baseline, there is no
appendWindowsPath=false
in wsl.conf, right? Also do you happen to be usingWSLENV
?You can push through this doing a
export PATH=$PATH:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32
in.profile
.But it would be nice to know what happened here for the collective knowledge-base. No guesses from me. The
grep
was a good stab, thanks onomatopellan. Maybegrep -ril
😏. Actually it would be somewhat weird for something to cleanly sever the Windows paths (and only the Windows paths). Anything possible I guess.
It work
Resetting the baseline, there is no
appendWindowsPath=false
in wsl.conf, right? Also do you happen to be usingWSLENV
?You can push through this doing a
export PATH=$PATH:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32
in.profile
.But it would be nice to know what happened here for the collective knowledge-base. No guesses from me. The
grep
was a good stab, thanks onomatopellan. Maybegrep -ril
😏. Actually it would be somewhat weird for something to cleanly sever the Windows paths (and only the Windows paths). Anything possible I guess.
Where is ".profile"?
Where is ".profile"?
@JimmyBringus in your home folder. So ~/.profile
.