Hyper-V の Windows 11 開発環境で WSL を動かす
Hyper-V の Windows 11 開発環境内で WSL を動かそうとすると、以下のようなエラーになる。
code:txt
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80370102
Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS.
Press any key to continue...
これは、Hyper-V の入れ子が許可されていないため。
Hyper-V の入れ子の許可をする場合
$ Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true
これは管理者権限で行う必要がある。
Set-VMProcessor: このタスクを完了するために必要なアクセス許可がありません。このコンピューター 'PC' の承認ポリシーの管理者に問い合わせてください。
VMName にはそのVMの名前を入れる。Windows 11 開発環境なら "Windows 11 開発環境" と入れておけばいいはず。
参考
入れ子になった仮想化の概要
入れ子になった仮想化を使用して仮想マシンで Hyper-V を実行する