How to remove old kernels

From Paldo

Jump to: navigation, search

Trick by Philip Miller

Contents

[edit] Backup menu.lst

First you have to backup the menu.lst. For that open a terminal and enter the following code:

   sudo cp /boot/grub/menu.lst /boot/grub/menu.backup

[edit] Removing old kernels

Then enter the following code into the terminal:

Attention: Replace KERNELVERSION by the version of your old kernel you want to remove. Keep the stars in the line!!!

32bit:

     ls /var/lib/upkg/packages/*KERNELVERSION-p*x86 | sed 's\/var/lib/upkg/packages/\sudo upkg-remove --force --verbose \g'

64bit:

     ls /var/lib/upkg/packages/*KERNELVERSION-p*x86_64 | sed 's\/var/lib/upkg/packages/\sudo upkg-remove --force --verbose \g'

Copy/Paste the outputted code if you want to remove the packages.

Example

     sudo upkg-remove --force --verbose gspcav1-2.6.24-paldo1-x86
     sudo upkg-remove --force --verbose linux-2.6-2.6.24-paldo1-x86
     sudo upkg-remove --force --verbose lirc-2.6.24-paldo1-x86
     sudo upkg-remove --force --verbose madwifi-2.6.24-paldo1-x86
     sudo upkg-remove --force --verbose ndiswrapper-2.6.24-paldo1-x86
     sudo upkg-remove --force --verbose nvidia-glx-2.6.24-paldo1-x86
     sudo upkg-remove --force --verbose nvidia-glx-71xx-2.6.24-paldo1-x86
     sudo upkg-remove --force --verbose nvidia-glx-96xx-2.6.24-paldo1-x86
     sudo upkg-remove --force --verbose uvcvideo-2.6.24-paldo1-x86
     sudo upkg-remove --force --verbose VirtualBox-2.6.24-paldo1-x86

[edit] Check menu.lst

If you remove the first kernel ever installed on your paldo-system the menu.lst gets blanked out. Open the saved backup with:

   sudo gedit /boot/grub/menu.backup

Remove no longer needed kernel lines and save it as menu.lst

[edit] Sample Grub entry

If you didn't saved your menu.lst file, here is a sample menu.lst entry:

   title paldo testing (linux 2.6.23.1-paldo2-x86_64)
   kernel /boot/linux-2.6.23.1-paldo2-x86_64 root=/dev/sda9 resume=/dev/sda2 vga=0x317
   initrd /boot/initramfs-2.6.23.1-paldo2-x86_64
   savedefault

[edit] Easier way to remove old kernels

Open a terminal and enter this code:

  sudo rm -v /var/lib/upkg/packages/*-3.1.*paldo*.select
  sudo upkg-upgrade

First all old kernel modules are marked for deinstallation except the one currently running. Via the upgrade all old kernel modules are deinstalled.

Personal tools