Introduction
TL; DR - I don't care about your cool story, just give me the commands: click here.
I've recently began using Ubuntu 20 as my daily driver, and as I started migrating everything from my Windows installation, I finally got to the audio and video department. Since we all have to attend online meetings these days, I have worked on my setup too, which consists on two main things: DroidCam, to make my phone into a webcam, and NoiseTorch, to remove anything that is not my voice from my audio stream.
Everything worked smoothly for a few days, until I installed a kernel update. This morning I had to attend an online lesson - and whoops! DroidCam was no longer working. I was getting the error Device not found (/dev/video[0-9])
. Apparently, the v4l2loopback-dc
module got removed somehow. Anyway, I started tinkering again, I installed the droidcam-dkms
package but it failed, I tried uninstalling it but it removed everything... It was a mess. I finally got it to work - however, the video stream was freezing every few seconds, and the audio in my headphones was popping and crackling like crazy. Also, NoiseTorch was listing every one of my inputs as (incompatible?)
- they were working fine a few minutes earlier.
My last chance was to try and fix PulseAudio. I knew something was messed up, but I really couldn't figure out what. My configuration file wasn't changed, nor was the system one. Disabling timer-based audio scheduling (tsched=0
) helped a little, but it didn't fix the issue. I really didn't know what to do.
I had the idea of trying to completely purge and reinstall the pulseaudio
and alsa*
packages. However, if you try:
apt autoremove --purge pulseaudio
You will be greeted with an awesome list of dependency packages that will be removed too, and those will include ubuntu-desktop
, ubuntu-desktop-minimal
and other completely unrelated system stuff. That's obviously something you do not want to uninstall.
I was lucky, however. I had a brilliant idea: I could bypass apt
entirely and use dpkg
. It felt like magic, when everything suddenly started to work.
The very simple process
As long as your audio configuration and settings were working when you installed Ubuntu, and the malfunctioning state is caused by your misconfiguration and/or fault, restoring the audio driver to default state might actually be helpful.
First of all, completely purge and remove your pulseaudio
and alsa
packages by running:
sudo dpkg --purge --force-depends pulseaudio alsa-base alsa-utils
Don't worry about dependency warnings - we are aware of that; that's the purpose of bypassing apt
. We want to only uninstall those specific packages, and since we are reinstalling them in a few seconds, there's no need to worry about missing dependencies.
Then, run the following command:
sudo apt install pulseaudio alsa-base alsa-utils
Voilà. Reboot your machine and your audio will be good to go, ready to play your favorite tunes, meme videos and whatnot.