use apt-get update E: Failed to fetch http://...... File has unexpected size

Viewed 43252
E: Failed to fetch http://mirrors.kali.com/kali/dists/kali-rolling/main/binary-i386/Packages.gz  File has unexpected size (15320738 != 15317336). Mirror sync in progress? [IP: 111.11.111.111 80]
   Hashes of expected file:
    - Filesize:15317336 [weak]
    - SHA256:c4762e83455984f8d3fb54f6f42836808b8c891ba117661b61240bc5774d2e02
    - SHA1:fdebd56e7541e6f88d7910988ef694d3c409e21d [weak]
    - MD5Sum:51400b889af8677132f31d56f266bf22 [weak]
   Release file created at: Fri, 06 Oct 2017 06:55:45 +0000
E: Some index files failed to download. They have been ignored, or old ones used instead.

this is the error page.How to deal with this problem?

4 Answers

I had the same problem. Here is my solution and it works on Kali inside VirtualBox.

Please update your /etc/apt/sources.list with

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

Example

root@kali:~# cat /etc/apt/sources.list
deb https://http.kali.org/kali kali-rolling main non-free contrib
# deb-src https://http.kali.org/kali kali-rolling main non-free contrib
root@kali:~#

Let's update it ...

root@kali:~# apt update
Hit:1 https://archive-3.kali.org/kali kali-rolling InRelease
Reading package lists... Done
root@kali:~#

Hope this helps.

I've resolved it. It seems that you added more than one source entries in /etc/apt/sources.list. I guess more than one entry will make apt command confused, likely get header from one source then get packages from another, and the package size may not equal to the one defined in header. Edit the file and left only one source entry worked for me. Hope this helpful

Check if the firewall is blocking it. For me it was the firewall detecting the packets as malicious.

First open the file /etc/apt/sources.list, then delete all lines and add those lines

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

save and execute again

sudo apt-get update
Related