Public bug reported:

Description of problem
----------------------

"dkms autoinstall" installs DKMS modules in parallel, potentially executing
several depmod instances in parallel.

The resulting race condition causes depmod to fail and dkms install as
well.

This problem is critical because some DKMS modules can be left in "built"
state after a kernel upgrade, thus the kernel modules will not be re-installed
in /lib/modules/.

Ubuntu release
--------------
# lsb_release -rd
Description:    Ubuntu 16.04 LTS
Release:        16.04

DKMS package version
--------------------

# apt-cache policy dkms
dkms:
  Installed: 2.2.0.3-2ubuntu11
  Candidate: 2.2.0.3-2ubuntu11
  Version table:
 *** 2.2.0.3-2ubuntu11 500
        500 http://fr.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://fr.archive.ubuntu.com/ubuntu xenial/main i386 Packages
        100 /var/lib/dpkg/status

Steps to reproduce
------------------

Add 2 simple DKMS modules, mod1 and mod2 (test case in attachment) with
"dkms add", then run "dkms autoinstall".

# dkms add mod1 ; dkms add mod2

Creating symlink /var/lib/dkms/mod1/1.0/source ->
                 /usr/src/mod1-1.0

DKMS: add completed.

Creating symlink /var/lib/dkms/mod2/1.0/source ->
                 /usr/src/mod2-1.0

DKMS: add completed.

# dkms autoinstall

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
.make KERNELRELEASE=4.4.0-28-generic -C /lib/modules/4.4.0-28-generic/build 
SUBDIRS=/var/lib/dkms/mod2/1.0/build S=/var/lib/dkms/mod2/1.0/build modules...
make KERNELRELEASE=4.4.0-28-generic -C /lib/modules/4.4.0-28-generic/build 
SUBDIRS=/var/lib/dkms/mod1/1.0/build S=/var/lib/dkms/mod1/1.0/build modules.....

cleaning build area...cleaning build area.....


DKMS: build completed.

DKMS: build completed.

mod2.ko:
Running module version sanity check.

mod1.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.4.0-28-generic/updates/dkms/
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.4.0-28-generic/updates/dkms/


depmod...depmod.......(bad exit status: 1)

-------- Uninstall Beginning --------
Module:  mod2
Version: 1.0
Kernel:  4.4.0-28-generic (x86_64)
-------------------------------------


DKMS: install completed.

Status: Before uninstall, this module version was ACTIVE on this kernel.

mod2.ko:
 - Uninstallation
   - Deleting from: /lib/modules/4.4.0-28-generic/updates/dkms/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod....

DKMS: uninstall completed.
Error! Problems with depmod detected.  Automatically uninstalling this module.
DKMS: Install Failed (depmod problems).  Module rolled back to built state.

root@ubuntu1604:~/dkms-depmod# dkms status
mod1, 1.0, 4.4.0-28-generic, x86_64: installed
mod2, 1.0, 4.4.0-28-generic, x86_64: built

=> mod2 should be in "installed" state as well.

# modinfo mod1
filename:       /lib/modules/4.4.0-28-generic/updates/dkms/mod1.ko
author:         6WIND
license:        GPL
srcversion:     8D30BAE7A8F4D38F20AEB57
depends:        
vermagic:       4.4.0-28-generic SMP mod_unload modversions 

# modinfo mod2
modinfo: ERROR: Module mod2 not found.

Solution
--------

The problem is fixed in dkms official repository by commit
https://github.com/dell-oss/dkms/commit/00114cbc0a1f8c0aa5143808205d1a7cc9e58d3b
(also in attachment).

** Affects: dkms (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "Example test case"
   
https://bugs.launchpad.net/bugs/1608499/+attachment/4711505/+files/test_case.tar.gz

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to dkms in Ubuntu.
https://bugs.launchpad.net/bugs/1608499

Title:
  Parallel depmod failure with dkms autoinstall

Status in dkms package in Ubuntu:
  New

Bug description:
  Description of problem
  ----------------------

  "dkms autoinstall" installs DKMS modules in parallel, potentially executing
  several depmod instances in parallel.

  The resulting race condition causes depmod to fail and dkms install as
  well.

  This problem is critical because some DKMS modules can be left in "built"
  state after a kernel upgrade, thus the kernel modules will not be re-installed
  in /lib/modules/.

  Ubuntu release
  --------------
  # lsb_release -rd
  Description:  Ubuntu 16.04 LTS
  Release:      16.04

  DKMS package version
  --------------------

  # apt-cache policy dkms
  dkms:
    Installed: 2.2.0.3-2ubuntu11
    Candidate: 2.2.0.3-2ubuntu11
    Version table:
   *** 2.2.0.3-2ubuntu11 500
          500 http://fr.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
          500 http://fr.archive.ubuntu.com/ubuntu xenial/main i386 Packages
          100 /var/lib/dpkg/status

  Steps to reproduce
  ------------------

  Add 2 simple DKMS modules, mod1 and mod2 (test case in attachment) with
  "dkms add", then run "dkms autoinstall".

  # dkms add mod1 ; dkms add mod2

  Creating symlink /var/lib/dkms/mod1/1.0/source ->
                   /usr/src/mod1-1.0

  DKMS: add completed.

  Creating symlink /var/lib/dkms/mod2/1.0/source ->
                   /usr/src/mod2-1.0

  DKMS: add completed.

  # dkms autoinstall

  Kernel preparation unnecessary for this kernel.  Skipping...

  Building module:
  cleaning build area...
  Kernel preparation unnecessary for this kernel.  Skipping...

  Building module:
  cleaning build area....
  .make KERNELRELEASE=4.4.0-28-generic -C /lib/modules/4.4.0-28-generic/build 
SUBDIRS=/var/lib/dkms/mod2/1.0/build S=/var/lib/dkms/mod2/1.0/build modules...
  make KERNELRELEASE=4.4.0-28-generic -C /lib/modules/4.4.0-28-generic/build 
SUBDIRS=/var/lib/dkms/mod1/1.0/build S=/var/lib/dkms/mod1/1.0/build modules.....

  cleaning build area...cleaning build area.....

  
  DKMS: build completed.

  DKMS: build completed.

  mod2.ko:
  Running module version sanity check.

  mod1.ko:
  Running module version sanity check.
   - Original module
     - No original module exists within this kernel
   - Installation
     - Installing to /lib/modules/4.4.0-28-generic/updates/dkms/
   - Original module
     - No original module exists within this kernel
   - Installation
     - Installing to /lib/modules/4.4.0-28-generic/updates/dkms/

  
  depmod...depmod.......(bad exit status: 1)

  -------- Uninstall Beginning --------
  Module:  mod2
  Version: 1.0
  Kernel:  4.4.0-28-generic (x86_64)
  -------------------------------------

  
  DKMS: install completed.

  Status: Before uninstall, this module version was ACTIVE on this
  kernel.

  mod2.ko:
   - Uninstallation
     - Deleting from: /lib/modules/4.4.0-28-generic/updates/dkms/
   - Original module
     - No original module was found for this module on this kernel.
     - Use the dkms install command to reinstall any previous module version.

  depmod....

  DKMS: uninstall completed.
  Error! Problems with depmod detected.  Automatically uninstalling this module.
  DKMS: Install Failed (depmod problems).  Module rolled back to built state.

  root@ubuntu1604:~/dkms-depmod# dkms status
  mod1, 1.0, 4.4.0-28-generic, x86_64: installed
  mod2, 1.0, 4.4.0-28-generic, x86_64: built

  => mod2 should be in "installed" state as well.

  # modinfo mod1
  filename:       /lib/modules/4.4.0-28-generic/updates/dkms/mod1.ko
  author:         6WIND
  license:        GPL
  srcversion:     8D30BAE7A8F4D38F20AEB57
  depends:        
  vermagic:       4.4.0-28-generic SMP mod_unload modversions 

  # modinfo mod2
  modinfo: ERROR: Module mod2 not found.

  Solution
  --------

  The problem is fixed in dkms official repository by commit
  
https://github.com/dell-oss/dkms/commit/00114cbc0a1f8c0aa5143808205d1a7cc9e58d3b
  (also in attachment).

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dkms/+bug/1608499/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to