How to Fix Kali Linux slow apt update process

  • Post last modified:December 31, 2020
  • Reading time:3 mins read

Today Itself I have installed Kali Linux on my Desktop, and When the installation part is over. The first and most important part is to update the repository to get the latest update of libraries.

So, I have started sudo apt update && apt upgrade -y and I have noticed the update is taking longer than expected. I check the internet speed, and the speed was good enough.

This issue was found early also, so I have changed the official mirror with the new mirror link without wasting any moment.

In this guidepost, we will show you how to fix slow apt updates. Before this, understand why the apt update is getting download slow.

Slow fetching update from official repositories

Whenever you update Kali official repository, all the necessary file are receiving from the default repository  http://http.kali.org.

A default repository redirects you to the nearest server, which is available to your location.

Because of the large number of ongoing connections to the nearest server, it overloads the capacity than required. Due to that, downloading is slow, and sometimes even you will get a good speed.

We have found the list of available repositories which server located is all around the world.

Now we will see how to replace default repositories to mirror link.

Change mirror list from /etc/apt/source.list

A default sources.list file stored at /etc/apt/sources.list. To check the default repository

# nano /etc/apt/sources.list
Default sources.list
Default sources.list

We will make changes to the source. list file before that makes sure to create a backup of the source.list.

To take backup type the following command in your terminal

# cp /etc/apt/sources.list /etc/apt/sources.listbak

Now we will select the best server link to check. You can refer to this Mirror Link.

Open the above link and copy any mirror link from the list. In my case, I have selected the last mirror link, which is best among all the provided “https://mirrors.ocf.berkeley.edu/kali/”.

After this, open your terminal with any command-line editor or nano and pass the following command.

# nano /etc/apt/sources.list

If you want to use the same mirror link which I’m using, then you can directly copy-paste the below code

deb https://mirrors.ocf.berkeley.edu/kali/  kali-rolling main contrib non->
# For source package access, uncomment the following line
# deb-src https://mirrors.ocf.berkeley.edu/kali/ kali-rolling main contrib>
After replacing default sources
After replacing default sources

Now save this file and run the update process.

# apt clean
# apt update && apt upgrade -y

You will see the speed improvement, and If the speed is the same, then you need to choose another mirror link.

Read this :- The complete guide for NMAP Command

Get Mirror Link
Get Mirror Link

To use a different mirror link, open the site Mirror Link and copy any link. For example, I will copy the list https://mirrors.ocf.berkeley.edu/kali/.

Note:- Copy the url till /kali don’t include README.

After this, open the /etc/apt/sources.list using nano or vim and replace the default source link with a mirror link.

Try again to update official repository.

The problem will probably be solved from the mirror link which we provided if you have made any unwanted changes to sources.list then you can restore the backup.

I Hope so your problem is resolved. If you are facing any issues while making any configuration, then let me know.

Like what you read? Please share it with others.
  • 1
    Share
guest
0 Comments
Inline Feedbacks
View all comments