Announcement

Collapse
No announcement yet.

Cannot safely remove old kernels, and disk is now full

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

    Cannot safely remove old kernels, and disk is now full

    I got notice from kpackage of a bunch of new updates. I selected them to install, but somewhere along the way it failed, and then the dependencies were failing. I eventually found that it did not install the new kernel because the disk was full of a bunch of old kernels. I searched around for a way to clean them out, but using apt-get or kpackage failed because of the dependency problems. Apparently, once there is a dependency problems, it doesn't want to do anything. So, I tried synaptic and found the old kernels. However, if i pick an old one to remove, it also wants to remove linux-kernel-generic and linux-generic to remove as well. If I then try to unmark these, it wants to unmark my old kernel as well. From what I have read, removing "linux-kernel-generic" is dangerous, so I did not want to try that.

    Does anybody know how to remove old kernels without removing the necessary "linux-kernel-generic" package as well?

    #2
    Re: Cannot safely remove old kernels, and disk is now full

    Try: sudo dpkg --remove --force-remove-<packagename>
    Then try again.

    Use the version number for specific applications with identical names.

    Useful information is here.
    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
    – John F. Kennedy, February 26, 1962.

    Comment


      #3
      Re: Cannot safely remove old kernels, and disk is now full

      Also clean your cache:

      Code:
      sudo apt-get clean
      The kernels are actually quite small, the cache, however, contains all downloaded packages so cleaning your cache should have a significant impact on disc space on an older install.

      For further info: https://help.ubuntu.com/community/Ap...nce%20commands
      Once your problem is solved please mark the topic of the first post as SOLVED so others know and can benefit from your experience! / FAQ

      Comment


        #4
        Re: Cannot safely remove old kernels, and disk is now full

        Originally posted by toad
        The kernels are actually quite small
        That's a relative thing. A kernel image package takes over 100 MB (and if you've also got the headers installed, it's about 200 MB/kernel version), so they'll start eating into the GBs eventually.

        Cleaning the cache is a good way to free up space, but if space is an issue (on smaller harddrives), removing obsolete kernel images is a necessity at some point.

        Originally posted by jds
        From what I have read, removing "linux-kernel-generic" is dangerous, so I did not want to try that.
        If you mean "linux-generic", "linux-image-generic" or "linux-headers-generic" packages (there shouldn't be a "linux-kernel-generic" package), then those are just metapackages that can be removed. Their job is making upgrades to a newer kernel version "automatic". That is, when new kernel image/headers are packaged, the metapackages are updated to depend on that new version (which means the images/headers are offered as upgrades automatically).

        In short, the metapackages are safe to remove, although you should install them back once you're done cleaning up your old kernels.

        Comment


          #5
          Re: Cannot safely remove old kernels, and disk is now full

          HOWTO: Removing unnecessary entries from the grub menu list
          a.k.a removing old kernel packages and rewriting new menu.lst
          Rog131
          http://kubuntuforums.net/forums/inde...opic=3082556.0
          An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

          Comment


            #6
            Re: Cannot safely remove old kernels, and disk is now full

            Removing the old images and headers isn't going to free up much - maybe 100-200 MB.

            After you get this accomplished, I'd look into expanding your available space.

            Please Read Me

            Comment


              #7
              Re: Cannot safely remove old kernels, and disk is now full

              Originally posted by GreyGeek
              Try: sudo dpkg --remove --force-remove-<packagename>
              Then try again.

              Use the version number for specific applications with identical names.

              Useful information is here.
              The command that you suggested did not work, but the link was helpful. I tried:

              sudo dpkg --remove --force-all linux-image-2.6.28-11-generic

              which seemed to work. I went back and uninstalled a half dozen old kernels. Apparently, I went too far however, and started getting backports from alsa and other packages complaining that dependencies were now broken.

              sudo apt-get -f install

              seemed to fix everything, though.

              BTW, sudo apt-get clean didn't do anything. kubicle was correct about the package names.

              There are no more complaints about dependencies and broken packages, so thanks for the help. I'll report back if I've screwed anything up.

              Comment


                #8
                Re: Cannot safely remove old kernels, and disk is now full

                Originally posted by jds
                BTW, sudo apt-get clean didn't do anything.
                From apt-get's man page:
                clean
                clean clears out the local repository of retrieved package files. It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. When APT is used as a dselect (8) method, clean is run automatically. Those who do not use dselect will likely want to run apt-get clean from time to time to free up disk space.
                This means you use dselect
                Once your problem is solved please mark the topic of the first post as SOLVED so others know and can benefit from your experience! / FAQ

                Comment


                  #9
                  Re: Cannot safely remove old kernels, and disk is now full

                  use apt-get autoclean if clean did not work.
                  Dave Kubuntu 20.04 Registered Linux User #462608

                  Wireless Script: http://ubuntuforums.org/showthread.p...5#post12350385

                  Comment


                    #10
                    Re: Cannot safely remove old kernels, and disk is now full

                    Originally posted by kc1di
                    use apt-get autoclean if clean did not work.
                    Using autoclean should not make a difference (although there is no harm in trying).
                    clean clears all cached packages, autoclean only clears obsolete packages.

                    Originally posted by jds
                    BTW, sudo apt-get clean didn't do anything.
                    Are you sure? (did you check /var/cache/apt/archives/). Clean command does not output anything even if it removes the cached packages. Of course it's possible to configure apt to not cache packages at all, in which case clean does nothing (as their is no package cache to clean).

                    Comment

                    Working...
                    X