WSL2 Error code: Wsl/Service/CreateInstance/MountVhd/HCS/ERROR_FILE_NOT_FOUND


久しぶりにWSL2上でUbuntuを使っていろいろ試していた際に、何度かUbuntuをアンインストール・インストールを繰り返していたら以下のエラーが発生しUbuntuが起動できなくなりました。

ディスク 'C:\Users\tworks55\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState\ext4.vhdx' を WSL2 にアタッチできませんでした: 指定されたファイルが見つかりません。
Error code: Wsl/Service/CreateInstance/MountVhd/HCS/ERROR_FILE_NOT_FOUND
Press any key to continue...


対処方法は簡単で、一度WSLに登録されているUbuntuを登録解除すれば良いようです。

C:\>wsl -l
Linux 用 Windows サブシステム ディストリビューション:
Ubuntu (既定)

C:\>wsl --unregister Ubuntu
登録解除。
この操作を正しく終了しました。


改めてUbuntuを起動すればアカウント登録から設定を開始できます。

Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: