This is the error I get (output of `emerge -d nvidia-kernel-1.0.5336-r2.ebuild`): <snip> >>> Source unpacked. + cd /var/tmp/portage/nvidia-kernel-1.0.5336-r2 + trap SIGINT SIGQUIT + set +x + /usr/sbin/ebuild.sh compile + dyn_compile + trap abort_compile SIGINT SIGQUIT + '[' '-march=pentium4 -O3 -pipe -fomit-frame-pointer' '!=' unset ']' + export CFLAGS + '[' '-march=pentium4 -O3 -pipe -fomit-frame-pointer' '!=' unset ']' + export CXXFLAGS + '[' unset '!=' unset ']' + '[' unset '!=' unset ']' + '[' unset '!=' unset ']' + '[' unset '!=' unset ']' + '[' unset == unset ']' + export DISTCC_DIR=/var/tmp/.distcc + DISTCC_DIR=/var/tmp/.distcc + '[' '!' -z /var/tmp/.distcc ']' + addwrite /var/tmp/.distcc + export SANDBOX_WRITE=:/dev/shm:/var/tmp:/var/log/portage:/dev/shm:/var/tmp:/var/tmp/ccache:/var/tmp/.distcc + SANDBOX_WRITE=:/dev/shm:/var/tmp:/var/log/portage:/dev/shm:/var/tmp:/var/tmp/ccache:/var/tmp/.distcc + has noauto autoaddcvs ccache fixpackages sandbox userpriv + cd /var/tmp/portage/nvidia-kernel-1.0.5336-r2 + '[' '!' -e build-info ']' + mkdir build-info + cp /usr/portage/media-video/nvidia-kernel/nvidia-kernel-1.0.5336-r2.ebuild build-info/nvidia-kernel-1.0.5336-r2.ebuild + '[' /var/tmp/portage/nvidia-kernel-1.0.5336-r2/.compiled -nt /var/tmp/portage/nvidia-kernel-1.0.5336-r2/work ']' + '[' -d /var/tmp/portage/nvidia-kernel-1.0.5336-r2/work/NVIDIA-Linux-x86-1.0-5336-pkg1/usr/src/nv ']' + cd /var/tmp/portage/nvidia-kernel-1.0.5336-r2/work/NVIDIA-Linux-x86-1.0-5336-pkg1/usr/src/nv + export S D + export PWORKDIR=/var/tmp/portage/nvidia-kernel-1.0.5336-r2/work + PWORKDIR=/var/tmp/portage/nvidia-kernel-1.0.5336-r2/work + src_compile + check_KV + '[' -z 2.4.25-gentoo ']' + is_kernel 2 5 + '[' -z 2 -o -z 5 ']' + get_KV_info + check_version_h + '[' '!' -f //usr/src/linux/include/linux/version.h ']' ++ awk '/UTS_RELEASE/ { gsub("\"", "", $3); print $3 }' //usr/src/linux/include/linux/version.h + export KV_full=2.4.25-gentoo + KV_full=2.4.25-gentoo ++ echo 2.4.25-gentoo ++ cut -d. -f1 + export KV_major=2 + KV_major=2 ++ echo 2.4.25-gentoo ++ cut -d. -f2 + export KV_minor=4 + KV_minor=4 ++ echo 2.4.25-gentoo ++ cut -d. -f3 ++ sed -e 's:[^0-9].*::' + export KV_micro=25 + KV_micro=25 + '[' 2 -eq 2 -a 4 -eq 5 ']' + return 1 + is_kernel 2 6 + '[' -z 2 -o -z 6 ']' + get_KV_info + check_version_h + '[' '!' -f //usr/src/linux/include/linux/version.h ']' ++ awk '/UTS_RELEASE/ { gsub("\"", "", $3); print $3 }' //usr/src/linux/include/linux/version.h + export KV_full=2.4.25-gentoo + KV_full=2.4.25-gentoo ++ echo 2.4.25-gentoo ++ cut -d. -f1 + export KV_major=2 + KV_major=2 ++ echo 2.4.25-gentoo ++ cut -d. -f2 + export KV_minor=4 + KV_minor=4 ++ echo 2.4.25-gentoo ++ cut -d. -f3 ++ sed -e 's:[^0-9].*::' + export KV_micro=25 + KV_micro=25 + '[' 2 -eq 2 -a 4 -eq 6 ']' + return 1 + make IGNORE_CC_MISMATCH=yes KERNDIR=/usr/src/linux clean module Unable to determine kernel version. make: *** [select_makefile] Error 1 + diefunc src_compile 124 2 + local funcname=src_compile lineno=124 exitcode=2 + shift 3 + echo + echo '!!! ERROR: media-video/nvidia-kernel-1.0.5336-r2 failed.' !!! ERROR: media-video/nvidia-kernel-1.0.5336-r2 failed. + echo '!!! Function src_compile, Line 124, Exitcode 2' !!! Function src_compile, Line 124, Exitcode 2 + echo '!!! (no error message)' !!! (no error message) + echo + exit 1 </snip> When removing "userpriv" from FEATURES in make.conf, it works fine.
What happens if you allow group writing in your kernel source repository for the same group userpriv runs portage under.. (by default IIRC portage is the group name).
Got it. It's not the kernel source directory, but the modules directory. From a script of the nvidia package: <snip src="NVIDIA-Linux-x86-1.0-5336-pkg1/usr/src/nv/conftest.sh"> $KERNEL_INCLUDE="/lib/modules/`uname -r`/build/include" [...] gcc conftest.c -o conftest -nostdinc \ -I $KERNEL_INCLUDE > /dev/null 2>&1 </snip> Changing the "/lib/modules/`uname -r`/" directory to "o=rx" solves the problem. This patch solves the hassle: <snip> --- nvidia-kernel-1.0.5336-r3.ebuild.bak 2004-05-11 22:57:18.000000000 +0200 +++ nvidia-kernel-1.0.5336-r3.ebuild 2004-05-11 23:03:11.000000000 +0200 @@ -92,6 +92,10 @@ # if you set this then it's your own fault when stuff breaks :) [ ! -z "${USE_CRAZY_OPTS}" ] && sed -i "s:-O:${CFLAGS}:" Makefile + + # patch to solve userpriv problem, see bug #48224 + cd ${WORKDIR}/NVIDIA-Linux-x86-${NV_V}-pkg1/usr/src/nv + sed -i "s:/lib/modules/\`uname -r\`/build:/usr/src/linux:" conftest.sh } src_compile() { </snip>
Um /lib/modules/`uname -r` on my system is o=rx by default What was yours before changing it?
*** Bug 50751 has been marked as a duplicate of this bug. ***
It's 0700 on all module dirs, although I don't know why, I never changed them manually. (Any ideas?) The module directory no good anyway as a box can have no modules (and therefore no /lib/modules directory). /usr/src/linux or /usr/src/linux-`uname -r` should be the way to go. Cheers, Tobias
You should always run make modules_install, even if you dont have any kernel modules, so that external modules can be installed, nvidia isnt the only extra module that isnt in the kernel. Im working on this, but I have to change a lot of stuff, and none of the working solutions are really sensible to use. (Also been swamped this weekend with course work).
*** Bug 51098 has been marked as a duplicate of this bug. ***
Although I didn't realize it at the time that the problem was the same and that it wasn't related to the change from r2 to r3, I do now. As one of the previous notes said removing userpriv from make.conf allows it to build the module. I want to say thanks for all of your work in sorting through the bug reports that we send in and removing the duplicates, as well as the tremendous work that you do in producing solutions. Several times I have run across problems only to find my answer with a quick search of the bug reports. So kudo's to all of you.
This should work with 2.6.7-pre* and -r3, right?
Nope. The problem is inherit that we want to write to either /var/tmp/kernel/* or /usr/src/linux (which are both root:root) as some user other than root. Short of changing those permissions (which would be a pain to manage) requesting that the user builds without userpriv is about all we can do... I dont really think that constitutes "fixed", but its about as far as we can go towards being fixed so "cantfix" maybe...?
I am missing something - I thought latest kernels do not write to the kernel tree anymore, and it works over here with 2.6.7-rc3-bk* under userpriv ... ? Or is it some magic in kmod.eclass that I am missing??
The problem arises from the "addwrite /usr/src/linux" cases... With userpriv how can we write to that directory?
Right, but check my comment (bit revised): This should work with >=2.6.7-pre* and -r3, right? Meaning, those using older kernel will get the warning + die, and all on current kernels is ok, so we should be able to close this bug ... ?
My first problem were permissions on /lib/modules-dir which were too restrictive (0700). Now with 0755, the next permissioning problem occurs on include files in actual kernel's dir. But the problem imho is read, not write. Question: is emerge with userpriv running as user portage in group portage? Doesn't seem to be the case as changing the permissions to root:portage, rw-,r--,--- does not help. However, changing to rw-,r--,r-- fixes it.
Please check out nvidia-kernel 6106 on bug #55714 (especially comment #29) This problem should be resolved, but I want to check.
Problem solved. I have only read permissions for group portage on kernel tree.
Need to clarify my last comment. Nvidia-6106 emerges fine even with only read perms for group portage on kernel tree.
OK there is a write bug with < 2.6.6 open and the read problem is fixed. Closing.