Public bug reported:
## [ Impact ]
On Ubuntu 22.04 LTS, `v4l2loopback-dkms` version
`0.12.7-2ubuntu2~22.04.1` may leave a virtual camera unusable after the
last writer closes when `exclusive_caps=1`.
After a successful V4L2 `write()` session, `VIDIOC_QUERYCAP` can report
`device_caps=0x05200000`, meaning neither VIDEO_OUTPUT nor VIDEO_CAPTURE
is available. Restarting the video producer fails until the kernel
module is reloaded.
The same issue is documented in Debian bug #1040744 and fixed upstream
since v4l2loopback 0.14.0.
We request an official Ubuntu 22.04 Stable Release Update (SRU)
backporting this bug fix to the existing Jammy package.
## [ Test Plan ]
Test environment: Ubuntu 22.04 LTS, Linux `6.8.0-149-generic`, ThinkPad
T470, `/dev/video10`, `exclusive_caps=1`.
1. Load the unpatched driver with `exclusive_caps=1` and verify that
VIDEO_OUTPUT is initially advertised.
2. Send YUYV 640x480 frames using FFmpeg's V4L2 output and allow the writer to
exit normally.
3. Query the device capabilities again.
4. On the affected driver, the device can report `0x05200000`, losing both
OUTPUT and CAPTURE.
5. Repeat with an appropriately packaged, patched driver. OUTPUT should be
restored after each writer closes.
6. Repeat at least ten start/stop cycles and check different formats,
consumers, and writer/reader combinations.
Example producer:
```
ffmpeg -hide_banner -loglevel warning \
-f lavfi -i testsrc2=size=640x480:rate=30 \
-t 3 -pix_fmt yuyv422 -f v4l2 /dev/video10
```
## [ Proposed Fix ]
In `v4l2_loopback_close()`, the Ubuntu 0.12.7 source currently contains:
```
if (is_writer)
dev->ready_for_output = 1;
```
The experimentally tested correction is:
```
if (is_writer || dev->open_count.counter == 0)
dev->ready_for_output = 1;
```
This restores readiness for OUTPUT when the final file descriptor is
closed. Please compare this minimal backport with the upstream fix and
use the implementation considered safest by Ubuntu maintainers.
## [ Where Problems Could Occur ]
The change affects capability state transitions when the final file
descriptor closes. Regression testing should cover simultaneous readers
and writers, `exclusive_caps=0`, different V4L2 I/O methods, repeated
opening and closing, and correct device cleanup.
## [ Other Info ]
On 17 November 2026, a 4-second FFmpeg V4L2 output test exited
successfully, but the unpatched driver subsequently reported
`device_caps=0x05200000`.
A one-line source patch was applied to Ubuntu 0.12.7 and a separate
experimental kernel module was successfully compiled for Linux
`6.8.0-149-generic`.
Subsequent RedimVirt diagnostic tests showed repeated successful video
start/stop cycles, restoring `device_caps=0x05200002` after writer
closure.
On 20 November, the on-disk DKMS module had
`srcversion=7EF0183B7133F134C838F6F`, while the loaded module had
`srcversion=3082467E28D3EC713226355`. The user confirmed that the
experimental module remained loaded. These values demonstrate a
difference between the loaded and on-disk modules, although the
experimental binary's own srcversion has not yet been independently
matched.
We can provide the exact source diff, original-source SHA-256, build
script and diagnostic reports.
Please consider an official fix through `jammy-proposed` and `jammy-
updates`, rather than requiring users to install unofficial kernel
modules.
References:
- https://bugs.debian.org/1040744
- https://github.com/v4l2loopback/v4l2loopback/issues/442
- https://github.com/v4l2loopback/v4l2loopback/issues/504
- https://github.com/v4l2loopback/v4l2loopback
** Affects: v4l2loopback (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2175159
Title:
v4l2loopback 0.12.7: exclusive_caps loses OUTPUT capability after
writer closes (Ubuntu 22.04)
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/v4l2loopback/+bug/2175159/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs