Secure Boot-aware management of the upstream
v4l2loopbackkernel module on Fedora.
v4l2loopback-manager builds, signs, installs, verifies, rebuilds, and removes the upstream v4l2loopback kernel module on Fedora systems, including systems with UEFI Secure Boot enabled.
The kernel module itself is not distributed by this RPM. It is built locally from the upstream source for Fedora's configured default boot kernel.
- Builds
v4l2loopbacklocally for the Fedora default boot kernel. - Detects the target kernel using
grubby --default-kernel. - Supports UEFI Secure Boot using a Machine Owner Key (MOK).
- Signs
v4l2loopback.kousing the kernelsign-fileutility. - Verifies module existence, expected certificate signer, and current MOK enrollment.
- Provides a
statuscommand for a complete Secure Boot/signing health check. - Rebuilds only when the module is missing or has an invalid signature.
- Provides optional systemd integration for automatic boot-time verification.
- Keeps module options persistent through
modprobe.d. - Supports explicit local-resource uninstall, systemd cleanup, and complete RPM purge.
- Designed for Fedora RPM/COPR installation.
sudo dnf copr enable hhlp/v4l2loopback
sudo dnf install v4l2loopback-managerVerify the installation:
rpm -q v4l2loopback-manager
command -v v4l2loopback
v4l2loopback helpPrepare the Secure Boot signing key and MOK enrollment:
sudo v4l2loopback genkeyIf enrollment is requested, reboot manually and complete enrollment in the blue MOK Manager screen. Existing complete signing keys are preserved; the manager does not regenerate them merely because enrollment is missing.
Check the current signing state:
v4l2loopback statusAfter MOK enrollment is complete, build and install the module:
sudo v4l2loopback rebuildOptional automatic boot-time verification:
sudo v4l2loopback enable-systemdThe RPM provides the manager, not a precompiled kernel module.
Fedora system
β
βΌ
v4l2loopback-manager
β
ββββββββββββββββΌβββββββββββββββ
β β β
βΌ βΌ βΌ
default kernel Secure Boot upstream source
grubby MOK v4l2loopback.git
β β β
ββββββββββββββββΌβββββββββββββββ
βΌ
build module
β
βΌ
sign module
β
βΌ
/lib/modules/<kernel>/updates/
v4l2loopback.ko
β
βΌ
depmod
At boot, the optional systemd service performs a simple decision:
Fedora default boot kernel
β
βΌ
v4l2loopback.ko
β
ββββββββ΄βββββββ
β β
missing exists
β β
β βΌ
β check signer
β βββββ΄ββββ
β β β
β valid invalid
β β β
βΌ βΌ βΌ
rebuild skip rebuild
- Features
- Quick Start
- How It Works
- Current Design
- Requirements
- RPM / COPR Installation
- Commands
- Secure Boot / MOK
- Source Tree
- Kernel Selection
- Rebuild Decision
- systemd Integration
- Persistent Module Configuration
- Verification
- BIOS / UEFI / Firmware Recovery
- Kernel Updates
- Removal
- Documentation
- License
The manager deliberately has no DNF hook and no systemd timer.
The optional:
v4l2loopback-rebuild.service
is a oneshot service evaluated at boot.
The target kernel is the Fedora default boot kernel, determined with:
sudo grubby --default-kernelThe same target is used by both:
needs-rebuild
rebuild
The manager does not simply choose the numerically newest installed kernel-devel.
For the target kernel it expects:
/lib/modules/<default-boot-kernel>/updates/v4l2loopback.ko
needs-rebuild validates the target module and keeps module validity separate
from MOK trust:
- The module exists.
modinfo -F signercontainsV4L2Loopback Module Signing.- MOK enrollment is checked so a lost enrollment can be reported clearly.
A missing MOK enrollment does not make an already valid .ko require a
rebuild. Rebuilding with the same unenrolled key would not restore trust.
Its exit status is intentionally designed for systemd ExecCondition=:
0 = module missing, unsigned, unreadable,
or signed by another certificate
β rebuild required
1 = module exists and has the expected signer
β no rebuild required
Important: exit status
1fromneeds-rebuildis not an application failure. It means the systemd condition is false because the module is already valid.
The RPM installs the required runtime dependencies automatically.
For a manual/source installation, the required Fedora packages are:
sudo dnf install -y \
git \
gcc \
make \
kernel-devel \
openssl \
mokutil \
dracut \
kmod \
systemd \
grubbyOptional diagnostic tools:
sudo dnf install -y v4l-utils ShellCheckEnable the COPR repository:
sudo dnf copr enable hhlp/v4l2loopbackInstall:
sudo dnf install v4l2loopback-managerThe RPM installs the manager as:
/usr/bin/v4l2loopback
Verify:
rpm -q v4l2loopback-manager
rpm -qf /usr/bin/v4l2loopback
command -v v4l2loopback
v4l2loopback helpThe RPM packages the management utility and documentation.
It deliberately does not ship a precompiled v4l2loopback.ko.
RPM
β
βββ /usr/bin/v4l2loopback
βββ README.md
βββ FAQ.md
βββ TEST.md
βββ LICENSE
v4l2loopback.ko
β²
β
built locally for the
Fedora default boot kernel
This avoids coupling the package to one particular Fedora kernel build.
Available commands:
genkey
status
needs-rebuild
rebuild
reinstall
uninstall
purge
enable-systemd
disable-systemd
help
General syntax:
sudo v4l2loopback <command>Display built-in help:
v4l2loopback helpGenerate the project MOK:
sudo v4l2loopback genkeyThe manager uses:
/var/lib/shim-signed/mok/v4l.key
/var/lib/shim-signed/mok/v4l.der
Certificate subject:
CN=V4L2Loopback Module Signing
The private key:
/var/lib/shim-signed/mok/v4l.key
must remain private and should never be committed, uploaded, or attached to a GitHub issue.
genkey is intentionally conservative:
both files missing
-> generate a new key pair
both files present
-> preserve the existing key pair
only one file present
-> stop; do not overwrite the partial key pair
certificate not enrolled
-> import the existing DER certificate for MOK enrollment
If enrollment is requested, reboot manually:
sudo rebootThen complete enrollment in the blue MOK Manager screen.
Verify the current state with the manager:
v4l2loopback statusYou can also inspect the enrolled certificates directly:
mokutil --list-enrolled |
grep -A5 -B5 'V4L2Loopback Module Signing'On some Fedora/mokutil combinations,
mokutil --test-keymay printis already enrolledwhile still returning exit status1. The manager therefore checks the explicit enrollment result instead of trusting that exit code alone.
The manager expects the upstream source at:
/usr/src/v4l2loopback
Clone it when needed:
sudo git clone \
https://github.com/v4l2loopback/v4l2loopback.git \
/usr/src/v4l2loopbackThe source comes from the upstream v4l2loopback project. This repository provides the Fedora management, Secure Boot, packaging, and systemd integration around it.
Version 1.0.2 uses Fedora's configured default boot kernel.
Show it with:
sudo grubby --default-kernelExample:
/boot/vmlinuz-7.1.10-200.fc44.x86_64
The manager extracts:
7.1.10-200.fc44.x86_64
and expects the corresponding kernel paths:
/usr/src/kernels/7.1.10-200.fc44.x86_64
/lib/modules/7.1.10-200.fc44.x86_64
This distinction is important.
newest installed kernel
β
Fedora configured default boot kernel
The manager follows the kernel Fedora is configured to boot.
If kernel-devel for that kernel is missing, install the matching package before rebuilding.
The rebuild decision is:
Fedora default boot kernel
β
βΌ
expected v4l2loopback.ko
β
ββββββ΄βββββ
β β
missing exists
β β
β βΌ
β check signer
β ββββ΄βββ
β β β
β valid invalid
β β β
βΌ βΌ βΌ
rebuild skip rebuild
Run the condition manually:
sudo v4l2loopback needs-rebuild
echo $?Interpretation:
0 β rebuild required
1 β module already valid
Perform the build:
sudo v4l2loopback rebuildrebuild independently checks the same target and signature. Therefore, a manual rebuild also avoids recompiling an already valid module.
If the module exists but is unsigned or signed by another certificate, it is rebuilt and replaced.
make clean
β
βΌ
make KERNELRELEASE=<default-boot-kernel>
β
βΌ
kernel sign-file sha256
β
βΌ
install v4l2loopback.ko
β
βΌ
depmod -a <kernel>
The module is reloaded immediately only when:
target kernel == uname -r
Otherwise, the module is prepared for the next boot into the target kernel.
Enable automatic boot-time checking:
sudo v4l2loopback enable-systemdThe manager generates:
v4l2loopback-rebuild.service
with the equivalent logic:
[Unit]
Description=Ensure v4l2loopback is available for Fedora default boot kernel
Documentation=https://github.com/hhlp/v4l2loopback
After=local-fs.target
ConditionPathExists=/usr/bin/v4l2loopback
[Service]
Type=oneshot
ExecCondition=/usr/bin/v4l2loopback needs-rebuild
ExecStart=/usr/bin/v4l2loopback rebuild
[Install]
WantedBy=multi-user.targetThe boot flow is:
boot
β
βΌ
v4l2loopback-rebuild.service
β
βΌ
needs-rebuild
β
βββ exit 0 βββΊ ExecStart=rebuild
β
βββ exit 1 βββΊ skip ExecStart
At every boot, systemd evaluates the condition.
Exit 1 from needs-rebuild means the module is already valid, so ExecStart= is intentionally skipped.
systemd may display:
ExecCondition=... (code=exited, status=1/FAILURE)
followed by:
Skipped due to 'exec-condition'
In this design that is an expected false condition, not a failed compilation or broken service.
Check the service:
systemctl status v4l2loopback-rebuild.service
systemctl is-enabled v4l2loopback-rebuild.service
journalctl -b -u v4l2loopback-rebuild.serviceDisable and remove the dynamically generated unit:
sudo v4l2loopback disable-systemdIf upgrading from an older release whose generated unit already exists, enable-systemd preserves that file.
To regenerate its contents using the current version:
sudo v4l2loopback disable-systemd
sudo v4l2loopback enable-systemdThe manager uses:
/etc/modprobe.d/v4l2loopback.conf
/etc/modules-load.d/v4l2loopback.conf
Default module options:
devices=1 video_nr=10 card_label=VirtualCam exclusive_caps=1
These settings provide a persistent virtual camera configuration across boots.
Start with the built-in health check:
v4l2loopback statusA healthy Secure Boot setup reports the signing certificate as enrolled, the
target module as present and signed by V4L2Loopback Module Signing, and ends
with:
β
v4l2loopback signing state is ready.
Determine the Fedora default boot kernel manually:
TARGET="$(sudo grubby --default-kernel)"
TARGET="${TARGET##*/}"
TARGET="${TARGET#vmlinuz-}"
echo "$TARGET"Inspect the module:
modinfo -k "$TARGET" v4l2loopback |
grep -E '^(filename|version|signer|sig_key|sig_hashalgo):'Expected signer:
V4L2Loopback Module Signing
For the currently running kernel:
lsmod | grep v4l2loopbackIf v4l-utils is installed:
v4l2-ctl --list-devicesA normal installation should expose the configured virtual camera, by default:
VirtualCam
A BIOS/UEFI or firmware update can change Secure Boot/MOK trust state without removing the local key files or the already signed module.
Typical state:
v4l.key exists
v4l.der exists
v4l2loopback.ko exists
module signer is correct
MOK enrollment is missing
In that case, do not regenerate the key and do not rebuild the module just to restore trust. Re-enroll the existing certificate:
sudo v4l2loopback genkeyThe manager preserves the existing key pair and stages the existing
v4l.der for enrollment. Then reboot manually:
sudo rebootComplete the MOK enrollment in the blue MOK Manager screen and verify:
v4l2loopback statusThe expected result is:
π MOK enrollment:
β
Signing certificate is enrolled.
β
v4l2loopback signing state is ready.
After:
sudo dnf upgradeFedora normally changes its configured default boot kernel to the newly installed kernel.
On the next boot:
Fedora boot
β
βΌ
systemd oneshot
β
βΌ
grubby --default-kernel
β
βΌ
check v4l2loopback.ko
β
βΌ
check signer
β
ββββ΄ββββ
β β
valid invalid/missing
β β
skip rebuild
The manager therefore follows the kernel Fedora is configured to boot, rather than assuming that the highest installed kernel-devel is always the intended kernel.
There is deliberately:
- no DNF hook;
- no background timer;
- no unnecessary rebuild when the module is already valid.
Because the manager creates local system state that does not belong directly to the RPM payload, cleanup should be explicit.
Run:
sudo v4l2loopback uninstalluninstall disables and removes the dynamically generated systemd integration,
unloads the module when possible, removes locally installed
v4l2loopback.ko files and persistent module configuration, and offers the
existing optional cleanup of the upstream source tree, signing keys, and MOK
certificate deletion request.
The manager RPM remains installed, so /usr/bin/v4l2loopback is still
available afterwards.
If MOK certificate deletion is requested, mokutil --delete only stages the
request. The certificate remains enrolled until you reboot manually and confirm
the pending deletion in the blue MOK Manager screen.
Recommended complete-removal command:
sudo v4l2loopback purgeThe purge flow is:
uninstall managed local resources
β
βΌ
disable/remove systemd integration
β
βΌ
optional MOK deletion request
β
βΌ
dnf remove v4l2loopback-manager
DNF keeps its normal final transaction confirmation; the manager does not pass
-y.
If MOK deletion was successfully staged, the RPM and local resources can be removed before reboot, but the overall purge remains pending until the manual MOK Manager confirmation is completed.
RPM removal: complete
Local resource cleanup: complete
MOK deletion request: pending reboot confirmation
Overall purge: pending
No automatic reboot is performed.
A direct:
sudo dnf remove v4l2loopback-managerremoves only RPM-owned files. RPM scriptlets intentionally do not perform interactive cleanup of locally generated modules, signing material, source trees, configuration, or dynamically generated systemd state.
Additional project documentation:
| Document | Purpose |
|---|---|
FAQ.md |
Troubleshooting and frequently asked questions |
TEST.md |
Validation and testing procedure |
CHANGELOG.md |
Release history and notable changes |
CONTRIBUTING.md |
Contribution workflow and development guidelines |
SECURITY.md |
Security policy and vulnerability reporting |
LICENSE |
GPL-3.0 license |
This project manages the build and installation of the upstream v4l2loopback module on Fedora.
ββββββββββββββββββββββββββββββββββββββββββββββ
β hhlp/v4l2loopback β
β β
β Fedora management β
β RPM / COPR packaging β
β Secure Boot / MOK signing β
β systemd integration β
β verification / rebuild logic β
βββββββββββββββββββββ¬βββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββ
β upstream v4l2loopback β
β β
β actual Linux kernel module source β
ββββββββββββββββββββββββββββββββββββββββββββββ
Issues related specifically to the upstream kernel module itself may need to be reported to the upstream v4l2loopback project.
v4l2loopback-manager is distributed under the GNU General Public License v3.0 only (GPL-3.0-only).
See LICENSE for the complete license text.
Current release: v1.0.5
Platform: Fedora Linux
Manager: /usr/bin/v4l2loopback
Kernel target: Fedora default boot kernel via grubby --default-kernel