apt-get 更新无法获取文件,“临时失败解决……”错误

Lew*_*wis 152 apt

Err http://archive.canonical.com natty InRelease    
Err http://security.ubuntu.com oneiric-security InRelease               
Err http://extras.ubuntu.com natty InRelease                            
Err http://security.ubuntu.com oneiric-security Release.gpg
  Temporary failure resolving ‘security.ubuntu.com’
Err http://archive.canonical.com natty Release.gpg
  Temporary failure resolving ‘archive.canonical.com’
Err http://extras.ubuntu.com natty Release.gpg
  Temporary failure resolving ‘extras.ubuntu.com’
Err http://gb.archive.ubuntu.com oneiric InRelease
Err http://gb.archive.ubuntu.com oneiric-updates InRelease
Err http://gb.archive.ubuntu.com natty-backports InRelease
Err http://gb.archive.ubuntu.com oneiric Release.gpg
  Temporary failure resolving ‘gb.archive.ubuntu.com’
Err http://gb.archive.ubuntu.com oneiric-updates Release.gpg
  Temporary failure resolving ‘gb.archive.ubuntu.com’
Err http://gb.archive.ubuntu.com natty-backports Release.gpg
  Temporary failure resolving ‘gb.archive.ubuntu.com’

Reading package lists... Done
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/oneiric/InRelease      
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/oneiric-updates/InRelease  
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/natty-backports/InRelease  
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/oneiric-security/InRelease  
W: Failed to fetch http://archive.canonical.com/ubuntu/dists/natty/InRelease  
W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/natty/InRelease  
W: Failed to fetch http://archive.canonical.com/ubuntu/dists/natty/Release.gpg  Temporary failure resolving ‘archive.canonical.com’
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/oneiric-security/Release.gpg  Temporary failure resolving ‘security.ubuntu.com’
W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/natty/Release.gpg  Temporary failure resolving ‘extras.ubuntu.com’
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/oneiric/Release.gpg  Temporary failure resolving ‘gb.archive.ubuntu.com’
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/oneiric-updates/Release.gpg  Temporary failure resolving ‘gb.archive.ubuntu.com’
W: Failed to fetch http://gb.archive.ubuntu.com/ubuntu/dists/natty-backports/Release.gpg  Temporary failure resolving ‘gb.archive.ubuntu.com’
W: Some index files failed to download. They have been ignored, or old ones used instead.
Run Code Online (Sandbox Code Playgroud)

这就是我尝试运行时所看到的sudo apt-get update。我昨天更新了我的实例,现在正在经历这个。

fos*_*dom 238

概述

你的问题有两个部分:

  • 修复临时解决消息
  • 修复包管理问题

临时解决

这个问题很可能是:

  • 由于您的 Internet 服务提供商没有正确地将 Internet 命名 (DNS) 转发到其或外部 DNS 服务器,因此是暂时的,或
  • 由于您的网络中的更改同样阻止了此命名 - 例如,新路由器/调制解调器,使用新配置重新配置交换机。

让我们看看可能的 DNS 解析问题。

首先,在您的系统中临时添加一个已知的 DNS 服务器。

echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
Run Code Online (Sandbox Code Playgroud)

然后运行sudo apt-get update

如果这修复了您的临时解析消息,那么请等待 24 小时,看看您的 ISP 是否为您解决了问题(或只是联系您的 ISP) - 或者您可以将 DNS 服务器永久添加到您的系统中:

echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
Run Code Online (Sandbox Code Playgroud)

8.8.8.8 是 Google 自己的 DNS 服务器。

来源

您可以使用的另一个 DNS 服务器示例是OpenDNS - 例如:

echo "nameserver 208.67.222.222" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
Run Code Online (Sandbox Code Playgroud)

包管理问题

除了临时解决问题 - 您还有一些包管理问题需要更正 - 我假设您最近尝试从一个 Ubuntu 版本升级到下一个推荐版本 - 在您的情况下从 Natty (11.04) 升级到梦境 (11.10)

打开终端并输入

sudo nano /etc/apt/sources.list
Run Code Online (Sandbox Code Playgroud)

在列表中查找与您期望的发行版名称不同的行 - 在您的情况下 - 您已升级到oneiric但您有另一个版本名称natty

例如,寻找看起来像的行 deb http:/archive.canonical.com/ natty backports

#在行首添加 a以将其注释掉 - 例如

#deb http:/archive.canonical.com/ natty backports

保存并重新运行:

sudo apt-get update && sudo apt-get upgrade
Run Code Online (Sandbox Code Playgroud)

您不应再有任何版本命名错误。

在写这篇的时候,可能共同发布的名称包括lucidmavericknattyoneiricprecisequantalraringsaucytrustyutopicvivid

  • `echo "名称服务器 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null` 这完成了工作。 (3认同)
  • 当然,暂时问题又回来了。 (2认同)

Mug*_*hil 17

您可以从目录 /etc/apt/ 上找到的文件 sources.list 中评论未解决的 repo

修改sources.list后,将apt-get repo清理为

apt-get clean
Run Code Online (Sandbox Code Playgroud)

然后更新

apt-get update
Run Code Online (Sandbox Code Playgroud)

错误将消失

  • 这不起作用。 (3认同)

Gil*_*il' 15

请注意,此答案是为旧版本的 Ubuntu 编写的。当前版本使用由 D-Bus 控制的本地名称服务器,此答案的诊断部分适用,但不适用于解决方案。如果/etc/resolv.conf包含nameserver 127.0.1.1或更一般地nameserver 127.X.Y.Z,不要修改它。

“临时故障解析……”表示您的DNS,即从主机名到 IP 地址的转换,没有工作。你最近在你的机器上重新配置了什么吗?如果没有,这可能是您的 ISP 的暂时性错误。

是否ping -n 8.8.8.8显示线条64 bytes from 8.8.8.8: …?(按Ctrl+C停止ping。)

  • 如果没有,则您特别有 IP 连接问题。运行traceroute -n 8.8.8.8并查看它停止的位置:如果它在您的家/办公室,请检查您的网络设备。如果您可以联系到您的 ISP,请向他们投诉。
  • 如果是这样,则您特别有 DNS 问题。检查内容/etc/resolv.conf;应该有一条线nameserver 1.2.3.4(可能不止一个)。如果线路在那里,则您的 ISP 中可能存在暂时性问题,您可以通过添加nameserver 8.8.8.8到该文件来解决它(这声明了一个额外的 DNS 服务器,由 Google 免费提供)。如果后面的第一个数字nameserver是 127,那么您的机器上就有 DNS 中继(这是一件好事),您必须配置该 DNS 中继而不是修改/etc/resolv.conf。在现代版本的 Ubuntu 上,默认情况下有一个 DNS 中继,它是Dnsmasq,它由 D-Bus 控制。

  • 注意: `ping 8.8.8.8 -c3` 仅 ping `3` 次,此时您不需要 Ctrl+C。您可以在参数中使用任何数字,例如 `-c5` 、 `-c1` 、 `-c100` 等。 (3认同)

bab*_*s21 8

我遇到了类似的问题,我尝试了许多建议的解决方案,但重新启动虚拟机后问题就消失了。


kar*_*rel 6

此问题也可能是由错误命名的接口引起的。例如,Temporary failure resolving错误消息可能是由未命名eth0但错误命名的接口引起的eml


解决Temporary failure resolving错误消息的另一种方法是选择不同的更新服务器镜像。

  1. 从 Dash 打开“软件和更新”,然后选择“Ubuntu 软件”选项卡 -> 从“下载自:”右侧的下拉菜单中选择“其他...”

    软件和更新

  2. 单击“选择最佳服务器”按钮以选择最佳下载服务器。

    选择最佳服务器

  3. 我们将进行一系列测试来找到最适合您所在位置的镜子。

    在此输入图像描述

  4. 单击“选择服务器”以选择推荐的服务器。


小智 5

有时,当您在代理服务器后面时,甚至有必要生成一个apt.conf文件/etc/apt/并在其中填充特定条目,例如:

Acquire::http::proxy "http://<yourproxyserver>:<Port>";
Acquire::https::proxy "http://<yourproxyserver>:<Port>";
Acquire::ftp::proxy "http://<yourproxyserver>:<Port>";
Run Code Online (Sandbox Code Playgroud)

如果需要身份验证,配置文件如下所示:

Acquire::http::proxy "http://<domain\user>:<password>@<yourproxyserver>:<Port>";
Acquire::https::proxy "http://<domain\user>:<password>@<yourproxyserver>:<Port>";
Acquire::ftp::proxy "http://<domain\user>:<password>@<yourproxyserver>:<Port>";
Run Code Online (Sandbox Code Playgroud)


Par*_*isa 5

这是一个 DNS 问题。检查你的/etc/resolv.conf文件。

例如,就我而言,当我遇到此问题并检查此文件时,该文件是空的!但它应该包含您的 dns-nameserver

矿:

nameserver 192.168.10.x
Run Code Online (Sandbox Code Playgroud)

192.168.10.x is my gateway ip address

  • 欢迎来到 AskUbuntu!如果您想提供帮助,请做出更详细的回答。我的意思是,涵盖大多数可能的场景和方法或发布适当教程的链接。 (3认同)