# How to remove a kernel

## PseudoKrazy

Being that there is no "Uninstalling Gentoo" board, I decided to post this here. What files should I remove/unmerge if I am getting rid of a previously used kernel. I have 3 kernels, and need to get rid of the last one.

----------

## tomk

The usual emerge unmerge should do the trick, the files will be deleted from /usr/src/<kernel_version>. Make sure that /usr/src/linux doesn't point to the version you're deleting and check your lilo/grub config ao it doesn't have the deleted kernel.

```
emerge unmerge kernel_name_and_version
```

----------

## FreeFly42

Also remove the kernel files in /boot, and the corresponding /lib/modules directory (/lib/modules/<kernel name>/)

----------

## ed0n

I always do rm -Rf /usr/src/linux-x-x

----------

## ConnorWorm

My question is slightly different, but still the same in a way: I did a emerge -uDN world, ended up getting 2.6.14-gentoo-r4 from this. It doesn't show up in my Grub splash screen. I wondered why. Any answers will be greatly appreciated.

----------

## jmbsvicetto

Hi.

This is another source of confusion for newcomers. Just because you install a package it doesn't start to work by itself. As X won't start working just because you install x.org, so a new kernel won't be available at the boot screen just because you installed a new kernel source.

After emerging a new kernel, you may need to update the /src/src/linux symlink. After that, you need to configure the kernel, compile it and install it. You can use some help by using genkernel and grub-install or you can do it by hand. Finally, you should check that your /boot/grub/grub.conf has an entry for your new kernel.

----------

## ConnorWorm

well i can surely tell you that /boot/grub/grub.conf doesn't have it. One question: I was having previous problems with ACPI, how can I make it so the kernel doesn't attempt to use ACPI in the future boots?

----------

## jmbsvicetto

 *ConnorWorm wrote:*   

> well i can surely tell you that /boot/grub/grub.conf doesn't have it. One question: I was having previous problems with ACPI, how can I make it so the kernel doesn't attempt to use ACPI in the future boots?
> 
> got a few questions then:
> 
> 1) will this effect me with my current kernel, since i'm in X?
> ...

 

You can configure your kernel and disable ACPI support. The quick and easy method is to append in the kernel line of grub.conf the kernel parameter acpi=off.

1- By emerging a new kernel you're not removing neither the source nor the compiled file for previous kernel versions. You just get the ability to create a new kernel based on a newer version of the kernel sources. So it doesn't affect your running kernel.

2. There's no problem in updating a kernel version - actually you should be doing that from time to time. New versions are released either to address bugs of previous versions or to include newer features.

3. When you create your new kernel based on the more recent kernel tree, you have to make sure that you select the drivers for your devices. You can do it by hand, or by using the previous kernel .config file. There are a few cases where kernel options change, that by using this last method you won't get the new default values.

As to your last question, I have limited experience with wireless. I own and have configured both a Intersil Prism and an Atheros wireless cards in Gentoo, but have rarely used them. The best way to get help from me or any other member of the forum, is for you to explain your problem and provide sufficient information.

----------

## ConnorWorm

Then I will go with the acpi=off option. I had used genkernel to create r2, even though i've gotten picked on for using it. (It don't bother me, I'm afraid to make my own kernel, and genkernel is "easier"). How would I copy the .config file like you said before? How would i get my ALSA drivers to work?

Oh, I found the previous thread I had created about my wireless problem. https://forums.gentoo.org/viewtopic-t-409715-highlight-.html

----------

## pjp

 *PseudoKrazy wrote:*   

> Being that there is no "Uninstalling Gentoo" board

 No, but there is a Kernel forum.

Moved from Installing Gentoo.

----------

## dsd

there is also a kernel upgrade guide which answers many of these questions (including uninstallation) :

http://www.gentoo.org/doc/en/kernel-upgrade.xml

----------

## Timbers2k

I've been using Gentoo for quite a while now, but I still can't figure out how to find some of these guides. If you go to the Documentation links from the home page some of them are listed, but by no means all of them. The Kernel Upgrade Guide shown in the previous post isn't listed, unless in someplace I'm not looking. It seems to me that there should be a central location where someone to go to find all the available documentation. Most of the time I have to search the forums to find out what is available.

----------

## dsd

it suprises me how many people find this. if you go to the documentation page you get this:

 *Quote:*   

> Our documentation is categorized and hierarchically navigable. If you want a quick overview of all available documentation without the additional information, please use our Documentation Listing page.

 

followed by a list of categories.

the kernel upgrade guide can be found under the System Administration page which is linked to from the main documentation page mentioned above.

as the text also mentions, there is also a Documentation Listing page which provides an overview of all available documentation.

do you have any suggestions as to how we can improve navigation here? i see people missing it time and time again, but i really dont understand why...

----------

## sundialsvc4

I strongly recommend making copies of .config with each update you make.  Pretty much anytime you compile the kernel.  Put them in dated, non-hidden files, somewhere like (say...) a folder in /root.

----------

## tgh

 *dsd wrote:*   

> do you have any suggestions as to how we can improve navigation here? i see people missing it time and time again, but i really dont understand why...

 

Maybe a search feature on the documentation page?  Something that would allow you to search through all of the files listed on the document list page?

On the index.xml page, "2. Gentoo Linux Documentation" maybe should be changed to "2. Gentoo Linux Documentation Categories".  There's also a link in the last paragraph in section 1 that simply takes you back to the same page (which I find confusing, look for the link on the word "categorized").

In the left-hand menu, I suggest an entry under "Main Index" that links directly to the document listing (list.xml) in addition to the "Main Index" link that points at index.xml.  Maybe call the "Main Index" -> "Home" and have a new entry called "Index" pointing at list.xml.

(I had never found list.xml before until you indicated that I should look closer at the links buried in the text on the main categories page.)

----------

## jmbsvicetto

 *sundialsvc4 wrote:*   

> I strongly recommend making copies of .config with each update you make.  Pretty much anytime you compile the kernel.  Put them in dated, non-hidden files, somewhere like (say...) a folder in /root.

 

In my view, a better alternative is to get the habit of copying the kernel and the .config files to /boot. If you remove the old kernels tree source, you'll still have the file in /boot.

It's also a good idea to enable the access to the kernel config in /proc/config.gz in the kernel configuration.

----------

## Timbers2k

 *tgh wrote:*   

>  *dsd wrote:*   do you have any suggestions as to how we can improve navigation here? i see people missing it time and time again, but i really dont understand why... 
> 
> In the left-hand menu, I suggest an entry under "Main Index" that links directly to the document listing (list.xml) in addition to the "Main Index" link that points at index.xml.  Maybe call the "Main Index" -> "Home" and have a new entry called "Index" pointing at list.xml.
> 
> (I had never found list.xml before until you indicated that I should look closer at the links buried in the text on the main categories page.)

 

This is the one I like. Put in in that left hand menu, because I've never seen that link buried in the page, and never knew it was there.

----------

## Paapaa

 *tomk wrote:*   

> The usual emerge unmerge should do the trick, the files will be deleted from /usr/src/<kernel_version>.

 

When doing "emerge -P gentoo-sources" the contents of /usr/src/ are NOT deleted for some reason. They have to be deleted manually. (I mean the older versions, of course). Does -C also remove the correct directory under /usr/src/?

----------

## dsd

when you compile a kernel it creates lots of object files (.o) and some other temporary files

these are not removed by portage in any situation because portage did not put them there in the first place. it is safe to remove them manually, and that is pretty much your only option (unless you script it)

----------

## dsd

 *tgh wrote:*   

> Maybe a search feature on the documentation page?  Something that would allow you to search through all of the files listed on the document list page?

 

the website is currently being redesigned, and search features will be implemented soon after the new design goes online.

 *Quote:*   

> On the index.xml page, "2. Gentoo Linux Documentation" maybe should be changed to "2. Gentoo Linux Documentation Categories".  There's also a link in the last paragraph in section 1 that simply takes you back to the same page (which I find confusing, look for the link on the word "categorized").
> 
> In the left-hand menu, I suggest an entry under "Main Index" that links directly to the document listing (list.xml) in addition to the "Main Index" link that points at index.xml.  Maybe call the "Main Index" -> "Home" and have a new entry called "Index" pointing at list.xml.
> 
> (I had never found list.xml before until you indicated that I should look closer at the links buried in the text on the main categories page.)

 

thanks for the great feedback. i've filed bug 114897 for this. if you have any more good ideas where this one came from, please do contact me or file some bugs yourself  :Smile: 

----------

## lusken

I guess you can delete old catalogs in /lib/modules also. In addition to old catalogs in /usr/src, it there any more old kernel-related cruft that is safe to delete?

----------

## JSharku

 *Paapaa wrote:*   

> 
> 
> When doing "emerge -P gentoo-sources" the contents of /usr/src/ are NOT deleted for some reason. They have to be deleted manually. (I mean the older versions, of course). Does -C also remove the correct directory under /usr/src/?

 

Do a "make distclean" first in that dir, it removes all the temporary files and other stuff dsd mentioned which is not installed (and thus unrecognized) by portage. After that "emerge -C/-P" will work as expected.

EDIT: By "that dir" I mean /usr/src/linux-x.y.z, if you want to unmerge multiple versions you have to do it in each of these dirs.

Sharku

----------

## lusken

I have a "safe" kernel in /boot in case of trouble. Is it ok to "emerge -P/-C" that kernel? I will never install new modules on this kernel as the only intention is to have a kernel that supports "all" hardware so I can put the harddisk in another computer if *everything* goes ... (I'm a fanatic christian, I refuse to use bad language)

```
USE="-bitch -in-laws nice gorgeous smart" emerge girlfriend
```

Never ever underestimate the in-laws, their're the best prophets you'll ever get!

----------

## JSharku

 *lusken wrote:*   

> I have a "safe" kernel in /boot in case of trouble. Is it ok to "emerge -P/-C" that kernel? I will never install new modules on this kernel as the only intention is to have a kernel that supports "all" hardware so I can put the harddisk in another computer if *everything* goes ... (I'm a fanatic christian, I refuse to use bad language)

 

A lot of ebuilds will want the /usr/src/linux symlink to be there and pointing towards your currently running kernel, so best keep that around if you want to avoid a lot of broken emerges. It won't hurt to remove previous versions, though as already mentioned, I'd keep the config file and/or the /proc/config.gz support, "just in case". I have several of these kernels, without the correspondig sources in /usr/src, no problem at all... As for making a kernel that supports "all" hardware, keep in mind that the processor type does put some restrictions on what machines it can run on.

```
USE="-bitch -in-laws nice gorgeous smart" emerge girlfriend
```

 *Quote:*   

> Never ever underestimate the in-laws, their're the best prophets you'll ever get!

 Yup, prophets of doom in my case.  :Evil or Very Mad:  At the risk of sounding like a sappy country & western song, maybe I should add

```
USE="-bitterness -heartbroken" emerge -e me
```

Sharku

----------

## ConnorWorm

so could someone here provide an '"idiot" proof guide to using the new kernel vrs the old one? plus, could removing/uninstalling of the old kernel be in there too???

----------

