Can't install v4l2loopback (for droidcam)

I want to install droidcam to use my android phone as a webcam. I followed the instructions on the fedora magazine article (4 cool new projects to try in Copr from July 2021 - Fedora Magazine) but the rpmfusion repo maintained by @kwizart (thanks!) but I keep getting the same signing / out-of-tree error

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm
sudo dnf install v4l2loopback
sudo modprobe v4l2loopback

leads to

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

checking the errordmesg | grep 'v4l2loopback'

[  635.180132] v4l2loopback: loading out-of-tree module taints kernel.
[  635.180198] v4l2loopback: module verification failed: signature and/or required key missing - tainting kernel

I’ve tried installing from source (github/umlaeute/v4l2loopback), installing from COPR (coprs/zetorian/v4l2loopback/) which uses DKMS afaik, also installing v4l-utils-devel-tools based on a comment on the fedoramagazine article and nothing seems to help

this error is a common issue on the repo and supposedly about having either the wrong kernel or the wrong toolchain (github com/umlaeute/v4l2loopback/issues/296#issuecomment-619529795).

I’m on Fedora 35 with the following info about my kernel etc

uname -r
5.15.13-200.fc35.x86_64

dnf list installed | grep kernel
kernel.x86_64                                     5.14.17-301.fc35                       @updates                                             
kernel.x86_64                                     5.15.12-200.fc35                       @updates                                             
kernel.x86_64                                     5.15.13-200.fc35                       @updates                                             
kernel-core.x86_64                                5.14.17-301.fc35                       @updates                                             
kernel-core.x86_64                                5.15.12-200.fc35                       @updates                                             
kernel-core.x86_64                                5.15.13-200.fc35                       @updates                                             
kernel-devel.x86_64                               5.14.17-301.fc35                       @updates                                             
kernel-devel.x86_64                               5.15.12-200.fc35                       @updates                                             
kernel-devel.x86_64                               5.15.13-200.fc35                       @updates                                             
kernel-headers.x86_64                             5.15.4-200.fc35                        @updates                                             
kernel-modules.x86_64                             5.14.17-301.fc35                       @updates                                             
kernel-modules.x86_64                             5.15.12-200.fc35                       @updates                                             
kernel-modules.x86_64                             5.15.13-200.fc35                       @updates                                             
kernel-modules-extra.x86_64                       5.14.17-301.fc35                       @updates                                             
kernel-modules-extra.x86_64                       5.15.12-200.fc35                       @updates                                             
kernel-modules-extra.x86_64                       5.15.13-200.fc35                       @updates                                             
kernel-srpm-macros.noarch                         1.0-6.fc35                             @fedora                                              
kernel-tools.x86_64                               5.15.4-200.fc35                        @updates                                             
kernel-tools-libs.x86_64                          5.15.4-200.fc35                        @updates                                             
libreport-plugin-kerneloops.x86_64                2.15.2-6.fc35                          @fedora   

I am not dual-booting and have no old kernel issues (reddit com/r/Fedora/comments/l0qsx7/cant_install_v4l2loopback/) so the issue could be that my kernel-headers are 5.15.4-200 as opposed to my kernel which is 5.15.13-200 but I am not sure and there are no newer kernel-headers so I’m guessing that’s not it.

Looking for any advice or further troubleshooting ideas!

EDIT: new users can only put 2 links in a post so sorry for the terrible formatting / bad links

Just tried to install with dkms from this gist and again I have the same issue.

Also I have secure-boot disabled so that’s not the issue either

Hi, I think you need also to install kernel-devel for your current kernel version since it need akmod kind of things.

You need dnf install akmod-v4l2loopback , not only v4l2loopback

@oprizal that’s true but kernel-devel 5.15.13-200.fc35 is installed (see my dnf list installed command in the first comment)

@kwizart thanks for the quick response! akmod-v4l2loopback is actually picked up as a dependency by dnf so it is installed as well. Here’s the shell output

sudo dnf install v4l2loopback          
Last metadata expiration check: 0:20:38 ago on Sun 16 Jan 2022 12:27:01 PM EST.
Dependencies resolved.
============================================================================================================================================================================================================
 Package                                               Architecture                              Version                                            Repository                                         Size
============================================================================================================================================================================================================
Installing:
 v4l2loopback                                          noarch                                    0.12.5-4.fc35                                      rpmfusion-free                                     24 k
Installing dependencies:
 akmod-v4l2loopback                                    x86_64                                    0.12.5-5.fc35                                      rpmfusion-free                                     63 k

Transaction Summary
============================================================================================================================================================================================================

I don’t know if this makes a difference but v4l2loopback == 0.12.5-4.fc35 whereas akmod-v4l2loopback == 0.12.5-5.fc35. Does it matter if its 5-4 and 5-5?

There’s also the package kmod-v4l2loopback-5.15.13-200.fc35.x86_64-0.12.5-5.fc35.x86_64 which uses 5-5 as well. I don’t know if this is related.

Hi, just found something similar error from the internet here when running modprobe (different module).

I tested to install v4l2loopback and successfully did modprobe.

Bellow are my current gcc version and some dependencies packages:

gcc version
[testcase@fedora ~]$ gcc --version
gcc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
clik to see v4l2loopback deplist
[testcase@fedora ~]$ sudo dnf repoquery v4l2loopback --deplist
Last metadata expiration check: 0:22:45 ago on Mon 17 Jan 2022 02:24:48 AM WIB.
package: v4l2loopback-0.12.5-4.fc35.noarch
  dependency: /usr/bin/bash
   provider: bash-5.1.8-2.fc35.x86_64
  dependency: v4l2loopback-kmod >= 0.12.5
   provider: akmod-v4l2loopback-0.12.5-5.fc35.x86_64
   provider: kmod-v4l2loopback-0.12.5-5.fc35.x86_64

[testcase@fedora ~]$ sudo dnf repoquery akmod --deplist
Last metadata expiration check: 0:23:22 ago on Mon 17 Jan 2022 02:24:48 AM WIB.

[testcase@fedora ~]$ sudo dnf repoquery kmod --deplist
Last metadata expiration check: 0:23:28 ago on Mon 17 Jan 2022 02:24:48 AM WIB.
package: kmod-29-4.fc35.x86_64
  dependency: glibc >= 2.33.9000-43.fc35
   provider: glibc-2.34-11.fc35.i686
   provider: glibc-2.34-11.fc35.x86_64
  dependency: libc.so.6(GLIBC_2.34)(64bit)
   provider: glibc-2.34-11.fc35.x86_64
  dependency: libcrypto.so.1.1()(64bit)
   provider: opae-devel-2.0.0-2.3.fc35.x86_64
   provider: openssl-libs-1:1.1.1l-2.fc35.x86_64
   provider: openssl1.1-1:1.1.1i-3.fc35.x86_64
  dependency: libcrypto.so.1.1(OPENSSL_1_1_0)(64bit)
   provider: opae-devel-2.0.0-2.3.fc35.x86_64
   provider: openssl-libs-1:1.1.1l-2.fc35.x86_64
   provider: openssl1.1-1:1.1.1i-3.fc35.x86_64
  dependency: libgcc_s.so.1()(64bit)
   provider: libgcc-11.2.1-7.fc35.x86_64
  dependency: libgcc_s.so.1(GCC_3.0)(64bit)
   provider: libgcc-11.2.1-7.fc35.x86_64
  dependency: libgcc_s.so.1(GCC_3.3.1)(64bit)
   provider: libgcc-11.2.1-7.fc35.x86_64
  dependency: liblzma.so.5()(64bit)
   provider: xz-libs-5.2.5-7.fc35.x86_64
  dependency: liblzma.so.5(XZ_5.0)(64bit)
   provider: xz-libs-5.2.5-7.fc35.x86_64
  dependency: libz.so.1()(64bit)
   provider: zlib-1.2.11-30.fc35.x86_64
  dependency: libzstd.so.1()(64bit)
   provider: libzstd-1.5.1-6.fc35.x86_64
  dependency: rtld(GNU_HASH)
   provider: glibc-2.34-11.fc35.i686
   provider: glibc-2.34-11.fc35.x86_64

thanks for the suggestion @oprizal, I checked the link and the issue was a bad gcc version but my gcc is the same version as yours so it seems fine

gcc --version
gcc (GCC) 11.2.1 20211203 (Red Hat 11.2.1-7)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and the v4l2loopback deplist matches up as well. Just to confirm, you ran the same three commands and modprobe didn’t error?

Yes, after installing v4l2loopback from rpmfusion and modprobe it, there is no error (I already have kernel-headers and kernel-devel installed). If you want to compare any other packages installed on my system, let me know. Or you could try to run sudo dnf distro-sync to find any missing packages.

Thanks for the suggestion @oprizal. I successfully did distro-sync and installed the latest kernel 5.15.14-200.fc35.x86_64 but still getting the same issues.

It might be something to do with my kernel headers? Unsure. Can you give me your output for dnf installed | grep kernel? I’m wondering if my kernel-headers or kernel-modules are different from yours

Also, after installing and rebooting, I get the following bootup errors

module: x86/modules: Skipping invalid relocation target, existing value is nonzero for type 1, loc 000000004d9a74cd, val ffffffffc01d4740

Failed to insert module 'v4l2loopback': Exec format error

Failed to start Load Kernel Modules.

Not sure if this helps debug but in another similar issue online the problem was incorrect kernel + headers

I’m not sure either about kernel-header, but here my system. Please ignore kernel 5.16.1 that I just installed today.

Also may be you want to check systemctl status akmods

[testcase@fedora ~]$ uname -r
5.15.14-200.fc35.x86_64

[testcase@fedora ~]$ lsmod | grep v4l2loopback
v4l2loopback           45056  0
videodev              270336  4 videobuf2_v4l2,v4l2loopback,uvcvideo,videobuf2_common

[testcase@fedora ~]$ sudo dnf list installed kernel*
Installed Packages
kernel.x86_64                                                     5.15.12-200.fc35                                        @updates     
kernel.x86_64                                                     5.15.13-200.fc35                                        @updates     
kernel.x86_64                                                     5.15.14-200.fc35                                        @updates     
kernel.x86_64                                                     5.16.1-200.fc35                                         @@commandline
kernel-core.x86_64                                                5.15.12-200.fc35                                        @updates     
kernel-core.x86_64                                                5.15.13-200.fc35                                        @updates     
kernel-core.x86_64                                                5.15.14-200.fc35                                        @updates     
kernel-core.x86_64                                                5.16.1-200.fc35                                         @@commandline
kernel-devel.x86_64                                               5.15.14-200.fc35                                        @updates     
kernel-headers.x86_64                                             5.15.4-200.fc35                                         @updates     
kernel-modules.x86_64                                             5.15.12-200.fc35                                        @updates     
kernel-modules.x86_64                                             5.15.13-200.fc35                                        @updates     
kernel-modules.x86_64                                             5.15.14-200.fc35                                        @updates     
kernel-modules.x86_64                                             5.16.1-200.fc35                                         @@commandline
kernel-modules-extra.x86_64                                       5.15.12-200.fc35                                        @updates     
kernel-modules-extra.x86_64                                       5.15.13-200.fc35                                        @updates     
kernel-modules-extra.x86_64                                       5.15.14-200.fc35                                        @updates     
kernel-modules-extra.x86_64                                       5.16.1-200.fc35                                         @@commandline
kernel-srpm-macros.noarch                                         1.0-6.fc35                                              @fedora      

[testcase@fedora ~]$ systemctl status akmods
● akmods.service - Builds and install new kmods from akmod packages
     Loaded: loaded (/usr/lib/systemd/system/akmods.service; enabled; vendor preset: enabled)
     Active: active (exited) since Tue 2022-01-18 10:26:38 WIB; 2min 48s ago
    Process: 787 ExecStart=/usr/sbin/akmods --from-init (code=exited, status=0/SUCCESS)
   Main PID: 787 (code=exited, status=0/SUCCESS)
        CPU: 271ms

Jan 18 10:26:22 fedora systemd[1]: Starting Builds and install new kmods from akmod packages...
Jan 18 10:26:38 fedora akmods[787]: Checking kmods exist for 5.15.14-200.fc35.x86_64[  OK  ]
Jan 18 10:26:38 fedora systemd[1]: Finished Builds and install new kmods from akmod packages.

Update:

I install v4l2loopback (then reboot it first before performing modprobe) with kernel 5.15.14, kernel-devel 5.15.14, and kernel-headers 5.15.4 already installed.

Above are status after remove v4l2loopback and reinstall it again to show the status of systemctl status akmods during the build module.

Have you tried the official instructions?

cd /tmp/
wget -O droidcam_latest.zip https://files.dev47apps.net/linux/droidcam_1.8.1.zip
sha1sum https://files.dev47apps.net/linux/droidcam_1.8.1.zip
# sha1sum: fb9f0737f45f1904c648dd0e6c1cfa7ff6089aa1
unzip droidcam_latest.zip -d droidcam
cd droidcam && sudo ./install-client
sudo ./install-video
sudo ./install-sound
sudo modprobe v4l2loopback_dc

If you want change the resolution mode, you can do it:

For DroidCam v4l2loopback-dc, you can change the webcam resolution as follows:

1. Close any programs using the droidcam webcam. Unload the driver:
sudo rmmod v4l2loopback_dc

2. Re-load it with new options (WIDTH and HEIGHT are numbers). :
sudo insmod /lib/modules/`uname -r`/kernel/drivers/media/video/v4l2loopback-dc.ko width=WIDTH height=HEIGHT

Standard sizes (Width x Height): 640×480, 960×720, 1280×720 (720p), 1920×1080 (1080p).
Note: MS Teams and Skype on Linux support only up to 1280×720 input.

3. Re-open the droidcam client and test it out.

4. Edit the text file /etc/modprobe.d/droidcam.conf with the new options to make the change permanent.

https://www.dev47apps.com/droidcam/linux/

Are you sure to use the system gcc ? do you have an alternate gcc version available on your system or even do you have switched to clang for any other project by default ?