Bobcares

Some index files failed to download: Ubuntu – How to fix

by | Mar 9, 2021

Stuck with the error ‘Some index files failed to download’? We can help you.

At times Ubuntu users come across the error “W: Some index files failed to download” usually while updating the system.

Here at Bobcares, we often get requests from our customers to fix this error as a part of our Server Management Services.

Today let’s see how our Support Techs fix this error for our customers.

Methods to fix ‘Some index files failed to download’ error

The error message usually looks like the ones given below:

W: Failed to fetch archive.ubuntu.com/ubuntu/dists/quantal-security/Release.gpg Unable to connect to archive.ubuntu.com:http:
W: Some index files failed to download. They have been ignored, or old ones used instead.

From the first line, the error indicates a mirror that is down or unavailable. In this case, the mirror archive.ubuntu.com is unavailable for some reason.

Generally, this means that some repositories activated don’t exist anymore, at least on the mirror we are using.

This error will be gone once the mirror is back online. However, since we cannot be certain how long it will take for the mirror to become available once again, the best method is to switch to a different mirror.

The following are some methods that our Support Engineers follow to fix this error.

1. Reverting to the Original Ubuntu Mirror

Firstly we can try to switch back to the original mirror when we encounter this error.

This involves creating a new sources list file from the sample source list file in /usr/share/doc/apt/examples/sources.list path.

We need to make a backup copy of the sources list using the following command:

$ sudo mv /etc/apt/sources.list{,.backup}

$ sudo mv /etc/apt/sources.list.d{,.backup}

Next, we can create a new sources list file from the sample sources list file using the following commands:

$ sudo mkdir /etc/apt/sources.list.d
$ sudo cp /usr/share/doc/apt/examples/sources.list /etc/apt/sources.list

Finally, update the repositories.

$ sudo apt update

This will restore all the mirrors and enable the ‘Main‘ repository.

To install community-supported software packages, proprietary packages, and packages not available under a completely free license, we might consider enabling the following repositories:

Universe – Community-maintained free and open-source software.
Restricted – Proprietary drivers for devices.
Multiverse – Software restricted by copyright or legal issues.

To enable these repositories, we can use the following commands:

$ sudo add-apt-repository restricted
$ sudo add-apt-repository multiverse
$ sudo add-apt-repository universe

After that, we will update the package lists using the following command:

$ sudo apt update

2. Selecting the Nearest Mirror from Official Ubuntu Mirrors

Alternatively, we can try switching to the nearest mirror. This often happens to be the fastest mirror and relative to our geographical location.

The easiest approach is to ensure that the mirror defined within the sources list file includes the country code relative to our country of residence.

For example, the Official United States mirror provided in /etc/apt/sources.list is:

deb http://us.archive.ubuntu.com/ubuntu focal main restricted

We can replace the country code with the appropriate country code.

deb http://your_country_code.archive.ubuntu.com/ubuntu focal main restricted

Finally, update the sources list using the following command:

$ sudo apt update

3. Copying Sources List Contents from a Well Functioning System

Another way to resolve this error is to copy the contents of the sources list file from another functional Ubuntu system and paste them into the system’s sources list file. This is by far the easiest method of fixing this error.

4. Finding the best Ubuntu APT repository mirror

We can also fix this issue by finding the best working APT archive mirror for our location and update /etc/apt/sources.list file accordingly.

The mirrors may not always be the closest to our location but offer the best possible download rate and update status.

Firstly, we will backup the existing sources.list file:

$ sudo cp /etc/apt/sources.list{,.backup}

Next, we can check the APT archive mirror. We can do this either in the GUI way or CLI way.

Here, let us see the graphical way:

The steps to follow are given below:

1. First, open the “Software & updates” window.

2. And choose “Other” in the “Download from” drop-down box

3.Then choose the “Select Best Server” option.

A series of tests will be performed to find a mirror that gives the best download speed for our location. It will take just a few seconds.

4. Once the best mirror is found, click on the “Choose Server” option.

5. Now close the Software & Updates window.

Finally, click on the “Reload” button to update the repository lists.

5. Updating the system

Just open synaptic manager, install/reinstall ubuntu-extras-keyring, and then (in terminal) type the following command:

sudo apt-get update

 [Still, stuck with the error? – We can help you]

Conclusion

To conclude, we saw some of the methods which our Support Techs follow to fix the ‘Some index files failed to download’ error.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.