aspose file tools*
The moose likes Linux / UNIX and the fly likes Removing kernel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Removing kernel" Watch "Removing kernel" New topic
Author

Removing kernel

Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1510
    
    5

Hi,

I'm currently using Linux Mint 12 (64 bit) and having several kernels installed. They also show up in grub menu and I'm able to successfully boot into each of them.

Now, I want to remove a kernel. Is there any procedure for it?

As far as I know, initrd image, system map and vmlinuz image for that specific kernel and fire update-grub. Is that enough? Or any better options?

Thanks in advance.


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1510
    
    5

Hi,

I got how to do it.

For system installed kernels (installed via apt-get):
1) Make a list of installed kernels:
$ dpkg --get-selections | grep linux-image
2) Remove the kernel:
$ sudo apt-get purge <kernel_to_remove>

For manually installed kernels:
Remove:
/boot/vmlinuz*KERNEL-VERSION*
/boot/initrd*KERNEL-VERSION*
/boot/System-map*KERNEL-VERSION*
/boot/config-*KERNEL-VERSION*
/lib/modules/*KERNEL-VERSION*/

Since I'm not using rpm based distro, I haven't searched about it yet.

The most important thing:
1) After all cleaning up the kernels, you must update the boot-loader before rebooting the system.
i.e. $ sudo update-grub
in case of grub boot-loader. Not sure how to update LILO.
2) Do not do these operations on current kernel you've booted into. If you want to remove a specific kernel, boot into any other kernel than that.

Hope this helps.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5843
    
    7

If all that you wanted to do was to reduce the size of your boot menu, then removing the /boot/vmlinuz*KERNEL-VERSION* file(s) would be sufficient. I usually monitor my Linux updates and when it wants to install a new kernel, I rename the prior kernel (I usually have 2 kernels in by boot menu, the current one I am running and the prior kernel) /boot/vmlinuzXXX file so that when the grub update runs only the current and new kernel get added to the boot menu. By renaming, all of the old kernels are still there and available, and then don't take up that much space, and besides disk is still relatively cheap.


JBoss In Action
 
wood burning stoves
 
subject: Removing kernel