Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 48224 - nvidia-kernel 5336-r2 unable to determine kernel version with userpriv
Summary: nvidia-kernel 5336-r2 unable to determine kernel version with userpriv
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All All
: High normal
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
: 50751 51098 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-04-18 08:16 UTC by Tobias Sager
Modified: 2004-07-17 00:02 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Sager 2004-04-18 08:16:24 UTC
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.
Comment 1 Andrew Bevitt 2004-05-10 20:56:27 UTC
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).
Comment 2 Tobias Sager 2004-05-11 14:03:48 UTC
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>
Comment 3 Andrew Bevitt 2004-05-11 17:52:59 UTC
Um /lib/modules/`uname -r` on my system is o=rx by default

What was yours before changing it?
Comment 4 Andrew Bevitt 2004-05-11 18:14:00 UTC
*** Bug 50751 has been marked as a duplicate of this bug. ***
Comment 5 Tobias Sager 2004-05-11 23:53:23 UTC
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
Comment 6 Andrew Bevitt 2004-05-15 19:06:36 UTC
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).
Comment 7 Andrew Bevitt 2004-05-15 19:07:12 UTC
*** Bug 51098 has been marked as a duplicate of this bug. ***
Comment 8 Robert T Childers 2004-05-16 16:27:23 UTC
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.
Comment 9 Martin Schlemmer (RETIRED) gentoo-dev 2004-06-15 14:13:26 UTC
This should work with 2.6.7-pre* and -r3, right?
Comment 10 Andrew Bevitt 2004-06-15 17:33:59 UTC
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...?
Comment 11 Martin Schlemmer (RETIRED) gentoo-dev 2004-06-16 06:37:38 UTC
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??
Comment 12 Andrew Bevitt 2004-06-16 07:20:59 UTC
The problem arises from the "addwrite /usr/src/linux" cases...

With userpriv how can we write to that directory?
Comment 13 Martin Schlemmer (RETIRED) gentoo-dev 2004-06-16 09:05:45 UTC
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 ... ?
Comment 14 Tobias Sager 2004-06-18 14:47:28 UTC
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.
Comment 15 Andrew Bevitt 2004-06-30 23:22:44 UTC
Please check out nvidia-kernel 6106 on bug #55714 (especially comment #29) 

This problem should be resolved, but I want to check.
Comment 16 Tobias Sager 2004-07-03 02:17:11 UTC
Problem solved. I have only read permissions for group portage on kernel tree.
Comment 17 Tobias Sager 2004-07-03 02:18:27 UTC
Need to clarify my last comment.

Nvidia-6106 emerges fine even with only read perms for group portage on kernel tree.
Comment 18 Andrew Bevitt 2004-07-17 00:02:55 UTC
OK there is a write bug with < 2.6.6 open and the read problem is fixed.

Closing.