DKMS fails to build if a restrictive umask is set

Bug #436039 reported by Pauli Virtanen
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
dkms (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: dkms

DKMS in Ubuntu Karmic (2.1.0.1-0ubuntu1) apparently doesn't set umask when it is run.

Having umask 027 when doing "dpkg-reconfigure nvidia-185-kernel-source" resulted to permissions in /var/lib/dkms:

drwxr-x--- 3 root root 4096 2009-09-24 19:41 nvidia/

which made the build of the module to fail with permission errors. Fixing the permissions with "chmod a+rX" makes the build work again.

This kind of problems can easily occur when sudo'ing to run dkms (or dpkg-reconfigure, or, apt-get upgrade), since sudo does not reset the user umask.

Related branches

Revision history for this message
Mario Limonciello (superm1) wrote :

So it's already explicitly doing this:

    #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\""
        chmod +x $dkms_tree/$module/$module_version/build
        chown -R nobody $dkms_tree/$module/$module_version/build
    fi

How could that be failing? What about your situation is different?

Changed in dkms (Ubuntu):
status: New → Incomplete
Revision history for this message
Pauli Virtanen (pauli-virtanen) wrote :

The above does not set the permissions of the $dkms_tree/$module directory, so any directories below it cannot be accessed.

Changed in dkms (Ubuntu):
status: Incomplete → New
Revision history for this message
Pauli Virtanen (pauli-virtanen) wrote :

And again, umask is set in /home/pauli/.bashrc where sudo seems to pick it up from.

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

Simplest possible fix attached.

summary: - dkms umask problems
+ DKMS fails to build if a restrictive umask is set
Changed in dkms (Ubuntu):
status: New → Fix Committed
Revision history for this message
Mario Limonciello (superm1) wrote :

Pauli:

I've committed your patch. Sorry for the delay. It will be in the next Lucid upload

http://linux.dell.com/git/?p=dkms.git;a=commit;h=ff363e508016da5912566ee2138200d2636835ed

Thanks!

Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (3.3 KiB)

This bug was fixed in the package dkms - 2.1.1.0-0ubuntu1

---------------
dkms (2.1.1.0-0ubuntu1) lucid; urgency=low

  [ Mario Limonciello ]
  * New upstream version
  * dkms_autoinstall: Minor logic cleanups from submitted patches.
  * dkms_autoinstall: Run under dash since dkms.conf isn't sourced anymore.
  * dkms_autoinstall: Whitespace cleanup.
  * Convert DKMS to an upstart script that starts up before GDM or KDM can
    start. This ensures that drivers are built before X tries to start.
    (LP: #453365)
  * dkms_autoinstall: Rather than having if/else clauses all over the script,
    stub out any functions that aren't provided on Debian/Ubuntu when
    /etc/debian_version isn't present.
  * dkms_autoinstall: Exit immediately if this script is present but DKMS
    isn't anymore rather than sourcing functions and then exiting.
  * kernel_postinst.d_dkms: Launch the upstart script instead. In the process
    all output will be going to /var/log/dkms_autoinstaller (LP: #292606)
  * dkms_autoinstall: Don't ever output to stdout, even with kernel parameters.
  * dkms_autoinstall: Don't log the situation that we already have everything
    installed that needs to be.
  * dkms_autoinstall: Rather than logging to /var/log/dkms_autoinstaller,
    use logger to log to syslog during build and install.
  * dkms_autoinstall: Clean up the method to get arch. These hacks shouldn't
    be necessary. If you have problems with them gone, file a bug and we'll
    fix them more cleanly.
  * dkms_autoinstall: Notate the kernel we are building a module against
    when building it.
  * debian/rules: Don't attempt to stop DKMS on upgrades. It's a task, not
    a daemon, so stop wouldn't do anything.
  * Makefile: Install the old initscript to /usr/lib so that different distros
    can migrate to upstart at their leisure.
  * Makefile: Move any debian specific calls into the Makefile.
  * dkms: Revert the code that runs DKMS as the user "nobody".
    - It's causing problems with people with nonstandard PAM configs because it
      uses "su". (LP: #484725)
    - Also people have reported that nothing should be owned by 'nobody' per
      Debian & Ubuntu policy. This could have been fixed by creating a DKMS
      user, but that still wouldn't solve the problems with using 'su'.
  * dkms: Emit built-module MODULE=foo if initctl is available on the system
    after done building a module.
  * Add a special apport package-hook for when package builds fail to try
    to report them against the package providing that DKMS package.
    (LP: #484871)

  [ Alberto Milone ]
  * dkms_common.postinst: try to build the module for the most recent
    kernel in addition to building it for the current kernel (LP: #474917).

  [ Steve Langasek ]
  * dkms_autoinstall: optimize with a single find call instead of multiple
    loops with ls. (LP: 3484386)
  * dkms_autoinstall: drop localization of the usage message - this is
    inconsistent with all other init scripts on the system.

  [ Pauli Virtanen ]
  * Remove dependence from environment's umask and certain environment
    variables. (LP: #438393, #436039)

  [ Giuseppe Iuculano ]
  * dkms_autoinstall: Correct the prov...

Read more...

Changed in dkms (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.