Skip to content

Commit 1829aa3

Browse files
authored
command not found
1 parent ed7fbda commit 1829aa3

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

WSL/troubleshooting.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,39 @@ Lastly, if your issue is related to the Windows Terminal, Windows Console, or th
3636

3737
## Common issues
3838

39+
### `command not found` when execute windows .exe in linux
40+
User can run Windows .exe like notepad.exe directly from linux. Sometime, you may hit "command not found" like below:
41+
```
42+
$ notepad.exe
43+
-bash: notepad.exe: command not found
44+
```
45+
46+
If there is no win32 paths in your $PATH, interop isn't going to find the .exe.
47+
You can verify it by `echo $PATH` in Linux. It's expected that win32 path(for example, /mnt/c/Windows) is in the output.
48+
If you can't find it, most likely PATH is overwriten by Linux shell.
49+
50+
Here is a an example that /etc/profile on Debian contributed to the problem:
51+
```
52+
if [ "`id -u`" -eq 0 ]; then
53+
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
54+
else
55+
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
56+
fi
57+
```
58+
59+
The correct way on Debian is to remove above lines.
60+
You may also append $PATH during the assigment like below, but this lead to some [other problems](https://salsa.debian.org/debian/WSL/-/commit/7611edba482fd0b3f67143aa0fc1e2cc1d4100a6) with WSL and VSCode..
61+
62+
```
63+
if [ "`id -u`" -eq 0 ]; then
64+
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
65+
else
66+
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:$PATH"
67+
fi
68+
```
69+
70+
For more information, please refer to issue [5296](https://github.com/microsoft/WSL/issues/5296)
71+
3972
### Error: 0x1bc when `wsl --set-default-version 2`
4073
This may happen when 'Display Language' or 'System Locale' setting is not English.
4174
```

0 commit comments

Comments
 (0)