Pipewire bug that causes battery drain
Today I will go over a bug that may affect your battery life if you are using Linux distribution with Pipewire audio system on a laptop or on another device with built-in camera. This post will guide you through checking if it affects you and mitigating it until it gets fixed by upstream developers.
Video walkthrough Link to heading
Check for Pipewire Link to heading
If you don’t know what Pipewire is, or otherwise not sure whether you have it on your linux installation, you can check that by running pactl info
command and checking Server Name
line, or by searching for pipewire process in your System Monitor.
pactl info | grep "Server Name"
# Server Name: PulseAudio (on PipeWire 1.2.1)
ps -e | grep "pipewire"
# 2052 ? 00:18:56 pipewire
# 2301 ? 00:36:10 pipewire-pulse
Check for bug Link to heading
To check for this specific problem, you first need to ensure that none of your user applications are using camera explicitly. Then you can run fuser --verbose /dev/video0
, and if it outputs something containing pipewire
or wireplumber
despite you explicitly not using camera at that moment, you might be having this bug.
fuser --verbose /dev/video0
# USER PID ACCESS COMMAND
#/dev/video0: laika 666245 F.... wireplumber
The other way of checking, that you may use to be completely sure, is installing powertop utility, running the sudo powertop
command, then navigating to “Device stats” tab using tab key, and using arrow keys to find your camera. If it’s running at 100% despite not being in use, you have this bug, your camera is constantly powered which may result in noticeable battery drain.
Mitigation Link to heading
Now, if you know are affected, you can temporarily mitigate the issue, by adding config file at ~/.config/wireplumber/wireplumber.conf.d/10-disable-camera.conf
with this content:
wireplumber.profiles = {
main = {
monitor.libcamera = disabled
}
}
After that, you should restart wireplumber service, either by running command like systemctl restart --user wireplumber
, or by rebooting.
This will stop Pipewire from monitoring camera usage, which will have a side effect of breaking “Camera in use” indicators in KDE or GNOME environments, but you should notice that previously shown evidence of camera being constantly powered is no longer present.
Conclusion Link to heading
Mitigating this issue may noticeably improve your battery life, though it depends on hardware for how noticeable it will actually be.
Check Gitlab issue regarding this bug for latest information about this issue, as this blogpost may get outdated.