V4l2loopback cannot find module

Does anyone have any experience using v4l2loopback on NixOS?

I’m getting this error: modprobe: FATAL: Module v4l2loopback not found in directory /run/booted-system/kernel-modules/lib/modules/5.15.89 when running sudo modprobe v4l2loopback exclusive_caps=1 max_buffers=2

uname -a: Linux nixos 5.15.89 #1-NixOS SMP Wed Jan 18 10:48:59 UTC 2023 x86_64 GNU/Linux

Here’s the link to the version of v4l2 that I added to my environment: NixOS Search

I’m following along this video to use my Sony a6400 in OBS: https://www.youtube.com/watch?v=EqrZrKC1WA0

Any help is appreciated!

seems that the derivation should be using the kernel version [source], but looking at the place where the module should be, it’s just not there…

I maybe assumed incorrectly that it would get this version from your system environment, maybe it will get the version from the kernel version file in the repo here which would put the version ahead of mine at 5.15.99 > 5.15.89.

Would it make sense to bump my kernel version in this case? Seems according to the documentation the version headers must match in order for v4l2 to work at all.

It would make sense that the module isn’t where it would be anticipated to be since the kernel versions don’t match, but I’m relatively new to Nix/Linux and don’t want to mess anything up by bumping my kernel version.

I went ahead and updated via nix-channel --update & sudo nixos-rebuild switch --upgrade but I am still getting the same error now with the new kernel version: modprobe: FATAL: Module v4l2loopback not found in directory /run/booted-system/kernel-modules/lib/modules/5.15.99

What do you have in your config? I have the following:

  boot.kernelModules = [ "v4l2loopback" ];
  boot.extraModulePackages = [ pkgs.linuxPackages.v4l2loopback ];

And I also have it in my environment.systemPackages with a comment that’s been there for like a year and I really should get around to finding out…

    linuxPackages.v4l2loopback # uncertain if still needed here..?
1 Like

I’ll give this a try, wasn’t aware I needed anything except for the package itself !

One or all of these was the solution, I added v4l-utils & the boot portion and restarted now it’s working :slight_smile: Thank you ser!


Cool. It wasn’t the utils, they’re just handy.

1 Like

This was the one that I was missing and the one that made it all work. Thanks!