# ERROR: Kernel Makefile (/usr/src/linux/Makefile) missing.

## Gooberpatrol66

```
localhost user # emerge -a gentoo-sources

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R    ] sys-kernel/gentoo-sources-4.1.15-r1 

Would you like to merge these packages? [Yes/No] y

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) sys-kernel/gentoo-sources-4.1.15-r1::gentoo

 * linux-4.1.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ...  [ ok ]

 * genpatches-4.1-20.base.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ...           [ ok ]

 * genpatches-4.1-20.extras.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ...             [ ok ]

>>> Preparing to unpack ...

>>> Unpacking source...

>>> Unpacking linux-4.1.tar.xz to /var/tmp/portage/sys-kernel/gentoo-sources-4.1.15-r1/work

>>> Unpacking genpatches-4.1-20.base.tar.xz to /var/tmp/portage/sys-kernel/gentoo-sources-4.1.15-r1/work/patches

>>> Unpacking genpatches-4.1-20.extras.tar.xz to /var/tmp/portage/sys-kernel/gentoo-sources-4.1.15-r1/work/patches

 * Excluding Patch #5000_enable-additional-cpu-optimizations-for-gcc.patch ...                                             [ ok ]

 * Excluding Patch #5015_kdbus*.patch ...                 [ ok ]

 * Applying 1000_linux-4.1.1.patch (-p1) ...              [ ok ]

 * Applying 1001_linux-4.1.2.patch (-p1) ...              [ ok ]

 * Applying 1002_linux-4.1.3.patch (-p1) ...              [ ok ]

 * Applying 1003_linux-4.1.4.patch (-p1) ...              [ ok ]

 * Applying 1004_linux-4.1.5.patch (-p1) ...              [ ok ]

 * Applying 1005_linux-4.1.6.patch (-p1) ...              [ ok ]

 * Applying 1006_linux-4.1.7.patch (-p1) ...              [ ok ]

 * Applying 1007_linux-4.1.8.patch (-p1) ...              [ ok ]

 * Applying 1008_linux-4.1.9.patch (-p1) ...              [ ok ]

 * Applying 1009_linux-4.1.10.patch (-p1) ...             [ ok ]

 * Applying 1010_linux-4.1.11.patch (-p1) ...             [ ok ]

 * Applying 1011_linux-4.1.12.patch (-p1) ...             [ ok ]

 * Applying 1012_linux-4.1.13.patch (-p1) ...             [ ok ]

 * Applying 1013_linux-4.1.14.patch (-p1) ...             [ ok ]

 * Applying 1014_linux-4.1.15.patch (-p1) ...             [ ok ]

 * Applying 1500_XATTR_USER_PREFIX.patch (-p1) ...        [ ok ]

 * Applying 1510_fs-enable-link-security-restrictions-by-default.patch (-p1) ...                                           [ ok ]

 * Applying 1520_keyring-refleak-in-join-session-CVE-2016-0728.patch (-p1) ...                                             [ ok ]

 * Applying 2700_ThinkPad-30-brightness-control-fix.patch (-p1) ...                                                        [ ok ]

 * Applying 2900_dev-root-proc-mount-fix.patch (-p1) ...  [ ok ]

 * Applying 2905_2disk-resume-image-fix.patch (-p1) ...   [ ok ]

 * Applying 2910_lz4-compression-fix.patch (-p1) ...      [ ok ]

 * Applying 4200_fbcondecor-3.19.patch (-p1) ...          [ ok ]

 * Applying 4567_distro-Gentoo-Kconfig.patch (-p1) ...    [ ok ]

>>> Source unpacked in /var/tmp/portage/sys-kernel/gentoo-sources-4.1.15-r1/work

>>> Preparing source in /var/tmp/portage/sys-kernel/gentoo-sources-4.1.15-r1/work/linux-4.1.15-gentoo-r1 ...

>>> Source prepared.

>>> Configuring source in /var/tmp/portage/sys-kernel/gentoo-sources-4.1.15-r1/work/linux-4.1.15-gentoo-r1 ...

>>> Source configured.

>>> Compiling source in /var/tmp/portage/sys-kernel/gentoo-sources-4.1.15-r1/work/linux-4.1.15-gentoo-r1 ...

>>> Source compiled.

>>> Test phase [not enabled]: sys-kernel/gentoo-sources-4.1.15-r1

>>> Install gentoo-sources-4.1.15-r1 into /var/tmp/portage/sys-kernel/gentoo-sources-4.1.15-r1/image/ category sys-kernel

>>> Copying sources ...

>>> Completed installing gentoo-sources-4.1.15-r1 into /var/tmp/portage/sys-kernel/gentoo-sources-4.1.15-r1/image/

ecompressdir: bzip2 -9 /usr/share/doc

>>> Installing (1 of 1) sys-kernel/gentoo-sources-4.1.15-r1::gentoo

 * Note: Even though you have successfully unmerged 

 * your kernel package, directories in kernel source location: 

 * /usr/src/linux-4.1.15-gentoo-r1

 * with modified files will remain behind. By design, package managers

 * will not remove these modified files and the directories they reside in.

 * If you are upgrading from a previous kernel, you may be interested

 * in the following document:

 *   - General upgrade guide: https://wiki.gentoo.org/wiki/Kernel/Upgrade

 * For more info on this patchset, and how to report problems, see:

 * https://dev.gentoo.org/~mpagano/genpatches

 * Messages for package sys-kernel/gentoo-sources-4.1.15-r1:

 * Note: Even though you have successfully unmerged 

 * your kernel package, directories in kernel source location: 

 * /usr/src/linux-4.1.15-gentoo-r1

 * with modified files will remain behind. By design, package managers

 * will not remove these modified files and the directories they reside in.

 * Messages for package sys-kernel/gentoo-sources-4.1.15-r1:

 * If you are upgrading from a previous kernel, you may be interested

 * in the following document:

 *   - General upgrade guide: https://wiki.gentoo.org/wiki/Kernel/Upgrade

>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

 * GNU info directory index is up-to-date.

!!! existing preserved libs:

>>> package: gnome-base/gnome-desktop-3.18.2

 *  - /usr/lib64/libgnome-desktop-3.so.10

 *  - /usr/lib64/libgnome-desktop-3.so.10.0.0

 *      used by /usr/bin/evince (app-text/evince-3.16.1)

 *      used by /usr/bin/gnome-control-center (gnome-base/gnome-control-center-3.16.3)

 *      used by /usr/bin/gnome-session (gnome-base/gnome-session-3.16.0)

 *      used by 13 other files

Use emerge @preserved-rebuild to rebuild packages using these libraries

localhost user # genkernel --oldconfig all

* Gentoo Linux Genkernel; Version 63

* Running with options: --oldconfig all

* Using genkernel.conf from /etc/genkernel.conf

* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86_64/config.sh ..

* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86_64/modules_load ..

* ERROR: Kernel Makefile (/usr/src/linux/Makefile) missing.  Maybe re-install the kernel sources.

* 

* -- Grepping log... --

* 

* Running with options: --oldconfig all

* Using genkernel.conf from /etc/genkernel.conf

* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86_64/config.sh ..

* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86_64/modules_load ..

*

* ERROR: Kernel Makefile (/usr/src/linux/Makefile) missing.  Maybe re-install the kernel sources.

* 

* -- 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!

* 

```

?Last edited by Gooberpatrol66 on Sun Apr 03, 2016 2:18 am; edited 1 time in total

----------

## eccerr0r

Try

# eselect kernel list

# eselect kernel set (choose one)

Or manually symlink /usr/src/linux -> /usr/src/linux--4.1.15-gentoo-r1 ?

----------

## Gooberpatrol66

Ah, that worked.

thanks

----------

## eccerr0r

No problem, change the title to include [SOLVED] if you feel the problem is complete resolved.

----------

## Kobboi

Indeed, your /usr/src/linux symlink was pointing to an old set of kernel sources. You probably unmerged those, but note that you might still have some unnecessary files taking up disk space (i.e. the binaries resulting from the compilation of that older kernel), so you might want to clean that up. Same thing for the modules belonging to that older kernel version in /lib/modules.

Only do the clean up when you are sure you won't be needing that kernel any more! Else, if your newly generated kernel is showing problems, you have nothing to fall back to!

----------

## Gooberpatrol66

 *eccerr0r wrote:*   

> No problem, change the title to include [SOLVED] if you feel the problem is complete resolved.

 

I can't, it makes the title too long!

----------

