実行環境
- OS: Windows11
- WSL2
- kali-linux
- /etc/apt/sources.listはデフォルト
エラー内容
- WSL2のディストリビューションをkali-linuxに設定
- 「wsl -d kali-linux」でkali-linuxを起動
- 初回起動のため、「sudo apt update」を実施
- エラー発生
Error発生
└─$ sudo apt update
[sudo] password for kali:
Ign:1 http://http.kali.org/kali kali-rolling InRelease
Ign:1 http://http.kali.org/kali kali-rolling InRelease
Ign:1 http://http.kali.org/kali kali-rolling InRelease
Err:1 http://http.kali.org/kali kali-rolling InRelease
Temporary failure resolving 'http.kali.org'
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://http.kali.org/kali/dists/kali-rolling/InRelease Temporary failure resolving 'http.kali.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.
対処法
- 「sudo vi /etc/resolv.conf」を開く
- 「nameserver 8.8.8.8」を追加
※「ipconfig /all」で自分のDNSを調べて使用してもいい
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 8.8.8.8
# 8.8.8.8: Google Public DNS
3.保存して閉じる
4.もう一度、「sudo apt update」を実施
通った!
Get:1 http://ftp.jaist.ac.jp/pub/Linux/kali kali-rolling InRelease [30.6 kB]
Get:2 http://ftp.jaist.ac.jp/pub/Linux/kali kali-rolling/main amd64 Packages [18.8 MB]
Get:3 http://ftp.jaist.ac.jp/pub/Linux/kali kali-rolling/contrib amd64 Packages [111 kB]
Get:4 http://ftp.jaist.ac.jp/pub/Linux/kali kali-rolling/non-free amd64 Packages [237 kB]
Fetched 19.2 MB in 8s (2,504 kB/s)
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
143 packages can be upgraded. Run 'apt list --upgradable' to see them.
参考文献
この記事は、以下の情報を参考にしました。
- Failed to update Kali "failed to fetch http.kali.org/kali" #1258
https://github.com/CypherpunkArmory/UserLAnd/issues/1258 - WSLにてapt update時の『Temporary failure resolving ~』を解決する方法
https://qiita.com/ryosukeYamazaki/items/c04ec3ff78aac6eb8d26