我正在尝试开始使用 WSL Debian,但它似乎未连接到互联网。像sudo ping www.google.com
和 这样的命令sudo apt-get update
不起作用。
user@USER:~$ sudo ping www.google.com
[sudo] password for user:
ping: www.google.com: Temporary failure in name resolution
user@USER:~$ sudo apt-get update
Err:1 http://deb.debian.org/debian bullseye InRelease
Temporary failure resolving 'deb.debian.org'
Err:2 http://security.debian.org/debian-security bullseye-security InRelease
Temporary failure resolving 'security.debian.org'
Err:3 http://ftp.debian.org/debian bullseye-backports InRelease
Temporary failure resolving 'ftp.debian.org'
Err:4 http://deb.debian.org/debian bullseye-updates InRelease
Temporary failure resolving 'deb.debian.org'
Reading package lists... Done
W: Failed to fetch http://deb.debian.org/debian/dists/bullseye/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/bullseye-updates/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/bullseye-security/InRelease Temporary failure resolving 'security.debian.org'
W: Failed to fetch http://ftp.debian.org/debian/dists/bullseye-backports/InRelease Temporary failure resolving 'ftp.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.
我查看了更改模板文件/etc/resolv.conf
像这样但它并没有做任何不同的事情。当我从 powershell 调用 wsl 打开 Ubuntu 时,这暂时有效,但它对 Debian 没有任何作用。这现在也停止为 powershell 工作,我不知道为什么。
/etc/apt/sources.list
:
user@USER:~$ cat /etc/apt/sources.list
deb http://deb.debian.org/debian bullseye main
deb http://deb.debian.org/debian bullseye-updates main
deb http://security.debian.org/debian-security bullseye-security main
deb http://ftp.debian.org/debian bullseye-backports main
我重新安装了 WSL 并尝试了相同的操作,但不幸的是,它不起作用。
内容/etc/resolv.conf
:
cat /etc/resolv.conf
# 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