Troubleshooting audio problems in Linux.

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
3,517
Reaction score
3,266
Credits
31,472
This is a big subject, and this post can't cover all possibilities. But it's a good place to start. I see a lot of "My audio isn't working in Linux" posts. Most of this will be done from the command line. This eliminates layer of complexity.

Here are some things to try, before you ask for more help. Running these commands will help other people help you.
First, what kind of sound hardware do you have?
Code:
sudo lspci | grep -i audio

This should return something similar to this. You may have more or less devices, but you need at least one.
Code:
2e:00.1 Audio device: NVIDIA Corporation TU104 HD Audio Controller (rev a1)
30:00.4 Audio device: Advanced Micro Devices, Inc. [AMD] Starship/Matisse HD Audio Controller

Next, are the drivers for that audio device loaded into my kernel?
Code:
sudo lsmod | grep snd

This can return qute a bit of "stuff".
Code:
snd_seq_dummy          12288  0
snd_hrtimer            12288  1
snd_hda_codec_realtek   221184  1
snd_hda_codec_generic   131072  1 snd_hda_codec_realtek
snd_hda_scodec_component    20480  1 snd_hda_codec_realtek
snd_hda_codec_hdmi    102400  1
snd_hda_intel          69632  4
snd_usb_audio         614400  2
snd_intel_dspcfg       45056  1 snd_hda_intel
snd_intel_sdw_acpi     16384  1 snd_intel_dspcfg
snd_usbmidi_lib        57344  1 snd_usb_audio
snd_hda_codec         225280  4 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_realtek
snd_ump                49152  1 snd_usb_audio
snd_rawmidi            57344  2 snd_usbmidi_lib,snd_ump
snd_hda_core          155648  5 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek
snd_hwdep              20480  2 snd_usb_audio,snd_hda_codec
mc                     90112  1 snd_usb_audio
snd_seq               135168  7 snd_seq_dummy
snd_seq_device         16384  3 snd_seq,snd_ump,snd_rawmidi
snd_pcm               196608  5 snd_hda_codec_hdmi,snd_hda_intel,snd_usb_audio,snd_hda_codec,snd_hda_core
snd_timer              53248  3 snd_seq,snd_hrtimer,snd_pcm
snd                   159744  28 snd_hda_codec_generic,snd_seq,snd_seq_device,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_usb_audio,snd_usbmidi_lib,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_ump,snd_pcm,snd_rawmidi
soundcore              16384  1 snd

Again, you may have more or less, but you should at least have something here. The dummy and timer devices will be there even if nothing else is. Those don't help much.

Well, OK, my computer knows I have audio hardware. But does Linux know about it?
Code:
sudo aplay -l

This should return a list similar to ths.
Code:
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 0: ALC1220 Analog [ALC1220 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 1: ALC1220 Digital [ALC1220 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

This command is similar, but only for recording/capture devices.
Code:
arecord -l

This might return something like.
Code:
**** List of CAPTURE Hardware Devices ****
card 1: Generic [HD-Audio Generic], device 0: ALC1220 Analog [ALC1220 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 2: ALC1220 Alt Analog [ALC1220 Alt Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: DeviceEcho058 [USB PnP Device(Echo-058)], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

If you've gotten this far, you are usually in pretty good shape. Now it's probably just configuration and adjusting volume levels.
This next command doesn't work on all distro's. So if you get no output, don't worry. But it's helpful if it does work.
Code:
pactl info | grep "Server Name"

If that doesn't work, we can try to do that a little differently.
First, we will look for a pulseaudio server.
Code:
systemctl --user status pulseaudio

If that doesn't return anything, don't panic yet. My computer doesn't return anything from that command.
So next, we will look for pipewire.
Code:
systemctl --user status pipewire-pulse

This might return something like...
Code:
○ pipewire-pulse.service - PipeWire PulseAudio
     Loaded: loaded (/usr/lib/systemd/user/pipewire-pulse.service; disabled; preset: disabled)
    Drop-In: /usr/lib/systemd/user/service.d
             └─10-timeout-abort.conf
     Active: inactive (dead)
TriggeredBy: ○ pipewire-pulse.socket

Now you should know more information to help us. What Linux distro are you using?
Code:
cat /etc/os-release

There have been cases, believe it or not, where the firewall has blocked sound on some distro's.
You can try disabling the firewall to see if it helps. (This usually isn't a problem in you're running firewalld).
Code:
sudo ufw disable

For some audio devices, especially SoundBlaster cards, you might need to install the alsa-firmware.
Debian/Mint/Ubuntu
Code:
sudo apt-get install alsa-firmware

Fedora/Redhat/Rocky/Oracle
Code:
dnf install alsa-firmware

Well, OK I checked all of that, and everything looks good. But I still got no sound. What else can I look at?
Code:
alsamixer

That should bring up a screen like this.
1739975174141.png


In my case, it selected the wrong sound card. How can we fix this? Press your [F6] function key that top of your keyboard.
Now you should see a list of audio devices.
1739975281790.png


Use your up and down arrow keys to pick the one you want. Depending on how many channels your audio device has, you might see something like this.
1739975510637.png


Sometimes you will only see left and right. That's OK, at least you have sound channels. Well here is a problem, and default volumes on all channels are pretty low, no wonder I can't hear anything. Let's turn things up. Use your right and left arrow keys to select the channel. Then use your up and down arrow keys to crank up the volume. My headphones, and my microphone are set to zero volume. Let's fix this.
1739975790070.png


Ahhh... much better. Everything is turned up now. But I turned up my front Microphone a little too far. (I did it on purpose so I could mention it here) if you see red at the top, It might overload your audio device and cause distortion. I recommend turning the volume down to at least the "white" levels. Now amazing enough, my headphones are working when I play audio. All I needed to do was adjust the volume here. Press the [Esc] key to exit alsamixer.

Now go back into your music player. (vlc or whatever you like) and see if it's working now. If not, at least you know a lot more information to start doing more serious troubleshooting.

Remember before you ask for help. What distro? What soundcard? What audio server? Are the kernel drivers loaded?

Happy Linux'ing. :cool:
 

Attachments

  • 1739975365249.png
    1739975365249.png
    48.4 KB · Views: 9
Last edited:


Members online


Latest posts

Top