Errors in Kali Linux ‘W: Failed to fetch’ and ‘W: Some index files failed to download. They have been ignored, or old ones used instead.’ (SOLVED)

1. Cannot update Kali Linux because errors

A couple of people in recent days wrote about errors when updating programs in Kali Linux. An example of one of the errors:

Hit:1 https://mirror.karneval.cz/pub/linux/kali kali-rolling InRelease         
Err:2 http://deb.i2p2.no unstable InRelease   
  502  Connection timed out [IP: 193.150.121.69 80]
Reading package lists… Done
W: Failed to fetch http://deb.i2p2.no/dists/unstable/InRelease  502  Connection timed out [IP: 193.150.121.69 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.

An example of the second error:

W: Failed to fetch https://http.kali.org/kali/dists/kali-rolling/InRelease
Could not find IP address for "http.kali.org"

The very first thing you need to check if you encounter similar problems, is everything all right with your Internet connection – for example, open some web site.

If your Internet connection is alright, then continue. Let’s consider several examples of solving the problem.

2. Specifying a certain Kali Linux update mirror

When updating Kali Linux, a request is made to the host http.kali.org for a list of mirrors. The system then uses one of these mirrors to update. You can skip the stage of getting the list of mirrors (referring to http.kali.org), and hardcode the desired mirror in the repository sources file /etc/apt/sources.list.

The OFFICIAL Kali Linux repository mirror list is on this page: http://http.kali.org/README.mirrorlist:

On the territory of my country there is one mirror. In other countries, but on the same continent (EU), another 11 mirrors. And another 14 mirrors on other continents.

The mirror line looks like this:

http://ftp.acc.umu.se/mirror/kali.org/kali/README

Cut /README from this line and get the mirror address:

http://ftp.acc.umu.se/mirror/kali.org/kali

Open the /etc/apt/sources.list file:

sudo gedit /etc/apt/sources.list

And enter the mirror address there instead of the ellipsis deb … kali-rolling main non-free contrib, for example:

deb http://ftp.acc.umu.se/mirror/kali.org/kali kali-rolling main non-free contrib

Now a specific mirror will be used for the upgrade.

If the mirror is also unavailable, use the following and so on until you find one that works for you.

All other methods are self-sufficient – they do not require to modify the sources.list file.

3. How to bypass ISP censorship to access Kali Linux servers

With TorIptables2 you can enable redirection of all traffic through Tor. Accordingly, all IPs and web-sites blocked by ISP will be available.

Install Tor and TorIptables2

sudo apt install tor
sudo systemctl start tor
sudo systemctl enable tor
git clone https://github.com/ruped24/toriptables2
cd toriptables2/
sudo mv toriptables2.py /usr/local/bin/
cd

Now, when you want to redirect all traffic through the Tor network (before updating, for example), simply run the command:

sudo toriptables2.py -l

To return to the normal settings, do:

sudo toriptables2.py -f

Attention: the words “all traffic” means “all HTTP traffic. Some programs send raw packets and/or ignore system-wide proxy settings. TorIptables2 redirects traffic without usage of the proxy settings, but using the Iptables firewall, but with raw packets you still need to be careful and double-check their path.

4. Redirecting traffic through the Tor network using Privoxy

With Privoxy, you can achieve exactly the same effect as with TorIptables2.

5. How to bypass ISP censorship using free VPNs

You can use the autovpn program, which will find a free OpenVPN server for you, download the configuration file and connect to it. You can select the country in which you want a VPN. More details in the article “Free easy way to hide IP in Linux”.

As well the ‘How to redirect all traffic through the Tor network’ will be useful for you if you want to use another tools to redirect traffic though Tor network.

Recommended for you:

Leave a Reply

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