I tried to compile a module on Debian 10 (v4l2loopback) like this:

sudo apt-get install linux-headers-$(uname -r)
git clone https://github.com/umlaeute/v4l2loopback.git
cd v4l2loopback/
make -j4
sudo make install
sudo modprobe v4l2loopback

This gives me an error

modprobe: ERROR: could not insert 'v4l2loopback': Exec format error

I tried to find out what is wrong. (There are some issues regarding this problem, e.g. https://github.com/umlaeute/v4l2loopback/issues/208 or https://github.com/umlaeute/v4l2loopback/issues/296, but I think the problem is related to my system configuration, not to v4l2loopback).

1. check dmesg

I do not know what this means:

[   48.264449] v4l2loopback: loading out-of-tree module taints kernel.
[   48.264505] v4l2loopback: module verification failed: signature and/or required key missing - tainting kernel
[   48.264610] module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 00000000d85e721d, val ffffffffc0ba115b

2. Check if kernel-headers match kernel installation

From the following output, I think both match:

$ sudo modinfo v4l2loopback 
filename:       /lib/modules/4.19.0-2-amd64/extra/v4l2loopback.ko
license:        GPL
author:         Vasily Levin, IOhannes m zmoelnig <zmoelnig@iem.at>,Stefan Diewald,Anton Novikovet al.
description:    V4L2 loopback video device
depends:        videodev
retpoline:      Y
name:           v4l2loopback
vermagic:       4.19.0-2-amd64 SMP mod_unload modversions

$ uname -a
Linux pingu1 4.19.0-2-amd64 #1 SMP Debian 4.19.16-1 (2019-01-17) x86_64 GNU/Linux

So this is not the problem.

3. Is the toolchain used to build the module the same as the toolchain used to build the kernel?

The kernel seems to be build with gcc version 8.2.0:

$ cat /proc/version
Linux version 4.19.0-2-amd64 (debian-kernel@lists.debian.org) (gcc version 8.2.0 (Debian 8.2.0-14)) #1 SMP Debian 4.19.16-1 (2019-01-17)

I do not know how to find out what was used to build the module. My best guess is:

$ gcc --version
gcc (Debian 8.3.0-6) 8.3.0

So it is 8.2.0 versus 8.3.0. This is a minor version change, which should not break anything.

4. Run depmod before modprobe

This did not make a difference. I think I did not make a difference because the module in concern has no dependencies.

Can someone help on what to do next?


I could solve my problem:

sudo apt-get install linux-image-4.19.0-6-amd64-unsigned linux-headers-4.19.0-6-amd64
cd v4l2loopback/
make clean
sudo make install
sudo depmod
sudo modprobe v4l2loopback

Note that you need sudo depmod, otherwise the kernel module won't be found.

Hence, the crucial error from dmesg seemed to be

v4l2loopback: module verification failed: signature and/or required key missing - tainting kernel

If I am right, you need an unsigned kernel, as v4l2loopback is not signed.

  • I have already said to run sudo depmod before modprobe .
    – GAD3R
    Apr 26 '20 at 21:09
  • You were right. However, the main problem was module verification failed, so when we discussed depmod it failed. Only when module verifaction failedwas solved because of an unept kernel, I found out that depmod is indeed necessary.
    – Markus
    Apr 28 '20 at 12:30
  • Disabling the secure boot may solve the module signature problem, could you try it in the signed kernel? please.
    – GAD3R
    Apr 28 '20 at 12:33
  • It also works in the signed kernel 4.19.0-8-amd64. Hence it is independent of signature. Maybe my setup was messed up...
    – Markus
    Apr 28 '20 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.