# Could not find a Makefile in the kernel source directory

## midway

on a regular emerge, today, glib-2.32.4-r1 was pulled (as reinstall) from portage. However, the update complained about a missing makefile in the source directory. please help me resolve this.

```

~ # equery b glib

 * Searching for glib ...

dev-libs/glib-1.2.10-r5 (/usr/lib/glib)

dev-libs/glib-2.32.4-r1 (/usr/include/glib-2.0/glib)

dev-libs/glib-2.32.4-r1 (/usr/share/gtk-doc/html/glib)

```

More info could be found here, thanks. 

http://pastebin.com/N1XiC9nm

I have re-checked and kernel seems to be correctly set and symlink'ed.

```

src # ls -la /usr/src/

total 8

drwxr-xr-x  4 root root   92 Apr 12  2010 .

drwxr-xr-x 13 root root 4096 Nov  1  2005 ..

-rw-r--r--  1 root root    0 Aug 31  2005 .keep

lrwxrwxrwx  1 root root   24 Apr 12  2010 linux -> linux-2.6.28-hardened-r9

drwxr-xr-x  4 root root   84 Apr 12  2010 linux-2.6.28-hardened-r7

drwxr-xr-x 22 root root 4096 Jul 28 18:21 linux-2.6.28-hardened-r9

# eselect kernel list

Available kernel symlink targets:

  [1]   linux-2.6.28-hardened-r7

  [2]   linux-2.6.28-hardened-r9 *

~ # ls -al /usr/src/linux-2.6.28-hardened-r9/.config

-rw-r--r-- 1 root root 88835 Apr 12  2010 /usr/src/linux-2.6.28-hardened-r9/.config

```

However, I seem to have a lot less (under source) and the makefile is missing, not sure but last depclean might have unmerged it? but how?  :Confused: 

```

~ # ls /usr/src/linux                 [this is on linux-2.6.28-hardened-r9]

Module.markers  System.map  block   drivers   fs          include  ipc     lib  modules.order  scripts   sound  virt     vmlinux.o

Module.symvers  arch        crypto  firmware  grsecurity  init     kernel  mm   net            security  usr    vmlinux

```

Please guide me how to backup config and re-download it. 

My 2 other servers have different entries (than above):

```

server 1 ~ # ls /usr/src/linux    [this is on 3.3.8 and fully updated]

COPYING        Kconfig         README          block     fs       kernel           modules.order  security  virt

CREDITS        MAINTAINERS     REPORTING-BUGS  crypto    include  lib              net            sound     vmlinux

Documentation  Makefile        System.map      drivers   init     mm               samples        tools     vmlinux.o

Kbuild         Module.symvers  arch            firmware  ipc      modules.builtin  scripts        usr

 server 2~ # ls /usr/src/linux     [this is on linux-2.6.28-hardened-r9]

COPYING  Documentation  MAINTAINERS  README          arch   crypto   firmware  grsecurity  init  kernel  mm   samples  security  usr

CREDITS  Kbuild         Makefile     REPORTING-BUGS  block  drivers  fs        include     ipc   lib     net  scripts  sound     virt

```

Toodaloo.

----------

## DONAHUE

you are exactlly right, emerge --depclean has been doing this for a couple of years now

for example, 

```
emerge =gentoo-sources-3.4.9
```

will fix the problem if gentoo-sources-3.4.9 were my active kernel but 3.6.1 had been emerged

----------

## midway

are you saying i should update hardened sources to the latest version (3.5.4-r1) or reemerge the current one (linux-2.6.28-hardened-r9)?

```

 ~ # emerge -av hardened-sources

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

Calculating dependencies... done!

[ebuild  N     ] sys-kernel/hardened-sources-3.5.4-r1  USE="symlink -build -deblob" 79,782 kB

Total: 1 package (1 new), Size of downloads: 79,782 kB

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

Quitting.

```

Can I not reinstall my current kernel r9 from kernel.org? if yes please tell me how?Last edited by midway on Thu Oct 11, 2012 2:43 pm; edited 1 time in total

----------

## DONAHUE

yes... or leave alone until you have to take action

----------

## midway

ok, I went ahead and upgraded to 3.5.4-r1 and because I had 'symlink' enabled in make.conf, kernel got automatically set.

```

~ # eselect kernel list

Available kernel symlink targets:

[1] linux-2.6.28-hardened-r7

[2] linux-2.6.28-hardened-r9

[3] linux-3.5.4-hardened-r1 *

~ # ls -al /usr/src/linux

lrwxrwxrwx 1 root root 23 Oct 11 15:50 /usr/src/linux -> linux-3.5.4-hardened-r1

```

after the update it asked me to emerge gradm.

more information:

http://pastebin.com/3HcYZ9uv

----------

## midway

right, now i am building/compiling the kernel and modules.

module/build works upto code listing 5.4 [http://www.gentoo.org/doc/en/kernel-upgrade.xml]

```

~ # make && make modules_install 

Setup is 12848 bytes (padded to 13312 bytes).

System is 5123 kB

CRC d228183

Kernel: arch/x86/boot/bzImage is ready  (#1)

  Building modules, stage 2.

  MODPOST 7 modules

WARNING: modpost: Found 13 section mismatch(es).

To see full details build your kernel with:

'make CONFIG_DEBUG_SECTION_MISMATCH=y'

  CC      arch/x86/kernel/test_nx.mod.o

  LD [M]  arch/x86/kernel/test_nx.ko

  CC      drivers/char/kcopy/kcopy.mod.o

  LD [M]  drivers/char/kcopy/kcopy.ko

  CC      drivers/hid/hid-logitech-dj.mod.o

  LD [M]  drivers/hid/hid-logitech-dj.ko

  CC      drivers/net/ethernet/amd/pcnet32.mod.o

  LD [M]  drivers/net/ethernet/amd/pcnet32.ko

  CC      drivers/scsi/scsi_wait_scan.mod.o

  LD [M]  drivers/scsi/scsi_wait_scan.ko

  CC      net/netfilter/xt_LOG.mod.o

  LD [M]  net/netfilter/xt_LOG.ko

  CC      net/netfilter/xt_mark.mod.o

  LD [M]  net/netfilter/xt_mark.ko

  INSTALL arch/x86/kernel/test_nx.ko

  INSTALL drivers/char/kcopy/kcopy.ko

  INSTALL drivers/hid/hid-logitech-dj.ko

  INSTALL drivers/net/ethernet/amd/pcnet32.ko

  INSTALL drivers/scsi/scsi_wait_scan.ko

  INSTALL net/netfilter/xt_LOG.ko

  INSTALL net/netfilter/xt_mark.ko

  DEPMOD  3.5.4-hardened-r1

```

However, I can not mount /boot

```

# mount /boot

mount: special device /dev/sda1 does not exist

```

I have enabled support for PIIX4 and other drivers (in menuconfig as per code listing 5.3):

```
~ # lspci -nn

00:00.0 Host bridge [0600]: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge [8086:7190] (rev 01)

00:01.0 PCI bridge [0604]: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge [8086:7191] (rev 01)

00:07.0 ISA bridge [0601]: Intel Corporation 82371AB/EB/MB PIIX4 ISA [8086:7110] (rev 08)

00:07.1 IDE interface [0101]: Intel Corporation 82371AB/EB/MB PIIX4 IDE [8086:7111] (rev 01)

00:07.3 Bridge [0680]: Intel Corporation 82371AB/EB/MB PIIX4 ACPI [8086:7113] (rev 08)

00:0f.0 VGA compatible controller [0300]: VMware SVGA II Adapter [15ad:0405]

00:10.0 SCSI storage controller [0100]: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI [1000:0030] (rev 01)

00:11.0 Ethernet controller [0200]: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] [1022:2000] (rev 10)

```

has there been many changes between 2.6.28-r9 and 3.5.4-r1? IS it okay to use the old .config or it won't work?

----------

## khayyam

midway ... generally I would say 'make oldconfig' is not safe been major revisions, and I would be inclined to start from scratch in such circumstances. However, you may simply be missing devtmpfs, which is infact a recent addition, also you might also want to switch from PATA to ATA_PIIX as PATA has been depreciated (but from the lspci I can't tell what driver you have selected). Most likely its devtempfs that is missing so make sure to enable the following:

CONFIG_DEVTMPFS=y

CONFIG_TMPFS=y

HTH & best ... khay

----------

## Hu

It is usually possible to use make oldnoconfig to jump between nearby kernel versions.  However, this server is badly out of date, so a fresh start might be easier.  To put this in perspective, there are 192096 commits in v2.6.28..v3.5, with a diffstat of 39061 files changed, 9082972 insertions(+), 3605474 deletions(-).  This does not count the ways in which the hardened patches have grown or changed over the corresponding time range.

----------

## midway

hi khay, Hu and all, 

ATA_PIIX shows:

```
  

Symbol: ATA_PIIX [=y]                                                                                                        

  │ Type  : tristate                                                                                                             

  │ Prompt: Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support                                                                       

  │   Defined at drivers/ata/Kconfig:186                                                                                          

  │   Depends on: ATA [=y] && ATA_SFF [=y] && ATA_BMDMA [=y] && PCI [=y]                                                         

  │   Location:                                                                                                                  

  │     -> Device Drivers                                                                                                        

  │       -> Serial ATA and Parallel ATA drivers (ATA [=y])                                                                      

  │         -> ATA SFF support (ATA_SFF [=y])                                                                                    

  │           -> ATA BMDMA support (ATA_BMDMA [=y])                

```

and then I did:

CONFIG_DEVTMPFS=y

CONFIG_TMPFS=y  AND

menuconfig search then showed:

```
Symbol: DEVTMPFS [=y] 

│ Type : boolean 

│ Prompt: Maintain a devtmpfs filesystem to mount at /dev 

│ Defined at drivers/base/Kconfig:24 

│ Depends on: HOTPLUG [=y] 

│ Location: 

│ -> Device Drivers 

│ -> Generic Driver Options 

│ 

│ 

│ Symbol: DEVTMPFS_MOUNT [=n] 

│ Type : boolean 

│ Prompt: Automount devtmpfs at /dev, after the kernel mounted the rootfs 

│ Defined at drivers/base/Kconfig:44 

│ Depends on: DEVTMPFS [=y] 

│ Location: 

│ -> Device Drivers 

│ -> Generic Driver Options 

│ -> Maintain a devtmpfs filesystem to mount at /dev (DEVTMPFS [=y])
```

so now I have enabled mount too: 

```

(/sbin/hotplug) path to uevent helper                                                           

  │ │                          [*] Maintain a devtmpfs filesystem to mount at /dev                                              

  │ │                          [*]   Automount devtmpfs at /dev, after the kernel mounted the rootfs                            │ │

  │ │                          [*] Select only drivers that don't need compile-time external firmware                           │ │

  │ │                          [*] Prevent firmware from being built                                                            │ │

  │ │                          -*- Userspace firmware loading support                                                           │ │

  │ │                          [*]   Include in-kernel firmware blobs in kernel binary                                          │ │

  │ │                          ()    External firmware blobs to build into the kernel binary                                    │ │

  │ │                          [ ] Driver Core verbose debug messages                                                           │ │

  │ │                          [*] Managed device resources verbose debug messages                                              │ │

  │ │                          [ ] Contiguous Memory Allocator (EXPERIMENTAL)  

```

fdisk -l doesn't show anything   :Confused: 

```
 ~ # cat /etc/fstab

/dev/sda1 /boot xfs defaults,noatime 1 2

/dev/sda2 swap swap sw 0 0

/dev/sda3 / xfs noatime 0 1

/dev/cdrom /mnt/cdrom auto defaults,noauto 0 0

none /proc proc defaults 0 0

none /dev/shm tmpfs nodev,nosuid,noexec,rw 0 0

~ # mount /boot

mount: special device /dev/sda1 does not exist

```

I have been following "kernel options" in this wiki:

http://en.gentoo-wiki.com/wiki/VMware_Guest

More info on drivers (please tell me how to resolve the IDE kernel driver to ata):

```
~ # lspci -k

00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)

        Subsystem: VMware Virtual Machine Chipset

        Kernel driver in use: agpgart-intel

        Kernel modules: intel-agp

00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)

        Kernel modules: shpchp

00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)

        Subsystem: VMware Virtual Machine Chipset

00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)

        Subsystem: VMware Virtual Machine Chipset

        Kernel driver in use: PIIX_IDE

        Kernel modules: ata_piix

00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)

        Subsystem: VMware Virtual Machine Chipset

        Kernel modules: i2c-piix4

00:0f.0 VGA compatible controller: VMware SVGA II Adapter

        Subsystem: VMware SVGA II Adapter

00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)

        Kernel driver in use: mptspi

        Kernel modules: mptspi

00:11.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)

        Subsystem: Advanced Micro Devices [AMD] PCnet - Fast 79C971

        Kernel driver in use: pcnet32

        Kernel modules: pcnet32, vmxnet

```

I "think" this is where the whole problem lies (kernel can not see the disk):

```

00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01) (prog-if 8a [Master SecP PriP])

        Subsystem: VMware Virtual Machine Chipset

        Control: I/O+ Mem- BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-

        Status: Cap- 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-

        Latency: 64

        Region 0: [virtual] Memory at 000001f0 (32-bit, non-prefetchable) [size=8]

        Region 1: [virtual] Memory at 000003f0 (type 3, non-prefetchable)

        Region 2: [virtual] Memory at 00000170 (32-bit, non-prefetchable) [size=8]

        Region 3: [virtual] Memory at 00000370 (type 3, non-prefetchable)

        Region 4: I/O ports at 1050 [size=16]

        Kernel driver in use: PIIX_IDE

        Kernel modules: ata_piix

```

I have the new kernel 3.5.4-r1 (hardened) installed, set and compiled but I am afraid of rebootin the system at this point. as there is nothing inside boot (like grub etc) or i can not mount sda1/2/3 (from within my current kernel 2.6.28-r9) - so i can not even update my grub bootloader. please could anyone advice a resolution? - I am out of my depth here   :Sad: 

----------

## khayyam

 *midway wrote:*   

> 
> 
> ```
> Kernel driver in use: PIIX_IDE
> 
> ...

 

midway ... this shows that though the ATA_PIIX is enabled, the PIIX_IDE is in use. The old PATA (CONFIG_IDE) should be disabled, as its depreciated in favor of SATA (CONFIG_ATA). I don't think this would cause the disk to be unavailable as it should show up as IDE, but none the less its better to use the SATA drivers.  

 *midway wrote:*   

> I have been following "kernel options" in this wiki:
> 
> http://en.gentoo-wiki.com/wiki/VMware_Guest

 

OK, well, you might have mentioned it was a VM from the begining as it would have pointed to the reason that the Makefile is missing. I have seen this very same issue a number of times now (in the #gentoo irc channel) and it seems to be caused by the memory asignment for the VM being too low.

 *midway wrote:*   

> I have the new kernel 3.5.4-r1 (hardened) installed, set and compiled but I am afraid of rebootin the system at this point. as there is nothing inside boot (like grub etc) or i can not mount sda1/2/3 (from within my current kernel 2.6.28-r9) - so i can not even update my grub bootloader. please could anyone advice a resolution? - I am out of my depth here  :(

 

You would generally do such a kernel update from a working install (ie, using the previous working kernel) and it should be kept as a boot option so that you can at least boot and fix the issues if the upgrade didn't go as planned.

Still, there may be any number of issues here, the most obvious of which are, 1). the .config (and so kernel build) is off kilter due to 'make oldconfig' not coping with the jump from 2.6.x to 3.4.x, 2). there is some issue with the grsec (or selinux depending on which you use) setup triggered by the package updates mentioned at the begining of the thread, 3). some issue on the machine which hosts the VM, but as there is nothing really obvious in the information you have provided that suggests why the partitions aren't showing up I can only suggest using the previous kernel (if still available) so as to work arround the issue.

best ... khay

----------

## midway

Sorry for the very late reply but I was out of station. Since I am back I have tried the update and kernel update on an another gentoo VM and it has worked just fine. here is the info:

```

~ # emerge --info

Portage 2.1.11.9 (hardened/linux/x86, gcc-4.5.4, glibc-2.15-r3, 3.5.7-gentoo i686)

=================================================================

System uname: Linux-3.5.7-gentoo-i686-Intel-R-_Xeon-R-_CPU_X5450_@_3.00GHz-with-gentoo-2.1

Timestamp of tree: Mon, 22 Oct 2012 23:15:01 +0000

app-shells/bash:          4.2_p37

dev-java/java-config:     2.1.11-r3

dev-lang/python:          2.7.3-r2, 3.2.3

dev-util/cmake:           2.8.9

dev-util/pkgconfig:       0.27.1

sys-apps/baselayout:      2.1-r1

sys-apps/openrc:          0.9.8.4

sys-apps/sandbox:         2.5

sys-devel/autoconf:       2.68

sys-devel/automake:       1.11.6

sys-devel/binutils:       2.22-r1

sys-devel/gcc:            4.5.4

sys-devel/gcc-config:     1.7.3

sys-devel/libtool:        2.4-r1

sys-devel/make:           3.82-r3

sys-kernel/linux-headers: 3.1 (virtual/os-headers)

sys-libs/glibc:           2.15-r3

Repositories: gentoo

ACCEPT_KEYWORDS="x86"

ACCEPT_LICENSE="* -@EULA dlj-1.1"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"

DISTDIR="/usr/portage/distfiles"

FCFLAGS="-march=i686 -O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS="-march=i686 -O2 -pipe"

GENTOO_MIRRORS="ftp://mirrors.blueyonder.co.uk/mirrors/gentoo/"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

MAKEOPTS="-j4"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY=""

SYNC="rsync://internalserver/gentoo-portage"

USE="acl ads berkdb bzip2 cli cracklib crypt cups cxx dri gdbm gpm hardened iconv ipv6 jpeg modules mudflap mysql ncurses nls nptl openmp pam pax_kernel pcre perl pic png pppd python readline session ssl tcpd truetype unicode urandom x86 zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias cgi" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="apm ark chips cirrus cyrix dummy fbdev glint i128 i740 intel mach64 mga nsc nv r128 radeon rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa via vmware nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

```

However, I am stuck at the vm for which this thread was opened. What is strange is how can I reboot and grub shows the kernel (2.6.28-hardened-r9) and I can login fine. However, I do not seem to have anything inside boot and obviously my kernel Makefile is missing. I have checked the virtual memory of this vm (2GB) which is higher than the other vm (1GB) I just upgraded successfully, so it is not that for sure.

----------

