this post was submitted on 07 Aug 2024
359 points (98.9% liked)

Linux

48074 readers
895 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

(not really pipewire itself but an interaction with wireplumber/libcamera/the kernel, but pipewire is what triggers the problem)

As seen in https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2669 and https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/4115

The camera's /dev/video file is kept open (without streaming), sadly causing the camera to be powered on what looks to be most devices. For some reason, this completely nullifies the soc power management on modern laptops and can result in increases from 3W to 8W at idle!

On Intel laptops it's a bit easier to debug because you can see the Cstates in powertop not going low but it also wrecks AMD ones. Some laptops can reach lower cstates, but the camera module wastes a few W anyway.

I can't believe this shipped in Ubuntu, Fedora etc without anyone noticing, and for so long. This bug is quite literally wasting GWh of power and destroys the user experience of distros in laptops.

If you have a laptop with a switch that detaches the camera from the usb bus you are probably out of the water, just plug it when you use it and the problem is sidestepped. Removing uvcvideo and modprobing it on demand can also work. Disabling the camera in Lenovo's UEFI is what I did for a year until I finally found the issue on the tracker. Some laptops also seem to not be affected, but for me it happens to every machine I've tested.

Thanks to this comment for another workaround that tells wireplumber to ignore cameras. ~/.config/wireplumber/wireplumber.conf.d/10-disable-camera.conf

wireplumber.profiles = { main = { monitor.libcamera = disabled } }

Software that only captures cameras using pipewire is rare and this hasn't given me any problem. This should probably be shipped by distros while the problem is sorted out.

Note that most laptops will have other problems stopping them from reaching deep cstates, borked pcie sd card readers, ancient ethernet nics that don't support pcie sleep properly, outdated nvme firwmare... those are separate issues that most of the time can also be tackled with some dose of tlp, but it's all for nothing if the usb camera is keeping the soc awake!

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 3 months ago

Depends on your distribution. I guess most of them use pipewire nowadays, and the bug has not been fixed yet so... if you are using a common GNU/Linux distro, the bug is likely on your system.

Does it affect you, well, from what I understood, as long as your system registers the camera and pipewire is running, your camera is going to waste energy regardless of whether it's actively streaming video or not.

From what I've understood there are several workarounds, each bad but in a different way:

  • Disabling pipewire is not a good universal solution since it would effectively disable all audio on your system.
  • Disabling the kernel driver for your camera would be a more precise workaround but it's not simple: apart from knowing how to do -- and undo -- that, you would need to find out which driver it is, and that depends on your actual hardware. And of course, with the driver disabled you would not be able to use the camera, so depending on your situation this might only be viable if you were willing to go back and disable/enable the driver as you need.
  • Physically disconnecting the camera - with desktop computer with the camera connected using a cable; you could just unplug it and plug it back in when you need it. With laptops, this is generally not possible; some laptops do have switches which effectively do the same thing but from technical standpoint that switch is a liability and costs something so most main-stream laptops won't have it.

In either case, it's also worth noting that whatever app you are using the camera with is likely to keep a "list of cameras" and some sort of memory of your last selection. In theory, disabling or enabling a camera should work fine, but it's not uncommon that apps will have bugs when managing the list; for example an app might not "see" the camera being back on, etc. so if you are going to use any of the above you might need to get used to restarting an app from time to time.

Assuming that eventually this bug is going to be fixed, the question of when it will be available for your system, again, depends on the distribution you are using. Many distributions have own public bug trackers so you could try and look it up and watch their ticket (in some cases, some distributions might even have fixes available sooner than the bug is fixed upstream, but I would not count on that), or you can try and talk to the community (look for an IRC/matrix channel, discord server, etc.)