When using the desktop version of Ubuntu you'll eventuall get or probably have the problem
that apt-get update throws a lot "Failed to fetch 404 Not Found" errors.
Additionally, you may have the same problem when running apt-get install.
Don't worry, it will be fixed in a minute.
The Problem
You may see messages like the ones below when executing apt-get update or apt-get install.
That is because Ubuntu releases are only supported for 9 months. LTS (Long Term Support)
releases have support for 5 years. Once support is cut for the version you're using,
you'll see those error messages. Ubuntu moves the repositories to another server
and the defined url to reach the sources are no longer available on default location
$ sudo apt-get update
Ign raring Release.gpg
Ign raring-updates Release.gpg
Ign raring-backports Release.gpg
Ign http://security.ubuntu.com raring-security Release.gpg
Ign raring Release
Ign raring-updates Release
Ign raring-backports Release
…
404 Not Found [IP: 91.189.92.201 80]
Err http://security.ubuntu.com raring-security/restricted Sources
404 Not Found [IP: 91.189.92.201 80]
Err http://security.ubuntu.com raring-security/universe Sources
404 Not Found [IP: 91.189.92.201 80]
Err http://security.ubuntu.com raring-security/multiverse Sources
404 Not Found [IP: 91.189.92.201 80]
Ign raring-backports/main Translation-en
Ign raring-backports/multiverse Translation-en
Err http://security.ubuntu.com raring-security/main amd64 Packages
…
W: Failed to fetch /ubuntu/dists/raring/restricted/source/Sources 404 Not Found [IP: 141.30.13.30 80]
W: Failed to fetch /ubuntu/dists/raring/universe/source/Sources 404 Not Found [IP: 141.30.13.30 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/main/source/Sources 404 Not Found [IP: 91.189.92.201 80]
W: Failed to fetch /ubuntu/dists/raring/multiverse/source/Sources 404 Not Found [IP: 141.30.13.30 80]
…
E: Some index files failed to download. They have been ignored, or old ones used instead.
How to Fix The Problem
There are two solutions to get your apt commands working again. First: upgrade the Ubuntu release.
Second: update the sources url to the old package repositories.
Both solutions are described below in more detail.
Distribution Upgrade
The most simple solution is to upgrade your Ubuntu instance to the newest release:
$ sudo apt-get dist-upgrade
If the distribution upgrade is not an option right now, you can update the sources url
for the Ubuntu repositories to find the old packages.
Update Packages Url
You can use the sed command to update the sources in /etc/apt/sources.list file
to the new location for old package repositories2.
Run the following command to update archive.ubuntu.com and security.ubuntu.com package repository4 urls
with old-releases.ubuntu.com. Since the normal Ubuntu releases link to the archive.… and security.… urls,
the support will be removed after their live cycle of 9 months and respective repositories3 moved to old-releases.….
$ sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list
Linux Mint additionally requires the execution of this command:
$ sudo sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list.d/official-package-repositories.list
To check whether there are other files in /etc/apt/sources.list.d/ which need to be updated,
use the following grep command.
$ grep -E 'archive.ubuntu.com|security.ubuntu.com' /etc/apt/sources.list.d/*
That's it. Now you can update your sources again.
$ sudo apt-get update
阅读(2021) | 评论(0) | 转发(0) |