apt-get - Some index files failed to download, they have been ignored, or old ones used instead

28,887

Solution 1

echo linux-image-amd64 hold | dpkg --set-selections

Solution 2

In this, kernel_package is alias for real linux kernel package in your system/repo (linux-image-amd64 or linux-image-4.6.0-kali1-amd64 or other). To find your kernel:

uname -r

Put a kernel_package on hold:

echo "kernel_package hold" | dpkg --set-selections

Remove the hold:

echo "kernel_package install" | dpkg --set-selections

Display the status of your packages:

dpkg --get-selections

Display the status of a kernel_package:

dpkg --get-selections | grep "kernel_package"

So if you do:

apt-get update && apt-get upgrade

or

apt-get update && apt-get dist-upgrade

your kernel_package not be updated (with depends).

Solution 3

Another way. sudo apt-mark hold $(uname -r) This marks depending packages also to hold.

Share:
28,887

Related videos on Youtube

gedamial
Author by

gedamial

Updated on September 18, 2022

Comments

  • gedamial
    gedamial almost 2 years

    I have Kali Linux (kernel version 4.3) and prefer not to upgrade to 4.6 (if I should, well, ok)


    When I do apt-get update I get

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

    This is my sources.list (taken from the official kali linux website)

        # deb cdrom:[Debian GNU/Linux 2016.1 _Kali-rolling_ - Official Snapshot amd64 L$
    
    #deb cdrom:[Debian GNU/Linux 2016.1 _Kali-rolling_ - Official Snapshot amd64 LI$
    
    deb http://http.kali.org/kali kali main non-free contrib
    deb http://security.kali.org/kali-security kali/updates main contrib non-free
    
    deb-src http://http.kali.org/kali kali main non-free contrib
    deb-src http://security.kali.org/kali-security kali/updates main contrib non-fr$
    

    Now... searching around the internet I've read I'm forced to do a dist-upgrade and upgrade the kernel.

    I don't want to upgrade the kernel though! But if I really should...then I will

    If I try to install something, like TOR apt-get install tor , this is what I get

    E: Package 'tor' has no installation candidate
    

    What do I do?

    • jordanm
      jordanm over 7 years
      You got answers about how to upgrade your system while not upgrading the kernel. This doesn't appear to actually be the problem you are trying to solve. Your title and question seem completely unrelated to the problem you are having.
    • user2914606
      user2914606 over 7 years
      @gedamial because the problem you're trying to solve is that when you apt-get update, you get Some index files failed to download. that's the root cause, but you're muddying your question because you've already decided what the solution is (do a dist-upgrade) and you're asking how to do that instead of how to fix the root issue.
    • gedamial
      gedamial over 7 years
      @strugee in the question itself I've said "I've read I should do a dist-upgrade and upgrade the kernel." So the root problem is how to apt-get update and install all the software I want (like tor) without upgrading the kernel version
  • gedamial
    gedamial over 7 years
    Sorry, what was that supposed to do? I ran it, nothing happened
  • gedamial
    gedamial over 7 years
    Hi. When I echo dpkg --get-selections there is no "kernel_package" listed. Instead, there is linux-image-amd64 (as Ipor Sircer wrote below)
  • gruntboy
    gruntboy over 7 years
    yep, because "kernel_package" is alias for your real linux kernel package, so instead of kernel_package enter the name of your kernel (which already had written) => linux-image-amd64 for example.
  • gedamial
    gedamial over 7 years
    So after I hold the linux-image-amd64 package... i can do apt-get update && apt-get dist-upgrade with the WARRANTY that my kernel won't be upgraded? 1) Is this recommended? 2) Will I run through problems (maybe a software is installed, and that software actually LOOKS FOR the new kernel) ??? Thanks!
  • user2914606
    user2914606 over 7 years
    @gedamial are you sure nothing happened? remember, no news is good news.
  • gruntboy
    gruntboy over 7 years
    Stop the package ensures that you will not be updated. However, please be aware that stops are also relationships that may have an impact on other packages.
  • gedamial
    gedamial over 7 years
    should I just update my kernel?