WSL Ubuntu 20.04执行sudo apt-get update时出现503 Service Unavailable错误求助
以下是针对该问题的可行解决方案:
切换WSL网络模式
- 打开PowerShell执行
wsl --shutdown关闭所有WSL实例 - 在用户目录(
C:\Users\<你的用户名>)下新建或编辑.wslconfig文件,添加以下内容:[wsl2] networkMode=mirrored - 重启WSL后再次执行
sudo apt-get update
- 打开PowerShell执行
重置WSL与Windows网络栈
在PowerShell中依次执行以下命令,完成后重启电脑:netsh winsock reset netsh int ip reset all netsh winhttp reset proxy ipconfig /flushdns wsl --shutdown改用HTTPS源
编辑apt源配置文件:sudo nano /etc/apt/sources.list将文件中所有
http://开头的源地址替换为https://,例如把http://archive.ubuntu.com/ubuntu改为https://archive.ubuntu.com/ubuntu。保存退出后执行sudo apt-get update。重置apt缓存
执行以下命令清除旧缓存并重新拉取索引:sudo apt-get clean sudo rm -rf /var/lib/apt/lists/* sudo apt-get update排查防火墙/安全软件拦截
暂时关闭Windows防火墙或第三方安全软件,测试是否能正常更新,确认是否存在网络拦截情况。
错误信息详情
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease 503 Service Unavailable [IP: 91.189.91.81 80] Err:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease 503 Service Unavailable [IP: 91.189.91.81 80] Err:3 http://security.ubuntu.com/ubuntu focal-security InRelease 503 Service Unavailable [IP: 185.125.190.39 80] Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease 503 Service Unavailable [IP: 91.189.91.81 80] Reading package lists... Done W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease 503 Service Unavailable [IP: 91.189.91.81 80] W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease 503 Service Unavailable [IP: 91.189.91.81 80] W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease 503 Service Unavailable [IP: 91.189.91.81 80] W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease 503 Service Unavailable [IP: 185.125.190.39 80] W: Some index files failed to download. They have been ignored, or old ones used instead.
内容的提问来源于stack exchange,提问作者sebastian balcero
相关产品推荐
相关产品推荐

