LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Remove custom kernel (https://www.linuxquestions.org/questions/linux-hardware-18/remove-custom-kernel-531110/)

Aerolinux 02-21-2007 02:41 PM

Remove custom kernel
 
Hi could anyone tell me the procedure for remvoing a custom kernel ?? I built one and now I want to remove it since my driver appears to work in the deafult. Please give me the steps/commands.

Thank you.

Quakeboy02 02-21-2007 02:43 PM

IMO, the easiest way for the newbie is to boot into the kernel you want to use and then use the synaptic package manager to remove the one you don't want.

b0uncer 02-21-2007 02:49 PM

If the new kernel was built from source code (and not installed from a .deb file or Synaptic), then it can't be removed using Yum. Instead one should just be able to boot the kernel you want to use, then just remove the old kernel files from /boot/. One can also remove the _old_ kernel source from /usr/src/ if it's not needed, but if the modules were compiled against this custom kernel, make sure they work with your other kernel before removing the custom one. I'm pretty sure kernel.org has some information about all this (should be in the README file that comes along the kernel source code, too), and if you haven't yet, it's a good idea to do a quick search from the web.

Quakeboy02 02-21-2007 02:56 PM

I guess I'm just too coddled by Debian. :) Won't he have to modify his grub or lilo lists if he removes files by hand?

Brian1 02-21-2007 04:13 PM

For manually remove of customed compiled kernels.

Whether using grub or lilo you need to remove the section of that kernel from it. Grub you need to edit /boot/grub/grub.conf or 1st.menu and save the file. Lilo I forget how to do that. I know after edit you need to run the command lilo.
Remove the kernel image, system.map, and initrd that matches the kernel version to remove in /boot.
Remove the kernel source from /usr/src.
And last remove the /lib/modules/<kernel-version-of-modules>

Brian

haxpor 10-22-2021 03:41 PM

I knew this is so many years.
Just to expand on Brian1's reply which helps me as well.

I'm on Ubuntu 20.04, and for custom manual built kernel. The following is the files I need to remove

* /boot/config-<kernel-version>
* /boot/initrd.img-<kernel-version>
* /boot/System.map-<kernel-version>
* /boot/vmlinuz-<kernel-version>

After that, execute sudo update-grub. The grub entries will be updated automatically as its scripts inside /etc/grub.d will automatically detect files inside /boot then update accordingly. Note that /boot/grub/grub.cfg is not meant to be directly edit as noted inside the file as "DO NOT EDIT THIS FILE".

It might be in 2007 things might be different from now. But yeah, I just add this updated info for later new users reading this.

mrmazda 10-24-2021 10:22 AM

Quote:

Originally Posted by Brian1 (Post 2640405)
Whether using grub or lilo you need to remove the section of that kernel from it. Grub you need to edit /boot/grub/grub.conf or 1st.menu and save the file.

/boot/grub/grub.conf may possibly exist in no current distros. In many it never did. Others used /boot/grub/menu.lst for the original Grub. Most distros now use Grub2, so the relevant file is /boot/grub/grub.cfg or /boot/grub2/grub.cfg/, which is warned not to disturb, because there's an automatic system to regenerate it whenever a kernel is added or removed by the distro's package management system.

mrmazda 10-24-2021 10:26 AM

Quote:

Originally Posted by haxpor (Post 6294779)
After that, execute sudo update-grub.

That's relevant only in some distros. Update-grub is not part of upstream Grub2 source. The official menu file regenerator is grub-mkconfig, which in some distros is grub2-mkconfig.


All times are GMT -5. The time now is 01:00 AM.