WSL2踩坑记录

使用WSL的过程中总是遇到各种玄学问题,其中很多问题遇到的次数过于频繁。我在这里做一个整理,免得之后再次遇到同样的问题又得跑到网上一通查( ̄﹃ ̄)

禁用appendWindowsPath

禁用appendWindowsPath可以避免部分玄学编译问题(例如编译OpenWrt固件时,如果路径中含有Windows路径,可能会报The relative path 'Files' is included in the PATH environment variable, which is insecure in combination with the -execdir action of find. Please remove that entry from $PATH[1]

在文件/etc/wsl.conf中添加以下内容,重新进入容器即可。

1
2
[interop]
appendWindowsPath = false

在文件/etc/wsl.conf中添加以下内容,重启容器即可[2]

1
2
[automount]
ldconfig = false

  1. https://github.com/coolsnowwolf/lede/issues/6597#issuecomment-825314820 ↩︎

  2. https://github.com/microsoft/WSL/issues/5548#issuecomment-724674428 ↩︎