TranslateProject/published/201506/20150518 Linux FAQs with Answers--How to fix '404 Not Found' error with 'apt-get update' on old Ubuntu.md
2015-07-01 00:16:33 +08:00

3.2 KiB
Raw Permalink Blame History

Linux有问必答如何更新过期版本的Ubuntu

问题 我的PC上安装了旧版的Ubuntu 13.04急切的浣熊。当我在上面运行“sudo apt-get update”时它丢给了我一大堆“404 Not Found”错误结果是我不能使用apt-get或aptitude来安装或更新任何软件包了。由于该错误的原因我甚至不能将它升级到更新的版本。我怎样才能修复这个问题啊

每个Ubuntu版本都有生命结束周期EOL时间常规的Ubuntu发行版提供18个月的支持而LTS长期支持版本则长达3年服务器版本和5年桌面版本。当某个Ubuntu版本达到生命结束周期时其仓库就不能再访问了你也不能再从Canonical获取任何维护更新和安全补丁。在撰写本文时Ubuntu 13.04(急切的浣熊)已经达到了它的生命结束周期。

如果你所使用的Ubuntu系统已经被结束生命周期你就会从apt-get或aptitude得到以下404错误因为它的仓库已经被遗弃了。

W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-backports/multiverse/binary-i386/Packages  404  Not Found [IP: 91.189.91.13 80]

W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/raring/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/universe/binary-i386/Packages  404  Not Found [IP: 91.189.88.149 80]

E: Some index files failed to download. They have been ignored, or old ones used instead

对于那些还在使用旧版本Ubuntu的用户Canonical维护了一个old-releases.ubuntu.com的网站这里包含了结束生命周期的仓库归档。因此当Canonical对你安装的Ubuntu版本结束支持时你需要将仓库切换到old-releases.ubuntu.com除非你在结束生命周期之前想要升级

这里通过切换到旧版本仓库提供了一个快速修复“404 Not Found”错误的便捷方式。

首先使用old-releases仓库替换main/security仓库就像下面这样。

$ sudo sed -i -r 's/([a-z]{2}\.)?archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
$ sudo sed -i -r 's/security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list

然后,使用文本编辑器打开/etc/apt/sources.list并查找extras.ubuntu.com。该仓库也不再支持Ubuntu 13.04了,所以你需要使用“#”号将extras.ubuntu.com注释掉。

#deb http://extras.ubuntu.com/ubuntu raring main
#deb-src http://extras.ubuntu.com/ubuntu raring main

现在你应该可以在旧版不受支持的Ubuntu上安装或更新软件包了。


via: http://ask.xmodulo.com/404-not-found-error-apt-get-update-ubuntu.html

作者:Dan Nanni 译者:GOLinux 校对:wxy

本文由 LCTT 原创翻译,Linux中国 荣誉推出