# Cannot install any kernel sources; very weird

## Tatsh

Basically,

```
# emerge xen-sources

```

and (what I hope to switch to)

```
# emerge hardened-sources

```

and there is not any useful information in the build log. They get to the point of installing, but it is impossible to do `make menuconfig`.

```
# make -j2 menuconfig

scripts/kconfig/mconf Kconfig

init/Kconfig:375: can't open file "kernel/irq/Kconfig"

make[1]: *** [menuconfig] Error 1

make: *** [menuconfig] Error 2

```

Build log is simply where Portage stopped. http://paste.pocoo.org/show/522603/

Anyone encountered this? I really don't know what I did wrong here. I've never seen this before.

----------

## tomtom69

Hi,

are you sure you are in the correct subdir when you use "make menuconfig"?

not /usr/src/linux, but /usr/src/linux-(whatever version)-gentoo-(whatever revision)...

Do you have the subdir kernel/irq in your kernel source subdir? (every kernel sources I know have this subdir and a file named "Kconfig" in it)

tom

----------

## Tatsh

 *tomtom69 wrote:*   

> Hi,
> 
> are you sure you are in the correct subdir when you use "make menuconfig"?
> 
> not /usr/src/linux, but /usr/src/linux-(whatever version)-gentoo-(whatever revision)...
> ...

 

Plenty of Kconfig files but not irq/Kconfig:

```
find -name Kconfig | grep irq
```

within /usr/src returns nothing.

----------

## Hu

What is the output of ls -l /usr/src/linux*?  Did you intend to use a root shell to build the kernel?  This is neither required nor recommended.

----------

## Tatsh

 *Hu wrote:*   

> What is the output of ls -l /usr/src/linux*?  Did you intend to use a root shell to build the kernel?  This is neither required nor recommended.

 

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

lrwxrwxrwx  1 root root   23 Dec 18 12:44 /usr/src/linux -> linux-3.0.4-hardened-r5

/usr/src/linux-2.6.38-xen:

total 472

-rw-r--r--  1 root root  18693 Mar 14  2011 COPYING

-rw-r--r--  1 root root  93910 Mar 14  2011 CREDITS

drwxr-xr-x 90 root root  12288 Dec 18 12:13 Documentation

-rw-r--r--  1 root root   2464 Mar 14  2011 Kbuild

-rw-r--r--  1 root root    252 Mar 14  2011 Kconfig

-rw-r--r--  1 root root 191678 Dec 18 12:12 MAINTAINERS

-rw-r--r--  1 root root  52128 Dec 18 12:12 Makefile

-rw-r--r--  1 root root  17512 Mar 14  2011 README

-rw-r--r--  1 root root   3371 Mar 14  2011 REPORTING-BUGS

drwxr-xr-x 26 root root   4096 Dec 18 12:13 arch

drwxr-xr-x  2 root root   4096 Dec 18 12:13 block

drwxr-xr-x 10 root root   4096 Dec 18 12:13 drivers

drwxr-xr-x 37 root root   4096 Dec 18 12:13 firmware

drwxr-xr-x 70 root root   4096 Dec 18 12:13 fs

drwxr-xr-x 21 root root   4096 Dec 18 12:13 include

drwxr-xr-x  2 root root   4096 Dec 18 12:13 init

drwxr-xr-x  2 root root   4096 Dec 18 12:13 ipc

drwxr-xr-x  8 root root   4096 Dec 18 12:13 lib

drwxr-xr-x  2 root root   4096 Dec 18 12:13 mm

drwxr-xr-x 53 root root   4096 Dec 18 12:13 net

drwxr-xr-x  9 root root   4096 Dec 18 12:13 samples

drwxr-xr-x 13 root root   4096 Dec 18 12:13 scripts

drwxr-xr-x  8 root root   4096 Dec 18 12:13 security

drwxr-xr-x 21 root root   4096 Dec 18 12:13 sound

drwxr-xr-x  3 root root   4096 Dec 18 12:13 virt

/usr/src/linux-3.0.4-hardened-r5:

total 488

-rw-r--r--  1 root root  18693 Jul 21 22:17 COPYING

-rw-r--r--  1 root root  94495 Jul 21 22:17 CREDITS

drwxr-xr-x 93 root root  12288 Dec 18 12:39 Documentation

-rw-r--r--  1 root root   2464 Jul 21 22:17 Kbuild

-rw-r--r--  1 root root    252 Jul 21 22:17 Kconfig

-rw-r--r--  1 root root 195191 Jul 21 22:17 MAINTAINERS

-rw-r--r--  1 root root  55688 Dec 18 12:38 Makefile

-rw-r--r--  1 root root  17459 Jul 21 22:17 README

-rw-r--r--  1 root root   3371 Jul 21 22:17 REPORTING-BUGS

drwxr-xr-x 26 root root   4096 Dec 18 12:39 arch

drwxr-xr-x  2 root root   4096 Dec 18 12:39 block

drwxr-xr-x 20 root root   4096 Dec 18 12:39 drivers

drwxr-xr-x 38 root root   4096 Dec 18 12:39 firmware

drwxr-xr-x 71 root root   4096 Dec 18 12:39 fs

drwxr-xr-x  2 root root   4096 Dec 18 12:39 grsecurity

drwxr-xr-x 22 root root   4096 Dec 18 12:45 include

drwxr-xr-x  2 root root   4096 Dec 18 12:39 init

drwxr-xr-x  2 root root   4096 Dec 18 12:39 ipc

drwxr-xr-x  8 root root   4096 Dec 18 12:39 lib

drwxr-xr-x  2 root root   4096 Dec 18 12:39 mm

drwxr-xr-x 53 root root   4096 Dec 18 12:39 net

drwxr-xr-x 10 root root   4096 Dec 18 12:39 samples

drwxr-xr-x 13 root root   4096 Dec 18 12:39 scripts

drwxr-xr-x  8 root root   4096 Dec 18 12:39 security

drwxr-xr-x 22 root root   4096 Dec 18 12:39 sound

drwxr-xr-x  3 root root   4096 Dec 18 12:39 virt

```

It is not complete. And installation always fails like in my original log.

```
# qcheck xen-sources | grep are\ good

  * 25547 out of 38500 files are good

```

----------

## Goverp

Run out of space?

----------

## Aquous

Please post your /etc/make.conf.

----------

## Tatsh

 *Aquous wrote:*   

> Please post your /etc/make.conf.

 

```
# These settings were set by the catalyst build script that automatically

# built this stage.

# Please consult /usr/share/portage/config/make.conf.example for a more

# detailed example.

CFLAGS="-march=native -msse2 -O2 -pipe"

# CFLAGS="-march=nocona -O2 -pipe"

CXXFLAGS="${CFLAGS}"

# WARNING: Changing your CHOST is not something that should be done lightly.

# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.

CHOST="x86_64-pc-linux-gnu"

# These are the USE flags that were used in addition to what is provided by the

# profile used for building.

USE="mmx sse sse2"

MAKEOPTS="-j2"

USE="-alsa -oss -berkdb -bluetooth -debug -gtk -gnome -kde -qt -qt3 -qt4 -ipv6 -ldap -oss -pulseaudio -qt3 -xscreensaver"

USE="$USE 3dnow bash-completion cjk ipv6 sse3 unicode vim-syntax"

# USE="png jpeg -X -qt -kde -gtk -gnome -oss -alsa -qt3 -qt4 -debug"

SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"

LINGUAS="en_GB"

NGINX_MODULES_HTTP="access auth_basic autoindex browser charset empty_gif fastcgi geo gzip headers limit_req limit_zone memcached proxy referer rewrite scgi split_clients ssi upstream_ip_hash userid uwsgi flv gzip_static image_filter stub_status xslt headers_more sub dav map perl geoip"

NGINX_MODULES_MAIL="smtp"

ACCEPT_LICENSE="*"

GENTOO_MIRRORS="http://mirror.mcs.anl.gov/pub/gentoo/ rsync://mirror.mcs.anl.gov/gentoo/ ftp://mirror.mcs.anl.gov/pub/gentoo/ ftp://gentoo.chem.wisc.edu/gentoo/ rsync://gentoo.chem.wisc.edu/gentoo/ http://gentoo.chem.wisc.edu/gentoo/ http://mirrors.cs.wmich.edu/gentoo http://www.cyberuse.com/gentoo/ http://mirror.datapipe.net/gentoo ftp://mirror.datapipe.net/gentoo http://gentoo.mirrors.easynews.com/linux/gentoo/ http://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/ ftp://chi-10g-1-mirror.fastsoft.net/pub/linux/gentoo/gentoo-distfiles/ http://www.gtlib.gatech.edu/pub/gentoo rsync://rsync.gtlib.gatech.edu/gentoo ftp://ftp.gtlib.gatech.edu/pub/gentoo http://gentoo.mirrors.hoobly.com/ ftp://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://distro.ibiblio.org/pub/linux/distributions/gentoo/ rsync://distro.ibiblio.org/pub/linux/distributions/gentoo/ ftp://ftp.ussg.iu.edu/pub/linux/gentoo http://lug.mtu.edu/gentoo/ ftp://lug.mtu.edu/gentoo/ ftp://gentoo.netnitco.net/pub/mirrors/gentoo/source/ http://gentoo.netnitco.net http://gentoo.osuosl.org/ rsync://mirrors.rit.edu/gentoo/ ftp://mirrors.rit.edu/gentoo/ http://mirrors.rit.edu/gentoo/ ftp://mirror.iawnet.sandia.gov/pub/gentoo/ ftp://gentoo.llarian.net/pub/gentoo http://gentoo.llarian.net/ ftp://gentoo.mirrors.tds.net/gentoo rsync://gentoo.mirrors.tds.net/gentoo http://gentoo.mirrors.tds.net/gentoo http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/ ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/ ftp://ftp.lug.udel.edu/pub/gentoo/ http://mirror.lug.udel.edu/pub/gentoo/ ftp://mirror.its.uidaho.edu/gentoo/ http://mirror.its.uidaho.edu/pub/gentoo/ http://gentoo.cites.uiuc.edu/pub/gentoo/ ftp://gentoo.cites.uiuc.edu/pub/gentoo/ rsync://gentoo.cs.uni.edu/gentoo-distfiles http://gentoo.cs.uni.edu/ http://mirror.usu.edu/mirrors/gentoo/ ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org"
```

This is for a web server.

Goverp, says 53% used so I'm sure I have the space.

----------

## tomtom69

You are missing some subdirs from the kernel sources which are normally included in the packages.

At least there is missing:

- kernel

- usr

- tools

I would recommend to delete the archives in /usr/portage/distfiles, re-download and unpack them. It looks like there is something missing in the packages or something goes wrong during unpacking...

----------

## Tatsh

 *tomtom69 wrote:*   

> You are missing some subdirs from the kernel sources which are normally included in the packages.
> 
> At least there is missing:
> 
> - kernel
> ...

 

Tried that. Even changed the mirrors.

```
>>> Installing (1 of 1) sys-kernel/xen-sources-2.6.38

>>> Failed to install sys-kernel/xen-sources-2.6.38, Log file:

>>>  '/var/tmp/portage/sys-kernel/xen-sources-2.6.38/temp/build.log'

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

```

It's so weird. There's no useful information in that log whatsoever. It's just like the one I pasted in the original post.

----------

## tomtom69

this is really weird.

Why does 'install' fail?

Do you really have enough disk space at the partition(s) where /var and /usr are mounted? When it´s a web server maybe /var and /usr use different partitions and one of them runs out of space.

Did you try to clean the target subdirs /var/tmp/portage/sys-kernel/xen-sources-2.6.38 and /usr/src/xen-sources-2.6.38 completely with rm -rf before emerging the kernel sources?

Another cause could be a corrupted file system hat needs an fsck.

----------

## Tatsh

 *tomtom69 wrote:*   

> this is really weird.
> 
> Why does 'install' fail?
> 
> Do you really have enough disk space at the partition(s) where /var and /usr are mounted? When it´s a web server maybe /var and /usr use different partitions and one of them runs out of space.
> ...

 

I did transfer this image via dd and ssh over the web. It might be that I need to do an fsck indeed.

----------

## Tatsh

Solved this. It was due to lack of RAM. After a successful install via a rescue boot, and rebooting, I did:

```

swapon /dev/sda2 # for some reason not on

/etc/init.d/php-fpm stop

emerge -C hardened-sources

emerge hardened-sources

```

It wasn't until after the reboot that Portage gave a Python traceback which had an obvious message:

```

>>> Installing (1 of 1) sys-kernel/hardened-sources-3.0.4-r5

Traceback (most recent call last):

  File "/usr/lib64/portage/pym/portage/dbapi/vartree.py", line 1724, in unmerge

    phase.start()

  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 24, in start

    self._start()

  File "/usr/lib64/portage/pym/_emerge/EbuildPhase.py", line 115, in _start

    self._start_task(env_extractor, self._env_extractor_exit)

  File "/usr/lib64/portage/pym/_emerge/CompositeTask.py", line 146, in _start_task

    task.start()

  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 24, in start

    self._start()

  File "/usr/lib64/portage/pym/_emerge/BinpkgEnvExtractor.py", line 43, in _start

    self._start_task(extractor_proc, self._extractor_exit)

  File "/usr/lib64/portage/pym/_emerge/CompositeTask.py", line 146, in _start_task

    task.start()

  File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 24, in start

    self._start()

  File "/usr/lib64/portage/pym/_emerge/SpawnProcess.py", line 123, in _start

    retval = self._spawn(self.args, **kwargs)

  File "/usr/lib64/portage/pym/_emerge/SpawnProcess.py", line 159, in _spawn

    return spawn_func(args, **kwargs)

  File "/usr/lib64/portage/pym/portage/process.py", line 245, in spawn

    pid = os.fork()

  File "/usr/lib64/portage/pym/portage/__init__.py", line 215, in __call__

    rval = self._func(*wrapped_args, **wrapped_kwargs)

OSError: [Errno 12] Cannot allocate memory

```

----------

## tclover

Why the `-j2' for menuconfig!? Try without that thing, it should work.

----------

