解决 Ubuntu 12.04 更新错误:(-5 - 没有与主机名关联的地址)

解决 Ubuntu 12.04 更新错误:(-5 - 没有与主机名关联的地址)

问题描述:

每次我尝试下载操作系统(Ubuntu 12.04)的更新时,都会收到以下错误消息列表:

W:Failed to fetch http://extras.ubuntu.com/ubuntu/dists/precise/Release.gpg  Something wicked happened resolving 'extras.ubuntu.com:http' (-5 - No address associated with hostname)
, W:Failed to fetch http://ppa.launchpad.net/deluge-team/ppa/ubuntu/dists/precise/Release.gpg  Something wicked happened resolving 'ppa.launchpad.net:http' (-5 - No address associated with hostname)
, W:Failed to fetch http://packages.medibuntu.org/dists/precise/Release.gpg  Something wicked happened resolving 'packages.medibuntu.org:http' (-5 - No address associated with hostname)
, W:Failed to fetch http://archive.canonical.com/ubuntu/dists/precise/Release.gpg  Something wicked happened resolving 'archive.canonical.com:http' (-5 - No address associated with hostname)
, W:Failed to fetch http://ppa.launchpad.net/tualatrix/ppa/ubuntu/dists/precise/Release.gpg  Something wicked happened resolving 'ppa.launchpad.net:http' (-5 - No address associated with hostname)
, E:Some index files failed to download. They have been ignored, or old ones used instead.

/etc/apt/sources.list 文件的内容:

# deb cdrom:[Ubuntu 12.04 LTS _Precise Pangolin_ - Release i386 (20120423)]/ precise main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu precise main restricted
deb-src http://archive.ubuntu.com/ubuntu precise main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://archive.ubuntu.com/ubuntu precise-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu precise-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://archive.ubuntu.com/ubuntu precise universe
deb-src http://archive.ubuntu.com/ubuntu precise universe
deb http://archive.ubuntu.com/ubuntu precise-updates universe
deb-src http://archive.ubuntu.com/ubuntu precise-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://archive.ubuntu.com/ubuntu precise multiverse
deb-src http://archive.ubuntu.com/ubuntu precise multiverse
deb http://archive.ubuntu.com/ubuntu precise-updates multiverse
deb-src http://archive.ubuntu.com/ubuntu precise-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.

deb http://archive.ubuntu.com/ubuntu precise-security main restricted
deb-src http://archive.ubuntu.com/ubuntu precise-security main restricted
deb http://archive.ubuntu.com/ubuntu precise-security universe
deb-src http://archive.ubuntu.com/ubuntu precise-security universe
deb http://archive.ubuntu.com/ubuntu precise-security multiverse
deb-src http://archive.ubuntu.com/ubuntu precise-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu precise partner
# deb-src http://archive.canonical.com/ubuntu precise partner

## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
deb http://extras.ubuntu.com/ubuntu precise main
# deb-src http://extras.ubuntu.com/ubuntu precise main

(/etc/apt/sources.list.d) 目录内的文件:

-rw-r--r-- 1 root root 136 Oct 10 16:30 deluge-team-ppa-precise.list    
-rw-r--r-- 1 root root 136 Oct 10 16:30 deluge-team-ppa-precise.list.save         
-rw-r--r-- 1 root root 285 Oct 10 16:30 medibuntu.list        
-rw-r--r-- 1 root root 285 Oct 10 16:30 medibuntu.list.save          
-rw-r--r-- 1 root root 132 Oct 10 16:30 tualatrix-ppa-precise.list         
-rw-r--r-- 1 root root 134 Oct 10 16:30 tualatrix-ppa-precise.list.save          
-rw-r--r-- 1 root root 148 Oct 10 16:30 yannubuntu-boot-repair-precise.list       
-rw-r--r-- 1 root root 148 Oct 10 16:30 yannubuntu-boot-repair-precise.list.save  

AskUbuntu.com 上此文章的相关链接:

服务器错误(-5 - 没有与主机名关联的地址)
更新时如何修复“-5 没有与主机名关联的地址错误”?

我尝试过在网上搜索解决问题的方法,但没能找出导致这些错误的真正原因。任何可能帮助我解决这个问题的建议、想法或解决方案都将不胜感激。

答案1

该问题的解决方法如下:

步骤1:转到系统 –> 首选项 –> 网络连接。

第2步:接下来,选择您的默认网络接口(eth0)并单击“编辑”。

步骤3:然后选择“IPv4 设置”并选择“仅自动(DHCP)地址”。

步骤4:接下来,在“DNS 服务器”框中输入新的 DNS 服务器地址。使用逗号分隔多个地址,然后单击“应用”保存。

步骤5:选择您喜欢的 DNS 详细信息

OpenDNS           --->  208.67.222.222, 208.67.220.220              
Google Public DNS --->  8.8.8.8, 8.8.4.4                 
Comodo Secure DNS --->  156.154.70.22, 156.154.71.22

配置完成后,请上网检查以确保其正常工作。

有关解决类似问题的完整分步教程,请查看:
http://www.liberiangeek.net/2010/08/change-dns-information-ubuntu-10-04-lucid-lynx/

上面的链接解释了如何更改 Ubuntu 中的 DNS 设置。

答案2

我遇到了同样的问题,上述答案都无法解决它。不过,我现在已经解决了。原来我所需要做的就是进入终端并输入sudo apt-get update。运行完成后,我的更新管理器会刷新,给我一份新的要更新的项目列表,然后我单击更新,一切运行正常。不知道这是否会对其他人有所帮助,但我希望它能。

答案3

cat /etc/apt/sources.list 

编辑

sudo gedit /etc/apt/sources.list

删除http://packages.medibuntu.org/

然后运行

sudo apt-get update

答案4

如果您有代理,那么此链接有一些答案。

看着那(这设置 apt-get 以使用 http 代理网页内的部分。

相关内容