Announcement

Collapse
No announcement yet.

Removing Old Kernel Files

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Removing Old Kernel Files

    I updated from 9.04 to 9.10. So far all is well, couple of quirky things, mostly related to the age of my IBM Thinkpad T20, but I'm chipping away at them.

    One of those quirks has to do with the number of old kernel files left on my machine from the update. Both dpkg and adept report that I have only three kernel packages, 2.6.31-14, 2.6.31-15, and 2.6.31-16. That seems right since those are the only three that 9.10 has had so far.

    Looking at the /lib/modules and /lib/firmware directories, there are folders only for the three 2.6.31 kernel versions. However, looking at the /boot directory, there are files that reference 6 more kernels ranging from 2.6.24-23 to 2.6.28-16. I believe that I have no use for those excess files.

    I think I can just delete the excess files in /boot (except for the most current 2.6.31 kernels) and then run update-grub to ensure those kernels are not referenced at boot time.

    Will this approach work, or will my system act like a dead bug on a windowsill the next time I boot?
    The next brick house on the left
    Intel i7 11th Gen | 16GB | 1TB | KDE Plasma 5.27.11​| Kubuntu 24.04 | 6.8.0-31-generic




    #2
    Re: Removing Old Kernel Files

    Remove unnecessary kernels (so they don't appear in the boot menu):
    HOWTO: Removing unnecessary entries from the grub menu list, Rog131
    http://kubuntuforums.net/forums/inde...opic=3082556.0

    and then run update-grub
    An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

    Comment


      #3
      Re: Removing Old Kernel Files

      O.K.

      So since the specific kernel files I want to remove are NOT a part of any package, just doing an rm on those files and then running update-grub will work just fine.

      Thank you.
      The next brick house on the left
      Intel i7 11th Gen | 16GB | 1TB | KDE Plasma 5.27.11​| Kubuntu 24.04 | 6.8.0-31-generic



      Comment


        #4
        Re: Removing Old Kernel Files

        And it did. Now only have the three current kernels referenced in grub.cfg.
        The next brick house on the left
        Intel i7 11th Gen | 16GB | 1TB | KDE Plasma 5.27.11​| Kubuntu 24.04 | 6.8.0-31-generic



        Comment


          #5
          Re: Removing Old Kernel Files

          AFIK, the only reason for keeping old kernels around is insurance. It allows you to go back so something that you know worked. They don't take up much space anyway. There are times, however, where different current ones might be relevant. For example the desktop, realtime, or server kernels. Of course, if you compile a new kernel then you'll really want to make sure you have an old one that works.

          Comment


            #6
            Re: Removing Old Kernel Files

            Originally posted by Ole Juul
            AFIK, the only reason for keeping old kernels around is insurance. It allows you to go back so something that you know worked. They don't take up much space anyway. There are times, however, where different current ones might be relevant. For example the desktop, realtime, or server kernels. Of course, if you compile a new kernel then you'll really want to make sure you have an old one that works.
            It is very annoying to have them cluttering up GRUB, there used to be a GRUB editor which allowed you to remove old entries very easily but since the move to GRUB2 there appears to be nothing to replace it. This is, to my mind, one of the more eccentric things about open source namely a new app such as GRUB2 is introduced without providing an updated GRUB2 editor. It will probably arrive around the same time as the move to GRUB3, hopefully Project Timelord will address some of these issues.

            http://people.ubuntu.com/~apachelogg...nouncement.pdf

            Comment


              #7
              Re: Removing Old Kernel Files

              What might be the cause of the old kernels accumulating on the system? It seems like my newer Kubuntu installs keep only the two most recent kernels, but on my oldest Kubuntu installs sometimes I end up with 3 or more kernels.

              Originally posted by jglen490
              So since the specific kernel files I want to remove are NOT a part of any package
              How do you know that no packages depend on those kernels? Is there a simple way to find out that I may be missing?
              Welcome newbies!
              Verify the ISO
              Kubuntu's documentation

              Comment


                #8
                Re: Removing Old Kernel Files

                Originally posted by Telengard
                What might be the cause of the old kernels accumulating on the system? It seems like my newer Kubuntu installs keep only the two most recent kernels, but on my oldest Kubuntu installs sometimes I end up with 3 or more kernels.
                Old kernels don't get automatically removed, although sudo apt-get autoremove should remove older versions of the same major kernel versions once the kernel image metapackage is updated to depend on the newer version, and the automatically installed older kernel image becomes redundant). It is also quite possible to have different major kernel versions on older systems, that are also not automatically removed. These are usually safe to uninstall manually, though some people like to keep an older kernel version installed just in case.

                Originally posted by Telengard
                How do you know that no packages depend on those kernels? Is there a simple way to find out that I may be missing?
                For installed packages you can use, for example, 'dpkg -S filename' to find out which package a file belongs to.

                If you also want to include uninstalled packages (in the repos), a tool like apt-file (available from repos, but not installed by default last I checked) is handy.

                Comment


                  #9
                  Re: Removing Old Kernel Files

                  Originally posted by kubicle
                  If you also want to include uninstalled packages (in the repos), a tool like apt-file (available from repos, but not installed by default last I checked) is handy.
                  Just installed. This is a nice utility. Thank you for pointing it out.
                  Windows no longer obstructs my view.
                  Using Kubuntu Linux since March 23, 2007.
                  "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                  Comment

                  Working...
                  X