Comment 5 for bug 438393

Revision history for this message
Pauli Virtanen (pauli-virtanen) wrote :

Possibly -- dkms is currently just su'ing to nobody, which doesn't reset any env vars. The following seems to work, though I'm not sure if something can fail for some modules as nobody's $HOME does not exist:

--- dkms.orig 2009-10-14 22:32:24.882924512 +0300
+++ dkms 2009-10-14 22:41:40.002269942 +0300
@@ -1522,8 +1522,8 @@
     local the_make_command=`echo $make_command | sed "s/^make/make KERNELRELEASE=${kernelver_array[0]}/"`

     #if we're root, try to run as a user instead
- if [ "$USER" = "root" ] && getent passwd nobody 1>/dev/null && su nobody -c "/bin/true" 1>/dev/null; then
- the_make_command="su nobody -c \"$the_make_command\""
+ if [ "$USER" = "root" ] && getent passwd nobody 1>/dev/null && sudo -H -u nobody /bin/true 1>/dev/null; then
+ the_make_command="sudo -H -u nobody /bin/sh -c \"$the_make_command\""
         chmod +x $dkms_tree/$module/$module_version/build
         chown -R nobody $dkms_tree/$module/$module_version/build
     fi