How to check / restore Kali Linux Rolling Repository

It is highly recommended to keep Kali Linux Repository in original state. You and your Kali can avoid a lot of problems if you will not populate the system’s sources.list file with unofficial repositories.

Indeed, Kali needs only one line in the /etc/apt/sources.list file:

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

You can open the file manually

sudo gedit /etc/apt/sources.list

Likely you'll see the default strings:

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

Also you can use the complex command to test Kali repository:

if cat /etc/apt/sources.list | grep -E "deb https://http.kali.org/kali kali-rolling main contrib non-free" || cat /etc/apt/sources.list | grep -E "deb https://http.kali.org/kali kali-rolling main non-free contrib"; then echo -e "\n\n\033[0;32mRepository is ok"; else echo -e "\n\n\033[0;31mRepository is not alright"; fi

If Kali Linux Repository have no necessary string, you’ll see message ‘Repository is not alright’.

If you have problems, then start by creating a backup:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bac

The following command will restore Kali Linux repository to original state (note that ALL third-party repositories will be removed and only the official source of the packages will be written):

echo 'deb https://http.kali.org/kali kali-rolling main contrib non-free' | sudo tee /etc/apt/sources.list

Once you change the system’s sources.list file you should update information about available packages in the repositories:

sudo apt update

Continue reading:

Recommended for you:

10 Comments to How to check / restore Kali Linux Rolling Repository

  1. Anonymous says:

    thanks for help

  2. Catamaranman says:

    1000x Thanks!

  3. Deucalion says:

    This solution works for me.Thank!!

  4. pvsvpw says:

    thanks. it working, i have searched a lot in internet but only found this one helpful

  5. Anonymous says:

    wasted 11 hours for searching this

    Thanks a lot

  6. B phani kumar says:

    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.

     

  7. mikey says:

    when i try and do 
    └─$ echo -e "deb https://http.kali.org/kali kali-rolling main contrib non-free" > /etc/apt/sources.list  

    it it tells me permision denied

     

  8. pankaj sharma says:

    thank you soo much dear .
    it works .

Leave a Reply

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