无法在 WSL 上解析 ubuntu 20.04 的 us.us.archive.ubuntu.com

无法在 WSL 上解析 ubuntu 20.04 的 us.us.archive.ubuntu.com

我正在运行 ubuntu ( focal 20.04) WSL2,并尝试安装 gcc,似乎我需要apt-get update先运行。
我一直收到Could not resolve us.us.archive.ubuntu.com(以下错误)。

我已查找解决方案并编辑/etc/resolv.conf添加其他名称服务器,如下所示:

/etc/resolv.conf

# This file was automatically generated by WSL. To stop automatic generation of this file, add the foll>
# [network]
# generateResolvConf = false
nameserver 172.17.96.1
nameserver 8.8.8.8
nameserver 8.8.4.4

错误

sanzor@DESKTOP-GOMS8S8:~/rust$ sudo apt-get update
[sudo] password for sanzor: 
Get:1 http://archive.ubuntu.com/ubuntu focal-proposed InRelease [267 kB]
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]                              
Ign:3 http://binaries.erlang-solutions.com/debian focal InRelease                                      
Hit:4 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial InRelease                         
Hit:5 http://binaries.erlang-solutions.com/debian focal Release                                        
Err:6 http://us.us.archive.ubuntu.com/ubuntu focal InRelease                                           
  Could not resolve 'us.us.archive.ubuntu.com'
Err:7 http://us.us.archive.ubuntu.com/ubuntu focal-updates InRelease                                   
  Could not resolve 'us.us.archive.ubuntu.com'
Ign:9 http://archive.ubuntu.com/ubuntu trusty InRelease                       
Err:10 http://us.us.archive.ubuntu.com/ubuntu focal-backports InRelease       
  Could not resolve 'us.us.archive.ubuntu.com'
Hit:11 http://archive.ubuntu.com/ubuntu trusty-security InRelease             
Hit:12 http://archive.ubuntu.com/ubuntu trusty-updates InRelease              
Hit:13 http://archive.ubuntu.com/ubuntu trusty-proposed InRelease            
Hit:14 http://archive.ubuntu.com/ubuntu trusty-backports InRelease           
Hit:15 https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease
Hit:16 http://archive.ubuntu.com/ubuntu trusty Release
Fetched 381 kB in 1s (379 kB/s)
Reading package lists... Done
W: Failed to fetch http://us.us.archive.ubuntu.com/ubuntu/dists/focal/InRelease  Could not resolve 'us.us.archive.ubuntu.com'
W: Failed to fetch http://us.us.archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Could not resolve 'us.us.archive.ubuntu.com'
W: Failed to fetch http://us.us.archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Could not resolve 'us.us.archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

附言 我不知道为什么会这样us.us.archive.ubuntu.com,或者在哪个文件中寻找要更改的设置,如果可以的话。

后期编辑

这是/etc/apt/sources.list文件内容:

sanzor@DESKTOP-GOMS8S8:/etc/apt$ cat sources.list
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.us.archive.ubuntu.com/ubuntu/ focal main restricted
# deb-src http://us.us.archive.ubuntu.com/ubuntu/ focal main restricted
deb http://archive.ubuntu.com/ubuntu/ focal-proposed main
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.us.archive.ubuntu.com/ubuntu/ focal-updates main restricted
# deb-src http://us.us.archive.ubuntu.com/ubuntu/ focal-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.us.archive.ubuntu.com/ubuntu/ focal universe
# deb-src http://us.us.archive.ubuntu.com/ubuntu/ focal universe
deb http://us.us.archive.ubuntu.com/ubuntu/ focal-updates universe
# deb-src http://us.us.archive.ubuntu.com/ubuntu/ focal-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.us.archive.ubuntu.com/ubuntu/ focal multiverse
# deb-src http://us.us.archive.ubuntu.com/ubuntu/ focal multiverse
deb http://us.us.archive.ubuntu.com/ubuntu/ focal-updates multiverse
# deb-src http://us.us.archive.ubuntu.com/ubuntu/ focal-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://us.us.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
# deb-src http://us.us.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu focal partner
# deb-src http://archive.canonical.com/ubuntu focal partner

deb http://security.ubuntu.com/ubuntu/ focal-security main restricted
# deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted
deb http://security.ubuntu.com/ubuntu/ focal-security universe
# deb-src http://security.ubuntu.com/ubuntu/ focal-security universe
deb http://security.ubuntu.com/ubuntu/ focal-security multiverse
# deb-src http://security.ubuntu.com/ubuntu/ focal-security multiverse
deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main
# deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main
deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse

答案1

我通过编辑文件解决了这个问题/etc/apt/sources.list。所有网址都是us.us.archive.ubuntu.com/...,我将其更改为us.archive.com

之后一切都进展顺利。

相关内容