Error installing v4l2loopback-dkms package

I am trying to install the v4l2loopback-dkms package in a debian-10 qube.

My debian-10 qube has kernel version 5.4.98-1.fc25.

During installation it builds the module for kernel versions 4.19.0-13-amd64, 4.19.0-20-amd64, and 5.4.98-1.fc25, though I’m not sure why.

The 4.19 builds succeed, but the 5.4.98-1.fc25 build fails. From the make.log:

DKMS make.log for v4l2loopback-0.12.1 for kernel 5.4.98-1.fc25.qubes.x86_64 (x86_64)
Fri 06 May 2022 11:32:13 AM EDT
Building v4l2-loopback driver...
make -C /lib/modules/5.4.98-1.fc25.qubes.x86_64/build M=/var/lib/dkms/v4l2loopback/0.12.1/build modules
make[1]: Entering directory '/usr/lib/modules/5.4.98-1.fc25.qubes.x86_64/build'
  CC [M]  /var/lib/dkms/v4l2loopback/0.12.1/build/v4l2loopback.o
/var/lib/dkms/v4l2loopback/0.12.1/build/v4l2loopback.c: In function ‘vidioc_qbuf’:
/var/lib/dkms/v4l2loopback/0.12.1/build/v4l2loopback.c:1509:4: error: implicit declaration of function ‘v4l2_get_timestamp’; did you mean ‘v4l2_get_subdevdata’? [-Werror=implicit-function-declaration]
    v4l2_get_timestamp(&b->buffer.timestamp);
    ^~~~~~~~~~~~~~~~~~
    v4l2_get_subdevdata
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:262: /var/lib/dkms/v4l2loopback/0.12.1/build/v4l2loopback.o] Error 1
make[1]: *** [Makefile:1726: /var/lib/dkms/v4l2loopback/0.12.1/build] Error 2
make[1]: Leaving directory '/usr/lib/modules/5.4.98-1.fc25.qubes.x86_64/build'
make: *** [Makefile:43: v4l2loopback.ko] Error 2

Any suggestions on how to deal with this problem?

Can I create a debian-10 using a 4.19... kernel to solve this?

Also there is a bug in v4l2loopback-0.12.1 and it was fixed in newer versions:

1 Like

The simplest solution I know is to use the kernel from Debian, instead of the one from Qubes. There are two steps to achieve this in the pvh mode. First, install grub2-xen-pvh in dom0. Then set the kernel in your template to pvgrub2-pvh: qvm-prefs debian-10 kernel pvgrub2-pvh. Then you can install v4l2loopback-dkms. Don’t forget to change the kernel to the same thing in every vm that uses v4l2loopback. A good practice would also be to clone the template and work with its copy.

As for security of doing this, I have no idea. I don’t think the kernel from Qubes has any additional magic stuff that improves security in most cases.

1 Like

Yes, that turned out to be the simple solution:

Replace the buggy v4l2loopback-dkms-0.12.1 with version 12.5 from sid. Install worked fine, and the video device tested successfully.

Thanks for the info, but I think @tzwcfq led me to a simpler solution.