Librem 14 Camera Sporadically Disconnecting from VMs

Greetings,

I am running Qubes 4.1 on a Librem 14 laptop. The webcam device seems to sporadically disconnect from both my Fedora and Windows Qubes when I try to access it (there is no detach message but in the device list it becomes no longer connected to my VM). For example, from the Camera app on Windows 10 I will get this message: “We can’t find your camera” while the webcam device simultaneously disappears from the device list in Windows. On Fedora using the Cheese app it is the same thing: I will connect the webcam device to the VM, launch Cheese, and either the preview screen will go black or I will get the error message “there was an error playing video from the webcam” while the webcam device simultaneously detaches itself from the VM.

What makes this issue so odd is that it appears to be random. About 90% of the time, the webcam device will disconnect while the application attempting to read from it throws an error. However the remaining 10% of the time, it works fine.

Has anyone else had a similar issue, or know what might be causing this?

Same issue here but doesn’t matter with internal or external cameras. Same deal. Seems new with 4.1 RC.

Actually, that has been common well before 4.1 RC. I have had issues like this in prior versions. I do also know that there are strategies I have used to capture the camera for use which may help highlight the cause & help researching a solution however, this issue is often quite unpredictable. One strategy that I have employed has been to get the camera quickly attached to a vm in concert with starting a good webcam app (not necessarily cheese, I believe that I installed another & tried going back & forth) until I caught (like catching a pop fly) the camera at just the right moment (like a window of opportunity, too early & one side fails, too late & maybe the other side fails) & had consistent output, then I could sometimes start up a different app (when I was testing Qubes with say Zoom & a specific webcam) and switch over without losing the connection.

Notably, I have also had other experiences with Qubes & Zoom (for instance) & specific webcams (don’t take this as a blanket endorsement) that consistently just worked without issue (made me wonder if there was something else interfering - almost, selectively). The issue which mostly affects this setup may be the nature of the USB coupling inherent to the Qubes architecture. Search in the forum, this has been mentioned before. I had for example less issues with an original (pre-Covid) Logitech C920 that was not the experience I had with lesser models. But there were times when even this setup wouldn’t cooperate.

1 Like

That issue (not Librem specific) from my experience is linked to sys-usb not having enough memory assigned by default. Reserve 500mb in settings to see the issue disappear, and reduce slowly until sweet spot is found.

If you inspect sys-usb dmesg logs, you should see errors linked to memory issues in dmesg. Oomkiller most probably. If i recall well, something linked to usb proxy gets killed and results in the device disappearing under camera used qube.

If I recall well, 450mb is a better default for sys-usb having an onboard camera.

If it works for you, please open an issue on github. Something in the lines of augmenting sys-usb default memory when a camera is detected at install would be a nice feature/bug correction for our new remote working era we now live in. :slight_smile:

Edit: the more sys-usb template enabled at boot services consumes ram, the more sys-usb reserved ram should be increased. I confirm that behavior since 3.2 and always shipped sys-usb with more reserved ram then the defaults, and confirm that sys-usb based on fedora-35 consumes a tad more ram then whatever Fedora template version it was on Qubes 3.2. Damn Fedora release cycle is annoying.

2 Likes

I increased sys-usb RAM from 300MB to 1024MB and it solved this problem for me. See:

1 Like

This is a lot of reserved memory for a sys-usb!

Thanks for the correction. I’ve increased my sys-usb memory and will report back my results after a week.

If that route helps the most, you should thank @Insurgo. I have increased my sys-usb RAM (a long while back when this option was first recommended) & it still remains a bit of a random shot the effect. I also know that there are forces that affect USB which I cannot completely report about - but having dealt with oddities in USB-connected devices for years I feel there is often more hidden than is seen.

Ah yea - thanking for the correction on previous versions of Qubes. You’re right. Thanks @Insurgo.

1 Like

I am impressed that you were able to puzzle this out. I can confirm this was the solution for me. The developers should definitely take note of this and adjust the defaults on sys-usb.

1 Like

@marmarek : i confirm (fedora-35 default template, not tested fedora-36…) That 450 was the sweet spot for USB camera to be functional without being disconnected.

As the above comments and confirmations from users and also per @adw recommendation in issue, if installer first stage could take note of lsusb output of USB camera for second stage install, sys-usb should have minimum ram adjusted.