View Full Version : Apt update and upgrade commands not working

2022-03-05, 10:59
I have installed a fresh copy of Kali linux on my Acer Laptop (Intel i5, 8 GB RAM, 1 TB HDD) today and tried to update the repositories. But It always ended up with the following error.

Hit:1 http://download.virtualbox.org/virtualbox/debian buster InRelease
Get:2 http://ftp.harukasan.org/kali kali-rolling InRelease [30.6 kB]
Get:3 http://ftp.harukasan.org/kali kali-last-snapshot InRelease [30.6 kB]
Get:4 http://ftp.harukasan.org/kali kali-rolling/main amd64 Packages [18.0 MB]
Get:5 http://ftp.harukasan.org/kali kali-rolling/main amd64 Contents (deb) [40.9 MB]
Ign:5 http://ftp.harukasan.org/kali kali-rolling/main amd64 Contents (deb)
Get:6 http://ftp.harukasan.org/kali kali-rolling/contrib amd64 Packages [108 kB]
Get:7 http://ftp.harukasan.org/kali kali-rolling/non-free amd64 Packages [182 kB]
Err:5 http://http.kali.org/kali kali-rolling/main amd64 Contents (deb)
File has unexpected size (40914837 != 40904768). Mirror sync in progress? [IP: 80]
Get:8 http://ftp.harukasan.org/kali kali-rolling/non-free amd64 Contents (deb) [949 kB]
Ign:8 http://ftp.harukasan.org/kali kali-rolling/non-free amd64 Contents (deb)
Err:5 http://http.kali.org/kali kali-rolling/main amd64 Contents (deb)
File has unexpected size (40914837 != 40904768). Mirror sync in progress? [IP: 80]
Get:9 http://ftp.harukasan.org/kali kali-last-snapshot/main amd64 Packages [17.9 MB]
Ign:8 http://http.kali.org/kali kali-rolling/non-free amd64 Contents (deb)
Get:10 http://ftp.harukasan.org/kali kali-last-snapshot/main amd64 Contents (deb) [40.7 MB]
Get:11 http://ftp.harukasan.org/kali kali-last-snapshot/contrib amd64 Packages [114 kB]
Get:12 http://ftp.harukasan.org/kali kali-last-snapshot/contrib amd64 Contents (deb) [153 kB]
Get:13 http://ftp.harukasan.org/kali kali-last-snapshot/non-free amd64 Packages [214 kB]
Get:14 http://ftp.harukasan.org/kali kali-last-snapshot/non-free amd64 Contents (deb) [1,006 kB]
Get:15 http://ftp.harukasan.org/kali kali-rolling/contrib amd64 Contents (deb) [129 kB]
Ign:15 http://ftp.harukasan.org/kali kali-rolling/contrib amd64 Contents (deb)
Fetched 78.5 MB in 1min 20s (987 kB/s)
Reading package lists... Done
E: Failed to fetch http://http.kali.org/kali/dists/kali-rolling/main/Contents-amd64 File has unexpected size (40914837 != 40904768). Mirror sync in progress? [IP: 80]
E: Failed to fetch http://http.kali.org/kali/dists/kali-rolling/non-free/Contents-amd64 File has unexpected size (976810 != 949265). Mirror sync in progress? [IP: 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.

My Kali linux version is Linux kali 5.15.0-kali3-amd64 #1 SMP Debian 5.15.15-2kali1 (2022-01-31) x86_64 GNU/Linux

Sources.list file
# See https://www.kali.org/docs/general-use/kali-linux-sources-list-repositories/
deb http://http.kali.org/kali/ kali-rolling main contrib non-free
# Additional line for source packages
# deb-src http://http.kali.org/kali/ kali-rolling main contrib non-free
deb http://http.kali.org/kali kali-last-snapshot main contrib non-free

Because of this, I cannot install a new package in my system. Checked with different network connections and changed http to https in sources.list also but doesnt resolve the issue. Is this a problem with Kali's repositories or my system?
Thanks in advance!

2022-03-13, 14:05
check your internet connection if strong and not CDC and of course need stable connection to download all package and contents

2022-03-23, 10:45
Hi, I have the same problem (and the same laptop :)). yesterday i tried many solutions but they don't work.

I hope in a good person, I made a post today.


Hi, I have been trying solutions for three days without getting results, in the end I opted to uninstall the 2020 version (even if always updated with dist-upgrade) and replace it with the latest version always available from kali.
For some time I have noticed that many are present, but few help those who begin, there is an impression of detachment, of separation from those who have learned to those who are learning and I do not think this is good.
This is just my thought that I wanted to express, considering the multitude of unanswered requests in the forum.

2022-03-28, 06:33
Hi,you can refer to this https://www.kali.org/docs/general-use/kali-linux-sources-list-repositories/
Enabling the kali-last-snapshot branch is done with the command:

kali@kali:~$ echo "deb http://http.kali.org/kali kali-last-snapshot main contrib non-free" | sudo tee /etc/apt/sources.list

Note that such a change is effective only after running sudo apt update.

This part solve my problem. You can try it.