每个ubuntu版本都有生命结束周期(eol)时间;常规的ubuntu发行版提供18个月的支持,而lts(长期支持)版本则长达3年(服务器版本)和5年(桌面版本)。当某个ubuntu版本达到生命结束周期时,其仓库就不能再访问了,你也不能再从canonical获取任何维护更新和安全补丁。在撰写本文时,ubuntu 13.04(急切的浣熊)已经达到了它的生命结束周期。
如果你所使用的ubuntu系统已经被结束生命周期,你就会从apt-get或aptitude得到以下404错误,因为它的仓库已经被遗弃了。
<code>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]</code>
<code></code>
<code>w: failed to fetch http://extras.ubuntu.com/ubuntu/dists/raring/main/binary-amd64/packages 404 not found</code>
<code>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]</code>
<code>e: some index files failed to download. they have been ignored, or old ones used instead</code>

对于那些还在使用旧版本ubuntu的用户,canonical维护了一个old-releases.ubuntu.com的网站,这里包含了结束生命周期的仓库归档。因此,当canonical对你安装的ubuntu版本结束支持时,你需要将仓库切换到old-releases.ubuntu.com(除非你在结束生命周期之前想要升级)。
这里,通过切换到旧版本仓库提供了一个快速修复“404 not found”错误的便捷方式。
首先,使用old-releases仓库替换main/security仓库,就像下面这样。
<code>$ sudo sed -i -r 's/([a-z]{2}\.)?archive.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list</code>
<code>$ sudo sed -i -r 's/security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list</code>
然后,使用文本编辑器打开/etc/apt/sources.list,并查找extras.ubuntu.com。该仓库也不再支持ubuntu 13.04了,所以你需要使用“#”号将extras.ubuntu.com注释掉。
<code>#deb http://extras.ubuntu.com/ubuntu raring main</code>
<code>#deb-src http://extras.ubuntu.com/ubuntu raring main</code>
现在,你应该可以在旧版不受支持的ubuntu上安装或更新软件包了。
<b>原文发布时间为:2015-06-10</b>
<b>本文来自云栖社区合作伙伴“linux中国”</b>