我现在再次安装了 Ubuntu 18.04。之后,我尝试了更新和升级命令。升级命令执行得很好。但是,更新命令未执行并给出错误输出。您可以在以下位置查看错误:
sudo apt-get update
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Err:2 http://tr.archive.ubuntu.com/ubuntu bionic InRelease
Could not resolve 'tr.archive.ubuntu.com'
Err:3 http://tr.archive.ubuntu.com/ubuntu bionic-updates InRelease
Could not resolve 'tr.archive.ubuntu.com'
Err:4 http://tr.archive.ubuntu.com/ubuntu bionic-backports InRelease
Could not resolve 'tr.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://tr.archive.ubuntu.com/ubuntu/dists/bionic/InRelease Could not resolve 'tr.archive.ubuntu.com'
W: Failed to fetch http://tr.archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Could not resolve 'tr.archive.ubuntu.com'
W: Failed to fetch http://tr.archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Could not resolve 'tr.archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
最佳答案
服务器 tr.archive.ubuntu.com 目前不可用,如果您尝试在浏览器中访问它,则会收到 404 错误。您可以从/etc/apt/sources.list 中的 archive.
前面删除 tr.
,然后您的命令就会起作用。
您可以使用文本编辑器(nano 只是一个示例)来执行此操作,如下所示
sudo nano /etc/apt/sources.list
或者你可以像这样使用 sed
sudo sed -i 's|http://tr.|http://|' /etc/apt/sources.list
关于bash - 当我尝试 "sudo apt-get update"时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70237910/