WSLを起動するためにPowerShell上でwsl
を実行したら下記の通りのエラーが発生し起動しなかった。
PS C:\WINDOWS\system32> wsl
Failed to attach disk 'C:\Users\xxxx\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState\ext4.vhdx' to WSL2: 指定されたファイルが見つかりません。
Error code: Wsl/Service/CreateInstance/MountVhd/HCS/ERROR_FILE_NOT_FOUND
中身は重要ではなかったので、初期化してインストールしなおすことにした。
PS C:\WINDOWS\system32> wslconfig /l
Windows Subsystem for Linux Distributions:
Ubuntu (Default)
PS C:\WINDOWS\system32> wslconfig /terminate Ubuntu
The operation completed successfully.
PS C:\WINDOWS\system32> wslconfig /unregister Ubuntu
Unregistering.
The operation completed successfully.
PS C:\WINDOWS\system32> wslconfig /l
Windows Subsystem for Linux has no installed distributions.
You can resolve this by installing a distribution with the instructions below:
Use 'wsl.exe --list --online' to list available distributions
and 'wsl.exe --install <Distro>' to install.
対象のディストリビューション(今回はUbuntu)が削除されたことを確認後、再インストール。
PS C:\WINDOWS\system32> wsl --install
Downloading: Ubuntu
Installing: Ubuntu
Distribution successfully installed. It can be launched via 'wsl.exe -d Ubuntu'
PS C:\WINDOWS\system32> wsl -l
Windows Subsystem for Linux Distributions:
Ubuntu (Default)
起動するようになった。
コメント