Comment 8 for bug 1991664

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

# Setup
apt install software-properties-common ubuntu-dev-tools
add-apt-repository ppa:canonical-kernel-team/ubuntu/ppa
apt install linux-generic linux-generic-wip dkms=2.8.7-2ubuntu2
pull-lp-debs v4l2loopback kinetic

This installs v5.15 and preliminary v5.19 kernels in a jammy chroot, together with dkms from jammy release pocket.
It also fetches a sample dkms module from kinetic, that supports both kernels.

# apt install ./v4l2loopback-dkms_0.12.7-2ubuntu2_all.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'v4l2loopback-dkms' instead of './v4l2loopback-dkms_0.12.7-2ubuntu2_all.deb'
Suggested packages:
  v4l2loopback-utils
The following NEW packages will be installed:
  v4l2loopback-dkms
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 0 B/29.3 kB of archives.
After this operation, 113 kB of additional disk space will be used.
Get:1 /root/v4l2loopback-dkms_0.12.7-2ubuntu2_all.deb v4l2loopback-dkms all 0.12.7-2ubuntu2 [29.3 kB]
Selecting previously unselected package v4l2loopback-dkms.
(Reading database ... 93941 files and directories currently installed.)
Preparing to unpack .../v4l2loopback-dkms_0.12.7-2ubuntu2_all.deb ...
Unpacking v4l2loopback-dkms (0.12.7-2ubuntu2) ...
Setting up v4l2loopback-dkms (0.12.7-2ubuntu2) ...
Loading new v4l2loopback-0.12.7 DKMS files...
It is likely that 5.15.0-52-generic belongs to a chroot's host
Building for 5.15.0-54-generic and 5.19.0-18-generic
Building initial module for 5.15.0-54-generic
Done.

v4l2loopback.ko:
Running module version sanity check.
 - Original module
 - Installation
   - Installing to /lib/modules/5.15.0-54-generic/updates/dkms/

depmod...
Building initial module for 5.19.0-18-generic
Error! Bad return status for module build on kernel: 5.19.0-18-generic (x86_64)
Consult /var/lib/dkms/v4l2loopback/0.12.7/build/make.log for more information.
dpkg: error processing package v4l2loopback-dkms (--configure):
 installed v4l2loopback-dkms package post-installation script subprocess returned error exit
status 10
Errors were encountered while processing:
 v4l2loopback-dkms
E: Sub-process /usr/local/libexec/mk-sbuild/dpkg returned an error code (1)

# dkms status
v4l2loopback/0.12.7, 5.15.0-54-generic, x86_64: installed

With current dkms, the module is built correctly for v5.15 kernel bug fails for v5.19 kernel.

In the build log we can see that gcc-11 is used to build the module instead of gcc-12.

warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.1.0-2ubuntu1~22.04) 12.1.0
  You are using: cc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0

Upgrade dkms package to the proposed version

# apt install dkms
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  cpp-12 gcc-12 libasan8 libgcc-12-dev libtsan2
Suggested packages:
  gcc-12-locales menu gcc-12-multilib gcc-12-doc
The following NEW packages will be installed:
  cpp-12 gcc-12 libasan8 libgcc-12-dev libtsan2
The following packages will be upgraded:
  dkms
...

Setting up gcc-12 (12.1.0-2ubuntu1~22.04) ...
Setting up dkms (2.8.7-2ubuntu2.1) ...
Setting up v4l2loopback-dkms (0.12.7-2ubuntu2) ...
Removing old v4l2loopback-0.12.7 DKMS files...
Module v4l2loopback-0.12.7 for kernel 5.15.0-54-generic (x86_64).
Before uninstall, this module version was ACTIVE on this kernel.

v4l2loopback.ko:
 - Uninstallation
   - Deleting from: /lib/modules/5.15.0-54-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...
Deleting module v4l2loopback-0.12.7 completely from the DKMS tree.
Loading new v4l2loopback-0.12.7 DKMS files...
It is likely that 5.15.0-52-generic belongs to a chroot's host
Building for 5.15.0-54-generic and 5.19.0-18-generic
Building initial module for 5.15.0-54-generic
Done.

v4l2loopback.ko:
Running module version sanity check.
 - Original module
 - Installation
   - Installing to /lib/modules/5.15.0-54-generic/updates/dkms/

depmod...
Building initial module for 5.19.0-18-generic
Done.

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

depmod...
Processing triggers for libc-bin (2.35-0ubuntu3) ...

# dkms status
v4l2loopback/0.12.7, 5.15.0-54-generic, x86_64: installed
v4l2loopback/0.12.7, 5.19.0-18-generic, x86_64: installed

We observe that the dkms module is built correctly for both v5.15 and v5.19 kernels.

Also we can see that matching toolchain was used for each kernel:

# readelf -p .comment /lib/modules/*/updates/dkms/v4l2loopback.ko

File: /lib/modules/5.15.0-54-generic/updates/dkms/v4l2loopback.ko

String dump of section '.comment':
  [ 1] GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
  [ 2d] GCC: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0

File: /lib/modules/5.19.0-18-generic/updates/dkms/v4l2loopback.ko

String dump of section '.comment':
  [ 1] GCC: (Ubuntu 12.1.0-2ubuntu1~22.04) 12.1.0
  [ 2d] GCC: (Ubuntu 12.1.0-2ubuntu1~22.04) 12.1.0

gcc-11 for v5.15, and gcc-12 for v5.19 kernel.