File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Removing kernel

Anayonkar Shivalkar

Joined: Dec 08, 2010
Posts: 1545


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.

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

Joined: Dec 08, 2010
Posts: 1545


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:

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

Joined: May 14, 2008
Posts: 5852

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
I agree. Here's the link:
subject: Removing kernel
It's not a secret anymore!