自己手动编译内核:
微软的WSL内核:https://github.com/microsoft/WSL2-Linux-Kernel
Linux内核:https://kernel.org/
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.58.tar.xz
tar -xf linux-6.6.58.tar.xz
cd linux-6.6.58构建方法:
- 安装构建依赖
Debian系
sudo apt install build-essential flex bison dwarves libssl-dev libelf-dev
Arch系
sudo pacman -S base-devel openssl libelf- 使用WSL2内核配置构建内核
make KCONFIG_CONFIG=config-wsl的路径 -j$(nproc)使用方法:
在文件C:\Users\你的用户名\.wslconfig(没有则创建此文件)
加入以下内容:
[wsl2]
kernel=C:\\Users\\你的用户名\\vmlinux相关的坑:
暂时没有找到解决方法,让6.6.58内核与Windows Docker Desktop 同时使用,目前的解决方法是使用5.15的内核
最相关的issue:https://github.com/microsoft/WSL/issues/11742
相关资料:
https://github.com/microsoft/WSL/releases
https://stackoverflow.com/questions/60830914/running-docker-gives-ports-are-not-available-error
https://xtzyj.top/2023/10/05/immich-introduction/
https://pythonspeed.com/articles/docker-connection-refused/
https://superuser.com/questions/1709437/how-can-i-update-the-kernel-in-wsl2-kernel-to-latest-release
https://learn.microsoft.com/en-us/windows/wsl/wsl-config#configuration-setting-for-wslconfig
历史比较老的内核: