環境
Windows10 Education 2004
WSL Ubuntu18.04 LTS
現象
WSLのUbuntu18.04にJavaをインストールしようと以下のコマンドを実行したところ...
sudo apt install default-jdk
このような404エラーが発生しインストールに失敗する。
Ign:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libnss3 amd64 2:3.35-2ubuntu2.11
Err:1 http://security.ubuntu.com/ubuntu bionic-updates/main amd64 libnss3 amd64 2:3.35-2ubuntu2.11
404 Not Found [IP: 91.189.88.152 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/n/nss/libnss3_3.35-2ubuntu2.11_amd64.deb 404 Not Found [IP: 91.189.88.152 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
apt-get update
やapt-get update --fix-missing
を試せと書いてあるので試すが改善せず...
アンチウイルスソフトが原因で...という記事もあったが、特にその手のものは導入していないので関係なさそう。
解決方法
以下のコマンドを実行しらエラーが出なくなった。
sudo apt-get autoclean //これが肝っぽい
sudo apt-get update
どうやら使われない古いファイルが残り続けていて、それが悪さしていたとかいないとか...
sudo apt-get autoclean
はそういった不要なファイルを削除するコマンドのようです。
参考
https://qiita.com/kabosu3d/items/0f436ba05df8ac358245
https://qiita.com/Y_Aowashi/items/d355d90945305d925a3c