一、问题描述:
因为经常使用apt-get命令安装所需要的开发软件,但经常由于链接不上软件源不能正常安装,于是就是用sudo apt-get update命令来更新软件源,但这条更新命令也经常不能正常使用,出现大量的错误:W: Failed to fetch *** 404 Not Found ***。下面是我在虚拟机Ubuntu 14.10 i386上更新软件源失败的详细信息:
sktbj@ubuntu:~$ sudo apt-get update
[sudo] password for sktbj:
Ign http://security.ubuntu.com utopic-security InRelease
Ign http://security.ubuntu.com utopic-security Release.gpg
Ign http://extras.ubuntu.com utopic InRelease
Ign http://security.ubuntu.com utopic-security Release
Get:1 http://extras.ubuntu.com utopic Release.gpg [72 B]
Hit http://extras.ubuntu.com utopic Release
Hit http://extras.ubuntu.com utopic/main Sources
Hit http://extras.ubuntu.com utopic/main i386 Packages
Ign http://us.archive.ubuntu.com utopic InRelease
Ign http://us.archive.ubuntu.com utopic-updates InRelease
Ign http://us.archive.ubuntu.com utopic-backports InRelease
Ign http://us.archive.ubuntu.com utopic Release.gpg
Ign http://us.archive.ubuntu.com utopic-updates Release.gpg
Ign http://us.archive.ubuntu.com utopic-backports Release.gpg
Ign http://us.archive.ubuntu.com utopic Release
Ign http://us.archive.ubuntu.com utopic-updates Release
Ign http://extras.ubuntu.com utopic/main Translation-en_US
Ign http://us.archive.ubuntu.com utopic-backports Release
Ign http://extras.ubuntu.com utopic/main Translation-en
Err http://security.ubuntu.com utopic-security/main Sources
404 Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com utopic-security/restricted Sources
404 Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com utopic-security/universe Sources
404 Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com utopic-security/multiverse Sources
404 Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com utopic-security/main i386 Packages
404 Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com utopic-security/restricted i386 Packages
404 Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com utopic-security/universe i386 Packages
404 Not Found [IP: 91.189.88.149 80]
Err http://security.ubuntu.com utopic-security/multiverse i386 Packages
404 Not Found [IP: 91.189.88.149 80]
Ign http://security.ubuntu.com utopic-security/main Translation-en_US
Ign http://security.ubuntu.com utopic-security/main Translation-en
Ign http://security.ubuntu.com utopic-security/multiverse Translation-en_US
Ign http://security.ubuntu.com utopic-security/multiverse Translation-en
Ign http://security.ubuntu.com utopic-security/restricted Translation-en_US
Ign http://security.ubuntu.com utopic-security/restricted Translation-en
Ign http://security.ubuntu.com utopic-security/universe Translation-en_US
Ign http://security.ubuntu.com utopic-security/universe Translation-en
Err http://us.archive.ubuntu.com utopic/restricted Sources
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic/main Sources
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic/universe Sources
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic/multiverse Sources
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic/main i386 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic/restricted i386 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic/universe i386 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic/multiverse i386 Packages
404 Not Found [IP: 91.189.91.23 80]
Ign http://us.archive.ubuntu.com utopic/main Translation-en_US
Ign http://us.archive.ubuntu.com utopic/main Translation-en
Ign http://us.archive.ubuntu.com utopic/multiverse Translation-en_US
Ign http://us.archive.ubuntu.com utopic/multiverse Translation-en
Ign http://us.archive.ubuntu.com utopic/restricted Translation-en_US
Ign http://us.archive.ubuntu.com utopic/restricted Translation-en
Ign http://us.archive.ubuntu.com utopic/universe Translation-en_US
Ign http://us.archive.ubuntu.com utopic/universe Translation-en
Err http://us.archive.ubuntu.com utopic-updates/main Sources
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-updates/restricted Sources
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-updates/universe Sources
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-updates/multiverse Sources
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-updates/main i386 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-updates/restricted i386 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-updates/universe i386 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-updates/multiverse i386 Packages
404 Not Found [IP: 91.189.91.23 80]
Ign http://us.archive.ubuntu.com utopic-updates/main Translation-en_US
Ign http://us.archive.ubuntu.com utopic-updates/main Translation-en
Ign http://us.archive.ubuntu.com utopic-updates/multiverse Translation-en_US
Ign http://us.archive.ubuntu.com utopic-updates/multiverse Translation-en
Ign http://us.archive.ubuntu.com utopic-updates/restricted Translation-en_US
Ign http://us.archive.ubuntu.com utopic-updates/restricted Translation-en
Ign http://us.archive.ubuntu.com utopic-updates/universe Translation-en_US
Ign http://us.archive.ubuntu.com utopic-updates/universe Translation-en
Err http://us.archive.ubuntu.com utopic-backports/main Sources
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-backports/restricted Sources
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-backports/universe Sources
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-backports/multiverse Sources
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-backports/main i386 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-backports/restricted i386 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-backports/universe i386 Packages
404 Not Found [IP: 91.189.91.23 80]
Err http://us.archive.ubuntu.com utopic-backports/multiverse i386 Packages
404 Not Found [IP: 91.189.91.23 80]
Ign http://us.archive.ubuntu.com utopic-backports/main Translation-en_US
Ign http://us.archive.ubuntu.com utopic-backports/main Translation-en
Ign http://us.archive.ubuntu.com utopic-backports/multiverse Translation-en_US
Ign http://us.archive.ubuntu.com utopic-backports/multiverse Translation-en
Ign http://us.archive.ubuntu.com utopic-backports/restricted Translation-en_US
Ign http://us.archive.ubuntu.com utopic-backports/restricted Translation-en
Ign http://us.archive.ubuntu.com utopic-backports/universe Translation-en_US
Ign http://us.archive.ubuntu.com utopic-backports/universe Translation-en
Fetched 72 B in 1min 8s (1 B/s)
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/main/source/Sources 404 Not Found [IP: 91.189.88.149 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/restricted/source/Sources 404 Not Found [IP: 91.189.88.149 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/universe/source/Sources 404 Not Found [IP: 91.189.88.149 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/multiverse/source/Sources 404 Not Found [IP: 91.189.88.149 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/main/binary-i386/Packages 404 Not Found [IP: 91.189.88.149 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/restricted/binary-i386/Packages 404 Not Found [IP: 91.189.88.149 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/universe/binary-i386/Packages 404 Not Found [IP: 91.189.88.149 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/utopic-security/multiverse/binary-i386/Packages 404 Not Found [IP: 91.189.88.149 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/main/source/Sources 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/restricted/source/Sources 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/universe/source/Sources 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/multiverse/source/Sources 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/main/binary-i386/Packages 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/restricted/binary-i386/Packages 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/universe/binary-i386/Packages 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic/multiverse/binary-i386/Packages 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/main/source/Sources 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/restricted/source/Sources 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/universe/source/Sources 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/multiverse/source/Sources 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/main/binary-i386/Packages 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/restricted/binary-i386/Packages 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/universe/binary-i386/Packages 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-updates/multiverse/binary-i386/Packages 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/main/source/Sources 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/restricted/source/Sources 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/universe/source/Sources 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/multiverse/source/Sources 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/main/binary-i386/Packages 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/restricted/binary-i386/Packages 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/universe/binary-i386/Packages 404 Not Found [IP: 91.189.91.23 80]
W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/utopic-backports/multiverse/binary-i386/Packages 404 Not Found [IP: 91.189.91.23 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
二、错误原因:
由于Ubuntu更新换代很快,你的Ubuntu一旦不是最新版本后,其仓库(repository)就会被转移到另外的服务器上面。所以不再是http://archive.ubuntu.com/ubuntu/dist/ 这里能找到的。
三、解决方案:
你可以通过修改 /etc/apt/sources.list 来把链接指向旧的版本仓库,使用以下实例代码将/etc/apt/sources.list中的所archive.ubuntu.com和security.ubuntu.com替换成old-releases.ubuntu.com:
sudo sed -i -e 's/us.archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
然后在执行更新命令:
sudo apt-get update
问题解决!
参考资料:Ubuntu apt-get 出现Error 404:Not found Package Repository Errors