Apt-get 更新在 Ubuntu 16.04“临时故障解决”中不起作用

San*_*dor 5 apt

首先,我是 Linux 命令行的新手。我以前从未使用过它。我的问题是该命令apt-get update只会返回:

Err:1 http://us.archive.ubuntu.com/ubuntu xenial InRelease
  Temporary failure resolving 'us.archive.ubuntu.com'
Err:2 http://us.archive.ubuntu.com/ubuntu xenial-security InRelease
  Temporary failure resolving 'us.archive.ubuntu.com'
Err:3 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease
  Temporary failure resolving 'us.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Temporary failure resolving 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial-security/InRelease  Temporary failure resolving 'us.archive.ubuntu.com'
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Temporary failure resolving 'us.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)

我的sources.list文件看起来像这样:

#------------------------------------------------------------------------------#
#                            OFFICIAL UBUNTU REPOS                             #
#------------------------------------------------------------------------------#


###### Ubuntu Main Repos
deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse 
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse 

###### Ubuntu Update Repos
deb http://us.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse 
deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse 
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse 
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe multiverse
Run Code Online (Sandbox Code Playgroud)

我的 ubuntu 版本是:

Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-66-generic x86_64)
Run Code Online (Sandbox Code Playgroud)

小智 15

我遇到过同样的问题。问题的核心是无法解析 DNS。我丢失了我的/etc/resolv.conf文件。

它的内容应该是:

nameserver 8.8.8.8
nameserver 8.8.4.4
Run Code Online (Sandbox Code Playgroud)

之后,重新启动正确的界面(我的是lo而不是eth0)。您可以在/etc/network/interfaces文件中找到它。

  • 更改`/etc/resolv.conf`后无需重新启动界面。您确实需要重新启动连续运行的使用解析器的程序,例如 firefox。 (2认同)