Created devices are not available

Bug #1901491 reported by Leo
42
This bug affects 6 people
Affects Status Importance Assigned to Milestone
v4l2loopback (Ubuntu)
Invalid
Undecided
Unassigned
Focal
Fix Released
High
Stefan Bader

Bug Description

[SRU Justification]

Impact: The attempt to properly fix the warnings caused by the module in 0.12.3-1ubuntu0.1 caused any other application than Chromium to no longer detect available loopback devices. The tested capability was only set in the capabilities set, but not in the device_caps set.

Fix: The patch was modified to change the IOCTL code as it was done in v4l2loopback 0.12.5-1. This, probably contrary to what the kernel developers tried to achieve, works around the restrictions by additionally modifying the video device capabilities which the tests do check against.

Testcase: Now tested with OBS v4l2sink connected (and exclusive_caps set) against Chromium and Firefox. With 0.12.3-1ubuntu0.1 only Chromium would find the loopback camera but with the proposed update both Chromium and Firefox would work for me. And still no warnings.

Regression Potential: Essentially the difference to the released version is that with exclusive_caps set, then device_caps of the video device change. Which could throw off anything checking there and not expecting any change. On the positive side, this is now exactly the behavior that is exposed in 20.10/Groovy.

---

After the upgrade from 0.12.3-1 to 0.12.3-1ubuntu0.1 devices created using v4l2loopback are no longer available for use in applications (e.g. MS Teams and Zoom). With version 0.12.3-1 the devices would show up, e.g.
modprobe v4l2loopback video nr=2 card label="test"
would cause the new device to show up in those UIs as "test". With version 0.12.3-1ubuntu0.1 device "test" is no longer shown.
Downgrading to 0.12.3-1 fixes the problem.

Revision history for this message
Leo (linux-fractal) wrote :

This is using:
Linux euclid 5.4.0-52-generic #57-Ubuntu SMP Thu Oct 15 10:57:00 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in v4l2loopback (Ubuntu):
status: New → Confirmed
Revision history for this message
bx (bxxb) wrote :

Workaround: Revert to the previous version.

Stefan Bader (smb)
Changed in v4l2loopback (Ubuntu Focal):
assignee: nobody → Stefan Bader (smb)
importance: Undecided → High
status: New → In Progress
Changed in v4l2loopback (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Stefan Bader (smb) wrote :

This is unfortunately the result of trying to avoid constant warnings issues by the v4l2 core about the way the v4l2loopback module treats capability settings. There seem to be multiple copies of those: first in video device structure of the driver (as device_caps) and then twice in the v4l2_capability structure which is returned by an IOCTL to query the capabilities. The latter has a copy of the device_caps and capabilities which seems to be intended (the way the kernel checks) to be at least the device_caps but might contain additional bits set.
The other kernel warning which was attempted to avoid was that the kernel does not like the device_caps copy in the IOCTL structure to be different than the set in the video device structure.

Further complication is Chromium which does not work (based on experiments) if the loopback device has V4L2_CAP_VIDEO_OUTPUT set. That is if the loopback device is not connected to an input stream. To solve that (maybe other things, too) v4l2loopback has the exclusive_caps option. If that is set, then the capabilities have V4L2_CAP_VIDEO_OUTPUT and V4L2_CAP_VIDEO_CAPTURE set only if no input or output are connected. In the 0.12.3-1 code, the module modifies both sets in the capability structure which causes the warnings. However it turns out that anything but Chromium seems to check device_caps. And if V4L2_CAP_VIDEO_CAPTURE is not set there (to avoid capabilities to become a sub-set) none of the other apps finds the device.

Looking at newer versions of v4l2loopback, it seems they avoided warnings by a hack of not only modifying the capability IOCTL sturcture, but also the video device structure. While I don't think that is what the v4l2 core tries to achieve, it seems to be at least what works for all and would match the more recent module code.

Stefan Bader (smb)
description: updated
Revision history for this message
Stefan Bader (smb) wrote :

This is the updated/proposed change to v4l2loopback. There is a test compile (pending publication right now) on

https://launchpad.net/~smb/+archive/ubuntu/focal

At least for me that allows to use the loopback device in Firefox as well as it was already usable in Chromium.

Revision history for this message
bx (bxxb) wrote :

@smb focal-proposed-0.12.3-1ubuntu0.2.debdiff seems to be working. VLC can detect the device now.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Oh why does everything need to be more complex than it seems :-)
Thanks for the fixup smb!

It misses a bug ref to this bug in the patch (added).

This is a bit noisy
- V4L2_CAP_STREAMING | V4L2_CAP_READWRITE moved up to the init
- V4L2_CAP_DEVICE_CAPS for sub 3.19 moved down
- the rest stayed as is
- once excluding the above no-change noise the essential difference now is
    dev->vdev->device_caps = cap->device_caps = cap->capabilities = capabilities;

I'm not deep enough to decide if that is right, but I confirmed that this is what the newer versions do. So yeah +1 to this.

Worst case if that version still has issues compared to the initial one we might consider a 0.12.3-1ubuntu0.2 == 0.12.3-1 to at least go back then.

Sponsored to Focal-unapproved.

Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Leo, or anyone else affected,

Accepted v4l2loopback into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/v4l2loopback/0.12.3-1ubuntu0.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in v4l2loopback (Ubuntu Focal):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-focal
Revision history for this message
bx (bxxb) wrote :

The proposed fix works for me

Revision history for this message
Leo (linux-fractal) wrote :

That works for me too. Thank you!

Revision history for this message
Jan-Åke Larsson (jalar) wrote :

Fix works for me too, thanks!

Jan-Åke Larsson (jalar)
tags: added: verification-done-focal
removed: verification-needed verification-needed-focal
Revision history for this message
Jan-Åke Larsson (jalar) wrote :

Tests performed: Zoom and Teams see the device again, can stream video from device (source is OBS Studio installed by existing snap package), everything back to normal.

If anything, the load on the machine is lower now than before, but I need to test more to verify this.

tags: added: verification-done
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package v4l2loopback - 0.12.3-1ubuntu0.2

---------------
v4l2loopback (0.12.3-1ubuntu0.2) focal; urgency=medium

  * Update patch to fix kernel warnings to match what was done in 0.12.5-1.
    This avoids hiding capabilities in the vdev->device_caps structure which
    caused any other apps than Chromium to no longer detect the loopback
    device (LP: #1901491).

 -- Stefan Bader <email address hidden> Tue, 03 Nov 2020 10:16:04 +0100

Changed in v4l2loopback (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for v4l2loopback has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Robie Basak (racb)
tags: added: regression-update
Revision history for this message
Brian Murray (brian-murray) wrote :

@Robie - Is there a reason you tagged this regression-update?

Revision history for this message
Stefan Bader (smb) wrote : Re: [Bug 1901491] Re: Created devices are not available

On 18.11.20 17:02, Brian Murray wrote:
> @Robie - Is there a reason you tagged this regression-update?
>
@Brian, because unfortunately it was. Previous attempt to get rid of kernel
warning did only work with the one app (chromium browser) I tested with.

Revision history for this message
Varun Dhar (vdhar-deactivatedaccount) wrote :

Hi, I'm having the same issue with version 0.12.3-1ubuntu0.2. Exact same issues as before, works fine in Chromium based applications, but cannot be found in other applications such as MS Teams and Zoom.

Revision history for this message
Varun Dhar (vdhar-deactivatedaccount) wrote :

I'm still having the issue after installing 0.12.5 with dkms.

Revision history for this message
Robie Basak (racb) wrote :

> @Robie - Is there a reason you tagged this regression-update?

Only for categorization - no action required.

I was regressed and it would have been easier for me to find this bug had it been tagged already, so I tagged it in case others come looking.

I also generally try to tag all SRU regression bugs so that we can find them later. For example, one can consider previous regressions in a package when considering the safety of a future proposed change. One day, I'd like to analyze past SRU regressions to see how we might be able to prevent more of them.

Revision history for this message
Stefan Bader (smb) wrote :

@Varun, since there are replies of people where it works in Zoom and Teams again and it seems to be the same for you even with 0.12.5, it rather sound like potentially a different issue with the same symptoms. You should open a new bug report via ubuntu-bug so that the there is more info about that case.

Revision history for this message
Varun Dhar (vdhar-deactivatedaccount) wrote :

I see. I managed to solve half the bug with a kernel update to 5.4.0-54; it's working in Zoom now, but not Teams. This is likely a Teams issue as it's still in beta, but I'll open a new bug report anyway.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.