# Poudriere + CCACHE - broken kernel build



## elpek (Feb 26, 2014)

Hello everyone,

I have a problem with building custom kernel package using Poudriere. This is the most important part of the Makefile I use (probably it can be done in many different ways):


```
WRKSRC=         ${WRKDIR}/usr/src
PREFIX=         /
ALL_TARGET=     buildkernel installkernel
MAKE_ARGS=      KERNCONF=KERNELCONFIG INSTKERNNAME=customkernel DESTDIR=${WRKDIR} WITHOUT_MODULES="xfs linux ntfs" SRCCONF=/dev/null __MAKECONF=/dev/null

NO_STAGE=
NO_CCACHE=

pre-patch:
        ${CP} ${FILESDIR}/KERNELCONFIG  ${WRKSRC}/sys/amd64/conf/

do-install:
        ${CP} -a ${WRKDIR}/boot/customkernel/ /boot/customkernel;
        @(cd /; ${FIND} -s boot/customkernel -not -type d) >> ${TMPPLIST}
        @(cd /; ${FIND} -s -d boot/customkernel -type d) | ${SED} -ne "s,^,@dirrm ,p" >> ${TMPPLIST}
```

The package builds fine, however when I install it, the server won't boot giving the following error:


```
Trying to mount root from zfs:tank0/ROOT/basefs []...
Mounting from tank0/ROOT/basefs failed with error 45.
```

After quick research I found that the problem is related to CCACHE used by Poudriere. Temporarily commenting out CCACHE_DIR in poudriere.conf doesn't do the trick and I end up with a broken kernel, NO_CCACHE option in Makefile doesn't help either. The only way to have a working kernel package is to build it on a fresh system with no CCACHE_DIR defined in poudriere.conf from the very beginning. but I often use meta packages and want to have all the packages built and hosted on a single machine in the repo.

Any help would be greatly appreciated.


----------

