# Kernel source directory not found (SOLVED)

## lokoalex

Im trying to  *Quote:*   

> genkernel --menuconfig all
> 
> 

  and this is what I get:

```
* Gentoo Linux Genkernel; Version 3.4.8

* Running with options: all

* ERROR: kernel source directory "/usr/src/linux" was not found!

* -- Grepping log... --

* Gentoo Linux Genkernel; Version 3.4.8

* Running with options: all

* ERROR: kernel source directory "/usr/src/linux" was not found!

* -- End log... --

* Please consult /var/log/genkernel.log for more information and any

* errors that were reported above.

* Report any genkernel bugs to bugs.gentoo.org and

* assign your bug to genkernel@gentoo.org. Please include

* as much information as you can in your bug report; attaching

* /var/log/genkernel.log so that your issue can be dealt with effectively.

*

* Please do *not* report compilation failures as genkernel bugs!
```

*

So I tried upgrading the kernel and I still get the same problems. 

Any suggestions?

----------

## Kwark

Is there a symlink /usr/src/linux to one of the real /usr/src/ kernel source directories?

If not, make one yourself.

----------

## lokoalex

Yes I have a symlink. Here is what I have:

```
#ls -l /usr/src/linux

lrwxrwxrwx 1 root root 15 Nov  2 10:18 /usr/src/linux -> linux-2.6.22-r8
```

----------

## lokoalex

Still having the same problems. Is there anyone who can help?

----------

## tarpman

Does /usr/src/linux/linux-2.6.22-r8 exist?  There is no sys-kernel/vanilla-sources-2.6.22-r8; the closest one to that is sys-kernel/gentoo-sources-2.6.22-r8, which would result in a target for the symlink of /usr/src/linux-2.6.22-gentoo-r8.

----------

## lokoalex

Here is what I have:

```
cd /usr/src/linux

bash: cd: /usr/src/linux: No such file or directory

```

But: 

```
ls /usr/src

linux  linux-2.6.22-gentoo-r8  linux-2.6.22-gentoo-r9

```

And:

```
ls /usr/src/linux

/usr/src/linux

```

But the output is blinking for some reason.

----------

## Hu

The blinking is an indication that ls considers the symlink to be broken.  In this case, the link is dangling.  According to your output, you have linux-2.6.22-gentoo-r8 and linux-2.6.22-gentoo-r9 as available kernel source directories.  However, your symlink points to linux-2.6.22-r8.  Notice that the kernel directories have a gentoo- that your symlink does not.  To fix it, remove the symlink named linux and recreate it, this time pointing it to a directory that exists.  You can use the shell's tab completion feature to ensure that you do not misspell the name.

----------

## Lemmens

 *lokoalex wrote:*   

> 
> 
> But: 
> 
> ```
> ...

 

You can use app-admin/eselect to modify the symlink (#emerge eselect).

The command eselect kernel list outputs the different kernel sources on your system and shows which one is currently selected by the symlink:

```
Available kernel symlink targets:

          [1]     linux-2.6.22-gentoo-r8  *

          [2]     linux-2.6.22-gentoo-r9
```

Then you can select the one to which the symlink has to point to:  "eselect kernel set 1" or "eselect kernel set 2"

----------

## lokoalex

Still having the same issues.

----------

## lokoalex

Ok so I checked my kernel version: 

```
# eselect kernel list

Available kernel symlink targets:

  [1]   linux-2.6.22-gentoo-r8 

  [2]   linux-2.6.22-gentoo-r9
```

And I selected the one i use:

```
src # eselect kernel set linux-2.6.22-gentoo-r8
```

Then I checked to make sure it worked:

```
# eselect kernel list

Available kernel symlink targets:

  [1]   linux-2.6.22-gentoo-r8* 

  [2]   linux-2.6.22-gentoo-r9
```

Then I created the new link:

```
src # ln -sfn linux-2.6.22-gentoo-r8
```

Then I tried to: 

```
genkernel --menuconfig all 
```

And this is what I get which is the same as before:

```
src # genkernel --menuconfig all

* Gentoo Linux Genkernel; Version 3.4.8

* Running with options: --menuconfig all

grep: /usr/src/linux/Makefile: No such file or directory

grep: /usr/src/linux/Makefile: No such file or directory

grep: /usr/src/linux/Makefile: No such file or directory

grep: /usr/src/linux/Makefile: No such file or directory

/usr/share/genkernel/gen_determineargs.sh: line 35: [: : integer expression expected

* Linux Kernel .. for x86...

* ERROR: Error: No kernel .config specified, or file not found!

* -- Grepping log... --

* Linux Kernel .. for x86...

* Gentoo Linux Genkernel; Version 3.4.8

* Running with options: --menuconfig all

* ERROR: Error: No kernel .config specified, or file not found!

* -- End log... --

* Please consult /var/log/genkernel.log for more information and any

* errors that were reported above.

* Report any genkernel bugs to bugs.gentoo.org and

* assign your bug to genkernel@gentoo.org. Please include

* as much information as you can in your bug report; attaching

* /var/log/genkernel.log so that your issue can be dealt with effectively.

*

* Please do *not* report compilation failures as genkernel bugs!

*

```

So I decided to check my symlink and its correct:

```
src # ls -l /usr/src/linux

lrwxrwxrwx 1 root root 22 Nov  6 12:45 /usr/src/linux -> linux-2.6.22-gentoo-r8
```

And the output of this wasnt blinking anymore:

```
 src # ls /usr/src/linux

Module.symvers  block    fs       ipc     mm       security  vmlinux

System.map      crypto   include  kernel  net      sound

arch            drivers  init     lib     scripts  usr
```

So again if anyone can help it would be great.

----------

## gerard27

lokoalex,

Your kernel (2.6.22-gentoo-r8 ) apparently is not complete or otherwise damaged I think.

Try re-emergeing that kernel.

To make live easier you might want to install "mc".

```
emerge -pv mc
```

and check if you agree with the dependencies it might want to install.

mc is a great console browser.It would have shown your dangling symlink in red.

Gerard.

----------

## lokoalex

How can I re-emerge 2.6.22-gentoo-r8 if they are up to 2.6.22-gentoo-r9?

----------

## gerard27

```

emerge =gentoo-sources-2.6.22-r8
```

Read man emerge man ebuild etc.

Gerard.

----------

## lokoalex

You are awesome. Im still a little rusty with using the man pages thats why I asked for help. But im working my way there.

----------

## gerard27

No I'm 80.

Did this solve your problem?

Gerard.

----------

## lokoalex

You completely solved my problem. Thanks for all the help!!!

----------

