Linux.com

Home Linux Community Forums Linux Distributions Fedora How to remove kernel source ?

How to remove kernel source ?

Link to this post 20 May 11

hai,
In fedora, tried to recompile the kernel, but failed. After that During boot menu, the Fedora bootloader is showing the improper kernel too. If i choose, its taking me to login screen, but after that nothing, it just stopped.
I want to remove this, not from bootloader alone, the entire kernel that I compiled wrongly .

thank you

Link to this post 20 May 11

linustorvalds wrote:

hai,
In fedora, tried to recompile the kernel, but failed. After that During boot menu, the Fedora bootloader is showing the improper kernel too. If i choose, its taking me to login screen, but after that nothing, it just stopped.
I want to remove this, not from bootloader alone, the entire kernel that I compiled wrongly .

thank you

That depends on how you installed it.

Usually there's a file in the /boot directory which is the kernel.

Anyway, you do not need to uninstall it, just make sure there's a grub entry pointing to the right kernel (usually the one that comes with the distro is in /boot/vmlinuz)

Regards

Link to this post 20 May 11

If you're absolutely sure that you know your BAD KERNEL VERSION (e.g., 2.6.36), then you can do this to remove it:


rm -rf /lib/modules/{BAD_KERNEL_VER}/
rm -f /boot/vmlinuz-{BAD_KERNEL_VER}*
rm -f /boot/initrd-{BAD_KERNEL_VER}*
rm -f /boot/config-{BAD_KERNEL_VER}*
rm -f /boot/System.map-{BAD_KERNEL_VER}*

The first command removes the bad kernel's installed modules. The rest of the commands remove the bad kernel image and any initial ramdisk images, system maps, and kernel config files.

You can always reinstall a Fedora-packaged kernel, too. First remove the entry from the RPM database:

rpm -e --justdb kernel (or kernel-PAE) 

Then reinstall it w/yum, e,g:

yum install kernel (or kernel-PAE)

If you have multiple kernel packages installed, then you can do the above rpm/yum commands, but you have to pass the package version info with it, e.g.: kernel-2.6.36-1.fc10

List all installed kernels with:

rpm -qa kernel (or kernel-PAE)

Of course, don't do any of this unless you're feeling bold!

Link to this post 21 May 11

atreyu wrote:

If you're absolutely [b]sure[/b] that you know your BAD KERNEL VERSION (e.g., 2.6.36), then you can do this to remove it:
[code]
rm -rf /lib/modules/{BAD_KERNEL_VER}/
rm -f /boot/vmlinuz-{BAD_KERNEL_VER}*
rm -f /boot/initrd-{BAD_KERNEL_VER}*
rm -f /boot/config-{BAD_KERNEL_VER}*
rm -f /boot/System.map-{BAD_KERNEL_VER}*
[/code]
The first command removes the bad kernel's installed modules. The rest of the commands remove the bad kernel image and any initial ramdisk images, system maps, and kernel config files.

You can always reinstall a Fedora-packaged kernel, too. First remove the entry from the RPM database:

[code]rpm -e --justdb kernel (or kernel-PAE) [/code]

Then reinstall it w/yum, e,g:
[code]yum install kernel (or kernel-PAE)[/code]

If you have multiple kernel packages installed, then you can do the above rpm/yum commands, but you have to pass the package version info with it, e.g.: kernel-2.6.36-1.fc10

List all installed kernels with:
[code]rpm -qa kernel (or kernel-PAE)[/code]
Of course, don't do any of this unless you're feeling bold!

thank you... I will give a try in coming weekend...

Link to this post 01 Jun 11

You also need to edit /boot/grub/grub.conf and remove the entry for the bad kernel.

I think what you have gone through is not uncommon for the first-time kernel builder. That happened to me also. Just remember to build/install the kernel like this:

1. make menuconfig, or make xconfig
2. make -jN, where N is the number of build threads to use - 1 per core or processor is good.
3. As root, make headers_install, make modules_install, make install - you can do all that (as root) with one command:

make headers_install modules_install install

If you just try make install, it won't do all the dependencies properly sometimes, so installing the headers and modules first makes sure all the drivers are in /lib/modules/KERNEL_VERSION before it actually tries to install the kernel into /boot.

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board