更新 WSL 2 Linux 内核Updating the WSL 2 Linux kernel

若要手动更新 WSL 2 内的 Linux 内核,请按照以下步骤执行操作。To manually update the Linux kernel inside of WSL 2 please follow these steps.

备注

如果安装程序找不到 WSL 1,请右键单击 Linux 内核更新安装程序,然后按“卸载”,并重新运行安装程序If the installer can't find WSL 1, right-click the Linux kernel update installer and press "Uninstall", then rerun the installer.

下载 Linux 内核更新包Download the Linux kernel update package

下载适用于 x64 计算机的最新 WSL2 Linux 内核更新包。Please download the latest WSL2 Linux kernel update package for x64 machines.

备注

如果使用的是 ARM64 计算机,请下载 ARM64 包If you're using an ARM64 machine, please download the ARM64 package instead.

安装 Linux 内核更新包Install the Linux kernel update package

若要安装 Linux 内核更新包,请执行以下操作:To install the Linux kernel update package:

  1. 运行上一步中下载的更新包。Run the update package downloaded in the previous step.

  2. 系统将提示你提供提升的权限,选择“是”以批准此安装。You will be prompted for elevated permissions, select ‘yes’ to approve this installation.

  3. 安装完成后,便可以开始使用 WSL2 了!Once the installation is complete, you are ready to begin using WSL2!

有关更新 WSL2 Linux 内核的未来计划Future plans for updating the WSL2 Linux kernel

有关详细信息,请参阅 Windows 命令行博客上的文章对更新 WSL2 Linux 内核的更改For more information, read the article changes to updating the WSL2 Linux kernel, available on the Windows Command Line Blog.

疑难解答Troubleshooting

此更新仅适用于具有适用于 Linux 的 Windows 子系统的计算机This update only applies to machines with the Windows Subsystem for Linux

要安装 MSI 内核,需要 WSL,应先启用。To install MSI kernel, WSL is required and should be enabled first. 如果失败,将看到以下消息:This update only applies to machines with the Windows Subsytem for LinuxIf it fails, it you will see the message: This update only applies to machines with the Windows Subsytem for Linux.

出现此消息有三个可能的原因:There are three possible reason you see this message:

  1. 你仍使用旧版 Windows,不支持 WSL 2。You are still in old version of Windows which doesn't support WSL 2. 请查看 WSL 2 要求,升级到使用 WSL 2。Please check the WSL 2 requirements and upgrade to use WSL 2.
  2. 未启用 Windows Subsystem for LinuxWindows Subsystem for Linux is not enabled. 请按照适用于 Linux 的 Windows 子系统安装指南进行操作。Please follow the Windows Subsystem for Linux Installation Guide.
  3. 启用 Windows Subsystem for Linux 后,需要重启才能生效,请重启计算机,然后重试。After you enabled Windows Subsystem for Linux, a reboot is required to take into effect, please reboot your machine and try again.

WSL 2 requires an update to its kernel component. For information please visit https://aka.ms/wsl2kernel

每次 %SystemRoot%\system32\lxss\tools, 中缺少内核时,都可能会出现上述错误。Each time kernel is missing in %SystemRoot%\system32\lxss\tools, you may run into the above error.

解决该错误的一些方法如下:Here are some possible ways to resolve it:

  1. 请按照以下网站上的说明手动安装 Linux 内核: https://aka.ms/wsl2kernelPlease install the Linux kernel manually by following the instructions at: https://aka.ms/wsl2kernel
  2. 从“添加或删除程序”卸载 MSI,然后重新安装Uninstall the MSI from 'Add or Remove Programs', and install it again