Modprobe: ERROR: could not insert 'v4l2loopback': Key was rejected by service

I am trying to use OBS Studio Virtual camera, so I installed v4l2loopback and rebooted.

When I try to start the virtual camera I was asked for the password but the virtual camera wasn’t activated.

Then I tried running sudo modprobe v4l2loopback and got the error in the topic heading.

Any clues on how to xolve this issue?

You most likely have Secure Boot enabled. As the module is not signed, the kernel refuses to load it.

You have two options:

  1. disable Secure Boot
  2. self-sign the module
1 Like

I used this on Ubuntu and I didn’t have to do either of the two. I do have Secure Boot enabled and I chose Fedora because it is one of the very few distros that work with it enabled.
I remember having to install a package named v4l2loopback-dkms on Ubuntu. Is there an equivalent on Fedora? I search for a package with the same name but to no avail.

I followed this tutorial and managed to make it work. I hope it doesn’t break when the kernel is updated.
I wouldn’t have managed alone for sure: it is beyond my current linux skill set.

1 Like

As I suspected, every kernel upgrade breaks the module signature. Is there a way to automate the module signing after each kernel upgrade?

It seems support for secure boot was added to akmods in a October 2021 commit. (See also recent github issue comment.)

Instructions here: /usr/share/doc/akmods/README.secureboot.

Here’s two screenshots showing the screens that will present themselves the next time you reboot to enroll the public key in MOK (Machine Owner Key key management system) :

image

image

Excerpt from journal shows that the v4l2loopback module was successfully built and installed:

Sep 06 09:20:48 hx90 systemd[1]: Starting akmods@5.19.7-200.fc36.x86_64.service - Builds and install new kmods from akmod for a given kernel...
Sep 06 09:20:48 hx90 systemd-inhibit[35589]: Checking kmods exist for 5.19.7-200.fc36.x86_64[  OK  ]
[...]
Sep 06 09:20:59 hx90 systemd-inhibit[35589]: Building and installing v4l2loopback-kmod[  OK  ]
Sep 06 09:20:59 hx90 systemd[1]: Finished akmods@5.19.7-200.fc36.x86_64.service - Builds and install new kmods from akmod for a given kernel.

Check that the v4l2loopback module was loaded

$ lsmod | grep -F v4l2loopback
v4l2loopback           45056  0
videodev              274432  4 videobuf2_v4l2,v4l2loopback,uvcvideo,videobuf2_common

If necessary, load it manually:

sudo modprobe v4l2loopback

To unload:

sudo modprobe -r v4l2loopback
1 Like

I followed this procedure but now I’m getting this error in the logs:
Failed to insert module 'v4l2loopback': Key was rejected by service
What am I doing wrong?
I had manually installed and self-signed v4l2loopback which worked until the kernel was updated.
I didn’t uninstall this manual version and don’t know how to.