当我使用以下命令运行更新命令时:
sudo apt-get update
然后我收到错误消息:
Ign http://archive.ubuntu.com trusty/universe Translation-en_IN
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com|security.ubuntu.com/ubuntu/dists/trusty-security/InRelease
W: Failed to fetch http://archive.ubuntu.com|security.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg Could not resolve 'archive.ubuntu.com|security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
我的 Ubuntu 版本是 Ubuntu 14.04.4 LTS
我尝试了很多次通过不同的论坛来修复这个问题但都无济于事。
请建议我该如何修复它。
内容/etc/apt/sources.list
#deb cdrom:[Ubuntu 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)]/ trusty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
## Major bug fix updates produced after the final release of the
## distribution.
# deb http://in.archive.ubuntu.com|security.ubuntu.com/ubuntu/ trusty-updates main restricted
# deb-src http://in.archive.ubuntu.com|security.ubuntu.com/ubuntu/ trusty-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://in.archive.ubuntu.com|security.ubuntu.com/ubuntu/ trusty universe
# deb-src http://in.archive.ubuntu.com|security.ubuntu.com/ubuntu/ trusty universe
# deb http://in.archive.ubuntu.com|security.ubuntu.com/ubuntu/ trusty-updates universe
# deb-src http://in.archive.ubuntu.com|security.ubuntu.com/ubuntu/ trusty-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://in.archive.ubuntu.com|security.ubuntu.com/ubuntu/ trusty multiverse
# deb-src http://in.archive.ubuntu.com|security.ubuntu.com/ubuntu/ trusty multiverse
# deb http://in.archive.ubuntu.com|security.ubuntu.com/ubuntu/ trusty-updates multiverse
# deb-src http://in.archive.ubuntu.com|security.ubuntu.com/ubuntu/ trusty-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|security.ubuntu.com/ubuntu trusty-security main restricted
deb http://archive.ubuntu.com|security.ubuntu.com/ubuntu trusty-security universe
deb http://archive.ubuntu.com|security.ubuntu.com/ubuntu trusty-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 trusty partner
# deb-src http://archive.canonical.com/ubuntu trusty 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 trusty main
# deb-src http://extras.ubuntu.com/ubuntu trusty main
deb http://archive.ubuntu.com/ubuntu trusty main universe restricted multiverse
deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse
答案1
您的文件有问题/etc/apt/sources.list
。在源行中,您不应该包含任何行in.archive.ubuntu.com|security.ubuntu.com
。
使用以下命令保存源文件的备份:
cp -a /etc/apt/sources.list /etc/apt/sources.list.bak
然后用来sed
更正您当前的源文件:
sed -i 's/in.archive.ubuntu.com|security.ubuntu.com/in.archive.ubuntu.com/g' /etc/apt/sources.list
其次是
sed -i 's/archive.ubuntu.com|security.ubuntu.com/security.ubuntu.com/g' /etc/apt/sources.list
apt-get
此后您的命令应该可以正常工作。
实际上我刚刚才注意到所有的印度镜像(in.archive.ubuntu.com)都被注释掉了,这些命令已经修复了这些条目,但它们并没有被使用。
问题出在与安全更新相关的错误条目上。现在,当您更新时,您将收到安全更新,其余更新将来自主 Ubuntu 镜像,从本地镜像(即条目)更新可能会更快in.archive.ubuntu.com
。