bash - 当我尝试 "sudo apt-get update"时出现错误

标签 bash ubuntu ubuntu-18.04 apt apt-get

我现在再次安装了 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/

相关文章:

postgresql - microk8s集群中如何访问本地安装的postgresql

bash循环遍历子目录中的所有查找

php - 编译 php 时出错 - DSO 丢失

mysql - Ubuntu 中恢复 MySql 文件时出错

linux - psensors 和 gnome-system-monitor 的内存信息不同

bash - 如何使用 bash 脚本或简化 ffmpeg 命令以调整水印大小、将其添加到视频中并将 subtitle.ass 添加到视频中?

mysql - 使用 apache2 服务器创建网站及其文件时,/var/www/html 中的权限被拒绝

bash - 打印所有列,但首先由模式分隔,bash

linux - sed 从文件追加文本到行

linux - sed 命令的奇怪行为