6

I just recently installed Kali Linux 2.0 (64-Bit) on Virtual Box with a Windows 7 (64-Bit) host. I have problem with apt-get, and the simple question here is, how can I fix it?

Unfortunately running: apt-get update, returns with an error message as follows:

(If you see something that isn't quite right, I just typed that by hand because I can't get bridged clipboards to work.)

root@kali~# apt-get update

0% [Connecting to http.kali.org (192.99.200.113)}]

That "0%" message stays there for thirty seconds then disappears after the error message appears.

Err http://http.kali.org sana InRelease

Err http://http.kali.org sana/updates InRelease

Err http://http.kali.org sna Release.gpg  
   Unable to connect to http.kali.org:http:  
Segmentation fault
Reading package lists... Done  
W: Failed to fetch http://http.kai.org/kali/dists/sana/InRelease
 
W: Failed to fetch http://http.kali.org/kalisecurity/dists/sana/updates/InRelease  

W: Faied to fetch http://http.kali.org/kali/dists/sana/Release.gpg
   Unable to connect to http.kali.org:http:

W: Some index files failed to download. They have been ignored, or old ones used instead.

This is what resides in etc/apt/sources.list:

deb http://http.kali.org/kali sana main non-free contrib
deb http://http.kali.org/kali-security sana/updates main contrib non-free

Pinging the source IP and the URL works fine, as well as pinging random IPs (google.com, 8.8.8.8, etc), so it's probably not my network.

I tried some regular fixes, but none of them work. I don't have any idea what to do.

4 Answers 4

5

The solution is to change mirror in sources.list file. For some reason the default mirror is not working.

There are several mirrors of the Kali Linux repository server, all of which are spread over the world. Each time you interact with the repository, by default it will automatically use the mirror that is closest to you based on your geoip location (idea being, this will give you the best speed due to less latency).

However, you can manually force kali to use a certain/different mirror rather than the one that is nearest you.

Go to http://http.kali.org/README.mirrorlist where you will have a list of mirrors to chose from.

First backup your current source file

mv /etc/apt/sources.list /etc/apt/sources.list.backup

Then create a new sources.list file

vim /etc/apt/sources.list

and enter new mirror.

For example,

old sources.list file was

deb http://http.kali.org/kali kali-rolling main contrib non-free

The new sources.list file can be

deb http://archive-2.kali.org/kali kali-rolling main contrib non-free

Here you have to play around a little bit to find the mirror that works for you.

Then in terminal type:

sudo apt clean
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
0

Here is the official recommended source list from KALI: Kali sources.list Repositories

They warn that:

  • "The single most common causes of a broken Kali Linux installation are following unofficial advice, and particularly arbitrarily populating the system’s sources.list file with unofficial repositories."

They further state that:

  • "On a standard, clean install of Kali Linux, you should have the following two entries present in /etc/apt/sources.list:"

  • deb http://http.kali.org/kali sana main non-free contrib

  • deb http://security.kali.org/kali-security sana/updates main contrib non-free

Your list looks a little different. So might want to adjust that before trying other fixes. DO NOT add any additional info to the sources list that is not recommended by Kali.

Also can try these commands (leave out sudo if you are root):

  • sudo apt-get clean
  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get update --fix-broken
  • sudo apt-get dist-upgrade

  • Also try running KALI LIVE --see if getting apt-get update or network issues.

  • Try "Official Kali Linux Mirrors" as suggested by Kali in link provided above.
  • Sometimes networks go down -- so might have issues connecting in those situations as well.

As a last resort you can also do clean install if you feel your configuration might be broken. Make sure your network is operating 100%...

If get it working please update post - so others know what worked. Thanks.

Good luck!

8
  • Alright, I'll try that. I didn't catch that little error. Whoops.
    – Colin
    Nov 15, 2015 at 2:42
  • Unfortunately, the same error appears after the changed source. The only that varied is that the Failed To Fetch URL changed.
    – Colin
    Nov 15, 2015 at 2:48
  • apt-get outputs the same error, apt-get upgrade doesn't upgrade any packages, and apt-get update --fix-broken outputs the same error. :/
    – Colin
    Nov 15, 2015 at 2:58
  • I initially thought it was a network error. Since you have a lot of connect errors listed. Are you able to browse websites in Kali? Are you having other network issues other than the apt-get update?
    – NoobNet14
    Nov 15, 2015 at 3:05
  • That's a good question, Iceweasel is acting strange, but I can ping any IP fine, including the sources in sources.list. I can also use nmap, etc. on anything.
    – Colin
    Nov 15, 2015 at 3:10
0

Step 1: cat /etc/os-release Step 2: cat /etc/apt/sources.list Step 3: cat /etc/apt/sources.list Step 4: grep -v '#' /etc/apt/sources.list | sort -u Step 5: echo "deb http://http.kali.org/kali kali-rolling main contrib non-free" | sudo tee /etc/apt/sources.list Step 6: echo "deb http://http.kali.org/kali kali-last-snapshot main contrib non-free" | sudo tee /etc/apt/sources.list Step 7: sudo apt update

1
  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jun 16, 2022 at 15:06
-1

Issue can be fixed by switching from a Bridged configuration to NAT. Do not know why that fixes it, but it's the only solution I found.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .