Announcement

Collapse
No announcement yet.

remove old linux versions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    remove old linux versions

    How to effectively remove the older versions of Linux kernels? Each time I upgrade distribution (apt-get dist-upgrade) it adds to grub configuration new version of headers. Even if I do apt-get autoremove it does not remove them. Is there a way to do it in the same way as I add a new one?

    #2
    Found this...

    Ubuntu Cleanup: How to Remove All Unused Linux Kernel Headers, Images and Modules

    Comment


      #3
      Alternately, you can install kde-config-grub2 which provides a System Settings module that can do this for you.
      Afterwards, you will need to navigate to the Startup and Shutdown settings in System Settings.


      If you go to the "GRUB2 Bootloader" section in the Startup section, you'll see a button that says "Remove Old Entries". After clicking this, it will find all kernel entries. You should then mark all but the one you're using, and it'll remove them for you. (Be careful, the list includes the kernel currently in use also)

      Comment


        #4
        Thanks but that did not succeed. After I installed kde-config-grub2 it keeps showing in the combo box several old versions of system and "Remove Old Entries" shows only the current one. Similarly grub detects them after each distribution upgrade.

        Comment


          #5
          Working at here: http://www.kubuntuforums.net/showthr...grub-menu-list
          Have you tried ?

          - How to Ask a Question on the Internet and Get It Answered
          - How To Ask Questions The Smart Way

          Comment


            #6
            well installing the kde-config-grub2 and using it @hear worked just fine I had kernels from 2.6.28-3.0.0.17 in /boot along with the configs and stuff .
            clicking remove old entry's gave me a list of all the kernels on the system ......I selected all but the 2 newest and then clicked ok ......it then asked if I wanted to remove the headers as well so I clicked ok and it did ...all thats left in /boot is the 2 I left and thare config's and stuff
            vinny@Vinnys-HP-G62:~$ ls /boot
            abi-3.0.0-16-generic config-3.0.0-17-generic initrd.img-3.0.0-17-generic System.map-3.0.0-16-generic vmcoreinfo-3.0.0-17-generic
            abi-3.0.0-17-generic grub memtest86+.bin System.map-3.0.0-17-generic vmlinuz-3.0.0-16-generic
            config-3.0.0-16-generic initrd.img-3.0.0-16-generic memtest86+_multiboot.bin vmcoreinfo-3.0.0-16-generic vmlinuz-3.0.0-17-generic
            NOW I have 2 other systems on this box as well and it dose nothing to those kernels or systems ........as it shouldent.

            all in all a nice config module I think

            VINNY
            i7 4core HT 8MB L3 2.9GHz
            16GB RAM
            Nvidia GTX 860M 4GB RAM 1152 cuda cores

            Comment


              #7
              Now, look at this:
              ls -l /boot/config*
              -rw-r--r-- 1 root root 122627 2011-02-23 01:53 /boot/config-2.6.35-27-generic
              -rw-r--r-- 1 root root 122616 2011-03-18 20:33 /boot/config-2.6.35-28-generic
              -rw-r--r-- 1 root root 135132 2012-03-09 02:17 /boot/config-3.0.0-17-generic
              sudo apt-get purge linux-image-2.6.35-27-generic
              Reading package lists... Done
              Building dependency tree
              Reading state information... Done
              E: Unable to locate package linux-image-2.6.35-27-generic
              E: Couldn't find any package by regex 'linux-image-2.6.35-27-generic'

              That's a real linux ghost
              Anyone to solve this mess? I'll be grateful.

              Comment


                #8
                ...
                E: Unable to locate package linux-image-2.6.35-27-generic
                E: Couldn't find any package by regex 'linux-image-2.6.35-27-generic'

                That's a real linux ghost
                Anyone to solve this mess? I'll be grateful.
                I think that - If the package doesn't exist then you could manually move/remove the:

                /boot/abi-2.6.35-27...
                /boot/config-2.6.35-27...
                /boot/initrd.img-2.6.35-27...
                /boot/vmcoreinfo-2.6.35-27...
                /boot/vmlinuz-2.6.35-27...

                and run the
                Code:
                sudo update-grub
                afterwards.
                Have you tried ?

                - How to Ask a Question on the Internet and Get It Answered
                - How To Ask Questions The Smart Way

                Comment


                  #9
                  That helped, thanks. Does this mean there is no binaries of old versions as well?

                  Comment


                    #10
                    A typical kernel image package will place:

                    * firmware modules in subdirectories beneath /lib/firmware/kernel-version
                    * driver modules in subdirectories beneath /lib/modules/kernel-version
                    * the kernel and support files in /boot

                    Manually deleting the files from /boot won't remove the associated firmware and driver modules. You might want to check in those subdirectories, too.

                    Comment


                      #11
                      As SteveRiley told the kernel packages are installing lot of stuff. You could look what were installed by the command (http://www.cyberciti.biz/howto/quest...heat-sheet.php ) :

                      Code:
                      dpkg -L {package}
                      It should show the linux-image-3.0.0-17-generic files. You could use the output as a template . It may not show the 2.6.35-27-generic/2.6.35-28-generic as it is telling: "E: Couldn't find any package by regex 'linux-image-2.6.35-27-generic'".


                      The easiest/safest way (what I can think) is to install a package back and then remove it. The linux-image-2.6.35-27-generic is from the Maverick. Packages can be found (and downloaded) from the Ubuntu packages: http://packages.ubuntu.com/search?ke...ll&section=all
                      Have you tried ?

                      - How to Ask a Question on the Internet and Get It Answered
                      - How To Ask Questions The Smart Way

                      Comment


                        #12
                        I generally just do this in synaptic.

                        Although the oneliner Steve linked to is kinda elegant it only leaves one kernel on the machine and being old school I prefer to keep the current and one known working kernel.

                        My own procedure:

                        Search for "linux" in synaptic.

                        Click on the "S" in the top left of the package window to sort by packages you have installed.

                        Scroll down to the "linux" entries.

                        There are three packages per kernel version to remove - we'll use kernel 3.0.0.16 as an example:

                        Hold down your Ctrl key and select

                        linux-headers-3.0.0-16
                        linux-headers-3.0.0-16-generic
                        linux-image-3.0.0-16-generic

                        Right-click while all three are selected and choose "Mark for complete removal" from the context menu.

                        Hit "Apply" and watch the old kernel(s) go away
                        we see things not as they are, but as we are.
                        -- anais nin

                        Comment


                          #13
                          This is how I do it (I'm 'old school' and prefer to use the CLI over any GUI application). Open a console and type:
                          Code:
                          dpkg --list | grep linux-image | awk '{print $2}'
                          As of today, on my laptop, this outputs:
                          linux-image-3.2.0-20-generic
                          linux-image-3.2.0-21-generic
                          linux-image-3.2.0-22-generic
                          linux-image-generic
                          I have three kernels 'installed' on my laptop. I want to completely remove the oldest one -- linux-image-3.2.0-20-generic -- so I then type:
                          Code:
                          sudo apt-get purge linux-image-3.2.0-20-generic
                          Which shows:
                          Reading package lists... DoneBuilding dependency tree
                          Reading state information... Done
                          Note, selecting 'linux-image-3.2.0-20-generic' for regex '3.2.0-20-generic'
                          Note, selecting 'linux-headers-3.2.0-20-generic' for regex '3.2.0-20-generic'
                          Package linux-image is not installed, so not removed
                          The following packages will be REMOVED:
                          linux-headers-3.2.0-20-generic* linux-image-3.2.0-20-generic*
                          0 upgraded, 0 newly installed, 2 to remove and 1 not upgraded.
                          After this operation, 160 MB disk space will be freed.
                          Do you want to continue [Y/n]?
                          Accepting the default answer (Y) results in:
                          (Reading database ... 201829 files and directories currently installed.)Removing linux-headers-3.2.0-20-generic ...
                          Removing linux-image-3.2.0-20-generic ...
                          Examining /etc/kernel/prerm.d.
                          run-parts: executing /etc/kernel/prerm.d/dkms 3.2.0-20-generic /boot/vmlinuz-3.2.0-20-generic
                          dkms: removing: bcmwl 5.100.82.38+bdcom (3.2.0-20-generic) (x86_64)


                          -------- Uninstall Beginning --------
                          Module: bcmwl
                          Version: 5.100.82.38+bdcom
                          Kernel: 3.2.0-20-generic (x86_64)
                          -------------------------------------


                          Status: Before uninstall, this module version was ACTIVE on this kernel.


                          wl.ko:
                          - Uninstallation
                          - Deleting from: /lib/modules/3.2.0-20-generic/updates/dkms/
                          - Original module
                          - No original module was found for this module on this kernel.
                          - Use the dkms install command to reinstall any previous module version.


                          depmod....


                          DKMS: uninstall completed.
                          Examining /etc/kernel/postrm.d .
                          run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-20-generic /boot/vmlinuz-3.2.0-20-generic
                          update-initramfs: Deleting /boot/initrd.img-3.2.0-20-generic
                          run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-20-generic /boot/vmlinuz-3.2.0-20-generic
                          Generating grub.cfg ...
                          Found background image: /boot/grub/images/Sharks-1600x900.png
                          Found linux image: /boot/vmlinuz-3.2.0-22-generic
                          Found initrd image: /boot/initrd.img-3.2.0-22-generic
                          Found linux image: /boot/vmlinuz-3.2.0-21-generic
                          Found initrd image: /boot/initrd.img-3.2.0-21-generic
                          done
                          Purging configuration files for linux-image-3.2.0-20-generic ...
                          Examining /etc/kernel/postrm.d .
                          run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.2.0-20-generic /boot/vmlinuz-3.2.0-20-generic
                          run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.2.0-20-generic /boot/vmlinuz-3.2.0-20-generic
                          Then I update Grub with:
                          Code:
                          sudo update-grub2
                          Which results in:
                          Generating grub.cfg ...Found background image: /boot/grub/images/Sharks-1600x900.png
                          Found linux image: /boot/vmlinuz-3.2.0-22-generic
                          Found initrd image: /boot/initrd.img-3.2.0-22-generic
                          Found linux image: /boot/vmlinuz-3.2.0-21-generic
                          Found initrd image: /boot/initrd.img-3.2.0-21-generic
                          done
                          The oldest kernel has been completely removed from my system and the Grub files (grub2 here) completely updated.

                          I have the three steps above in my .bash_aliases file. Simple. Clean. A clean system is a happy system.
                          "It is a capital mistake to theorize before one has data." - Sherlock Holmes
                          Using Kubuntu Linux since March 23, 2007

                          Comment

                          Working...
                          X