# How to add existing kernels into eslect kernel list?[solved]

## diablo465

I have several kernels located in the /usr/src/ folder, while only one of them is listed in eselect kernel list. How can I add them back into the kernel list?

```
ae429-1105 src # eselect kernel list

Available kernel symlink targets:

  [1]   linux-3.17.8-gentoo-r1 *
```

```
ls -l

total 20

lrwxrwxrwx  1 root root   22 Feb  5 09:04 linux -> linux-3.17.8-gentoo-r1

drwxr-xr-x 20 root root 4096 Nov 23 17:06 linux-3.10.25-gentoo

drwxr-xr-x 20 root root 4096 Nov 23 17:04 linux-3.12.13-gentoo

drwxr-xr-x 20 root root 4096 Feb  2 14:47 linux-3.12.21-gentoo-r1

drwxr-xr-x 20 root root 4096 Feb  5 08:47 linux-3.17.7-gentoo

drwxr-xr-x 25 root root 4096 Feb  5 09:06 linux-3.17.8-gentoo-r1
```

Last edited by diablo465 on Thu Feb 05, 2015 6:08 am; edited 1 time in total

----------

## John R. Graham

They may no longer be installed. What's the output of

```
equery list -i gentoo-sources
```

(run as root)?

- John

----------

## diablo465

 *John R. Graham wrote:*   

> They may no longer be installed. What's the output of
> 
> ```
> equery list -i gentoo-sources
> ```
> ...

 

```

ae429-1105 lib # equery list -i gentoo-sources

 * Searching for gentoo-sources ...

[IP-] [  ] sys-kernel/gentoo-sources-3.17.8-r1:3.17.8-r1

```

I do wish to make the old kernel work as a backups.

----------

## John R. Graham

Well, unfortunately (or not, depending on your perspective), none of those are any longer in the Portage tree. Getting them back, while not impossible, is a pain. You can see what's currently available with

```
equery list -p gentoo-sources
```

There's a somewhat subtle difference between

```
emerge gentoo-sources
```

and

```
emerge =gentoo-sources-3.17.8-r1
```

The former tells Portage to install the latest  version of gentoo-sources that you're keyworded for and to keep you up to date with the latest version during "emerge --update" runs. The latter, though, tells Portage you explicitly want a particular version. Subsequent "emerge --update" runs will not erase this version.

You can pin your current version like that without re-installing by using the --noreplace option:

```
emerge --noreplace =gentoo-sources-3.17.8-r1
```

Hope this helps.  :Wink: 

- John

----------

## Jaglover

You can have unlimited number of backup kernels (/boot partition size permitting) and they all will work without sources installed. What you see in your /usr/src is remnants of kernel sources after emerge --depclean.

----------

## diablo465

 *Jaglover wrote:*   

> You can have unlimited number of backup kernels (/boot partition size permitting) and they all will work without sources installed. What you see in your /usr/src is remnants of kernel sources after emerge --depclean.

 

Thanks for the explain. I understood how other kernels are removed. Yes, I can still boot the non-listed kernels as long as boot file are in /boot folder. 

Howerver, it is find that I can not manually make the non-listed kenerls (e.g., linux-3.10.25-gentoo ) any more. Specifically the Makefile missing in the non-listed kernels after emerge --depclean.

How do i get the Makefile for the non-listed kenerls? It seems that copying makefile from the listed kernel (i.e., gentoo-sources-3.17.8-r1) is not working.

```

ln -s /usr/src/linux-3.17.7-gentoo /usr/src/linux

ae429-1105 src # ls -l

total 20

lrwxrwxrwx  1 root root   28 Feb  5 10:44 linux -> /usr/src/linux-3.17.7-gentoo

drwxr-xr-x 20 root root 4096 Feb  5 10:51 linux-3.10.25-gentoo

drwxr-xr-x 20 root root 4096 Nov 23 17:04 linux-3.12.13-gentoo

drwxr-xr-x 20 root root 4096 Feb  2 14:47 linux-3.12.21-gentoo-r1

drwxr-xr-x 20 root root 4096 Feb  5 10:48 linux-3.17.7-gentoo

drwxr-xr-x 25 root root 4096 Feb  5 10:48 linux-3.17.8-gentoo-r1

cd linux

ae429-1105 linux # make menuconfig

make: *** No rule to make target 'menuconfig'.  Stop.

ae429-1105 src # ls ../linux-3.12.21-gentoo-r1/

arch   crypto   firmware  include  ipc     lib  modules.builtin  Module.symvers  scripts   sound       usr      vmlinux.o

block  drivers  fs        init     kernel  mm   modules.order    net             security  System.map  vmlinux

(AGAIN NO MAKEFILE ANYMORE!!!!!!!!)

```

----------

## Jaglover

There is much more than Makefile cleaned out, after emerge --depclean the sources affected are effectively gone. Below are the kernel sources still in portage, you can install them as you wish. 

```
$ eix gentoo-sources

[?] sys-kernel/gentoo-sources

     Available versions:  

     (3.4.105) (~)3.4.105^bs

     (3.4.106) (~)3.4.106^bs

     (3.4.9999) **3.4.9999^bs

     (3.10.63) 3.10.63^bs

     (3.10.64) (~)3.10.64^bs

     (3.10.65) (~)3.10.65^bs

     (3.10.66) (~)3.10.66^bs

     (3.10.67) (~)3.10.67^bs

     (3.10.9999) **3.10.9999^bs

     (3.12.35) 3.12.35^bs

     (3.12.9999) **3.12.9999^bs

     (3.14.27) 3.14.27^bs

     (3.14.28) (~)3.14.28^bs

     (3.14.29) (~)3.14.29^bs

     (3.14.30) (~)3.14.30^bs

     (3.14.31) (~)3.14.31^bs

     (3.17.8) (~)3.17.8^bs

     (3.17.8-r1) 3.17.8-r1^bs

     (3.18.0) (~)3.18.0^bs

     (3.18.1) (~)3.18.1^bs

     (3.18.2) (~)3.18.2^bs

     (3.18.3) (~)3.18.3^bs

     (3.18.4) (~)3.18.4^bs
```

----------

## diablo465

 *Jaglover wrote:*   

> There is much more than Makefile cleaned out, after emerge --depclean the sources affected are effectively gone.

 

Is there any way that we can prevent emerge --depclean  from removing non-supported kernels? I wish to use emerge --depclean regularly but do not want it to remove my kernels.

The reason I need to stick into old kernels is because everytime I use new kernels, some annoying modules (e.g., virtualbox-bin nvidia-drivers and more) has to be recompiled. Most of the time these modules can not work after recompile. I have to wait until the updates from forums for solutions, During the waiting period I have to roll back to a old non-listed kernel where annoying modules are working. If old kernels are deprived from make, they become almost useless even if the annoying modules are working.

So currently I am standing at a situation where none of the kernels are working perfectly due to an kernel update.

----------

## Jaglover

I suggest you open another thread about your update problems. For me emerge @module-rebuild works every time, no problems. To answer your question about keeping some packages from cleaned out - use --exclude option. You do realize you need to modprobe -r the old module before the new one can be loaded?

----------

## John R. Graham

 *diablo465 wrote:*   

> Is there any way that we can prevent emerge --depclean  from removing non-supported kernels? I wish to use emerge --depclean regularly but do not want it to remove my kernels.

 Yes. Someone has helpfully described how you do that.  :Wink: 

- John

----------

## diablo465

 *John R. Graham wrote:*   

>  *diablo465 wrote:*   Is there any way that we can prevent emerge --depclean  from removing non-supported kernels? I wish to use emerge --depclean regularly but do not want it to remove my kernels. Yes. Someone has helpfully described how you do that. 
> 
> - John

 

Thanks, John, this definately suits my need. I will mark it as solved.

----------

