LoginSignup
32
12

More than 3 years have passed since last update.

WSL2 のインストール時に WslRegisterDistribution failed with error: 0xc03a001a で失敗するときの対処法

Last updated at Posted at 2020-12-13

WSL2のインストールに失敗

公式 Windows 10 用 Windows Subsystem for Linux のインストール ガイド
こちらの手順に従ってWSL2を用いてUbuntu20.04を使おうとしたところ、下記のエラーでインストールに失敗しました。

Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0xc03a001a
Error: 0xc03a001a ???????????????????????????????????????????????????

対処法

私は下記の方法で無事にインストールに成功するようになりました。

  1. C:\Users\user name\AppData\Local\Packages を開く。(無ければおそらく隠しフォルダになっています)
  2. Packageディレクトリで ubuntuなど、利用しているディストリビューションの文字列でサブディレクトリを検索。(このとき、見つけたサブディレクトリの右上に青い矢印が付いていると思われます)
  3. サブディレクトリを見つけたら、プロパティ > 詳細設定 > 内容を圧縮してディスク領域を節約する のチェックをオフにする。
  4. 青い矢印が消えたことを確認。
  5. WSL2を起動。うまくいけばインストールが始まります。

参考元

https://github.com/microsoft/WSL/issues/5325
https://github.com/microsoft/WSL/issues/5325#issuecomment-654463010

公式リポジトリのIssue。
このようなコメントがあります。

NTFS has this feature that compresses directories to save space. If some or all of your icons are marked by 2 opposing blue arrows, that's your sign that said feature is indeed on. Now, because of this, the directory that hosts your Store downloads (in this case Ubuntu) might also have the same issue.
Go to C:\Users\user name\AppData\Local\Packages folder. If not apparent, it's probably hidden. Once inside directory, search subdirectory with 'ubuntu' string/keyword. Once located, right click the directory > Advanced > uncheck the compression > Apply. Now the ubuntu directory should have the arrows removed, which means you should have a better chance at actually running the distro install.

ディレクトリの容量を節約するために圧縮する機能があってそれが悪さをしていると。。。

余談 - WSL1をWSL2に変換しようとすると失敗

上記エラーを解決した後、

wsl --set-version Ubuntu 2

のコマンドを利用して、もともと利用していたUbuntuをWSL2に変換しようとしました。
そうすると、

変換中です。この処理には数分かかることがあります...
WSL2との主な違いについては、https://aka.ms/wsl2 を参照してください
仮想ディスクシステムの制限により、要求された操作を完了できませんでした。仮想ハードディスクファイルの圧縮と暗号化が解除されている必要があります。また、仮想ハードディスクファイルをスパースに設定することはできません。

とのエラーメッセージが。

https://github.com/microsoft/WSL/issues/4103
こちらのIssueでも議論されていますが、上記エラーと同じく該当ディレクトリの圧縮を解除することでWSL2への変換ができるようになりました。

さいごに

以上、お困りの皆様の助けになれば幸いです。

32
12
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
32
12