Home | News | Download | Packages | Forum | Wiki | Github

[SOLVED] After initial install and package update, ALSA fails to play audio


(Samuel A. Falvo II) #1

I’m a new-comer to Void Linux, and I am impressed with what I see over-all. XBPS is lightning fast compared to DPKG managers, and yet doesn’t skimp on the functionality. I decided to install Void w/out any desktop environment, primarily because I’m tired of all the bloat, and decided to just go with ROX-Filer and iceWM. I was even surprised that wifi worked with minimal assistance from me. Great work and many thanks for your effort!

Everything is working great on my System76 Galago laptop from 2015, with one exception: sound. After spending the last three days looking through forum posts both on Void and on StackExchange sites, I’m turning up blank. No matter what I do, I attempt to execute the following command:

# as root user
aplay --file-type wav /usr/share/sounds/alsa/Front_Center.wav

and I get back the same results:

ALSA lib pcm_dmix.c:1099:(snd_pcm_dmix_open) unable to open slave
aplay: main:828: audio open error: No such file or directory

ALSA appears to properly recognize the hardware provided by the laptop. It has two cards: card 0 contains five HDMI controls, while card 1 contains what appears to be your traditional sound card devices (PCM output, Mic input, et. al.). alsamixer allows me to select between these two cards (default is 0) and make changes to the settings. These settings do persist between runs of alsamixer, so I’m confident that it must be talking to hardware at some point.

Nonetheless, even with all controls set to maximum, I do not receive any audio.

After some digging around, I also discovered problems getting PulseAudio running. This may be related, but I cannot be sure:

# as root user
cd /etc/sv/pulseaudio
./run

This results in the following diagnostic output:

W: [pulseaudio] main.c: Running in system mode, but --disallow-exit not set.
W: [pulseaudio] main.c: Running in system mode, but --disallow-module-loading not set.
N: [pulseaudio] main.c: Running in system mode, forcibly disabling SHM mode.
N: [pulseaudio] main.c: Running in system mode, forcibly disabling exit idle time.
W: [pulseaudio] main.c: OK, so you are running PA in system mode. Please make sure that you actually do want to do that.
W: [pulseaudio] main.c: Please read http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/WhatIsWrongWithSystemWide/ for an explanation why system mode is usually a bad idea.
W: [pulseaudio] main.c: Unable to contact D-Bus: org.freedesktop.DBus.Error.NoServer: Failed to connect to socket /run/dbus/system_bus_socket: Connection refused

I have confirmed the existence of the socket, and indeed, that dbus is running:

[root@fomalhaut pulseaudio]# ls -la /run/dbus
total 0
drwxr-xr-x  2 dbus dbus  60 Apr 11 22:31 .
drwxr-xr-x 18 root root 500 Apr 11 22:31 ..
srwxrwxrwx  1 root root   0 Apr 11 22:31 system_bus_socket
[root@fomalhaut pulseaudio]# ps awfux | grep dbus
root      8051  0.0  0.0  10888  2328 pts/0    S+   22:51   0:00  |                       |   |               \_ grep dbus
kc5tja    7119  0.0  0.0  22692   248 ?        S    22:23   0:00 dbus-launch --autolaunch 712ecc0bb918c563752fe17c5acc41a3 --binary-syntax --close-stderr
kc5tja    7120  0.0  0.0  13352   176 ?        Ss   22:23   0:00 /usr/bin/dbus-daemon --syslog-only --fork --print-pid 5 --print-address 7 --session

Permissions all look correct to me. Both root and my normal user are in the audio group. alsamixer properly recognizes the hardware my laptop provides, and if I mute or unmute the mic input, I hear gentle clicks on the speakers, so I know something is talking to the hardware.

I genuinely believe that there are several issues afoot here, but I can’t even begin to know where to look next. If I can receive additional guidance on where to look next, I would be grateful indeed.

Thank you for your time.


(Erin) #2

Pulse isn’t always the right solution. Alsa is likely outputting to HDMI (card 0) and not to card 1 (the standard outputs). You can use aplay and force it to output onto card 1 by modifying the aplay line to aplay -D hw1:0 --file-type wav /usr/share/sounds/alsa/Front_Center.wav and there is certainly no need to do any of this as root. The results from here can be put into your ~/.asoundrc file. There are lots of guides on the 'Net and on this forum to discuss sound and setting it up.

Strongly recommend reading https://wiki.voidlinux.eu/Post_Installation as well.


(Samuel A. Falvo II) #3

I don’t wish to sound snide, but I have checked a huge pile of online resources already (I’ve spent days on this issue), and none of them work. They are too numerous to list here.

I’ve already read the Post_Installation wiki page as well; as noted above, I illustrated that alsamixer is seems to be working to at least some degree.

I’ve tried overriding the device with the flags and .asoundrc overrides. Still, the same results.

[kc5tja@fomalhaut ~]$ aplay -D hw1:0 --file-type wav /usr/share/sounds/alsa/Front_Center.wav 
ALSA lib pcm_hw.c:1806:(_snd_pcm_hw_open) Invalid value for card
aplay: main:828: audio open error: No such device

From the recommendation of some ArchLinux resources, I’ve tried two variations of ~/.asoundrc file contents, neither of which make a dent on the issue:

pcm.!default {
	type hw
	card 0
}

ct.!default {
	type hw
	card 0
}

and

pcm.!default {
	type hw
	card 1
}

ct.!default {
	type hw
	card 1
}

both give identical results.

Thanks for any additional input you can provide on this issue.


#4

A shot in the dark: perhaps you need alsa-firmware (if you haven’t installed it, yet)?


(Samuel A. Falvo II) #5

After some inspiration struck, based on Erin’s mention of the -D flag, I decided to poke around a bit more with what Alsa thinks I have.

[kc5tja@fomalhaut ~]$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
hdmi:CARD=HDMI,DEV=0
    HDA Intel HDMI, HDMI 0
    HDMI Audio Output
hdmi:CARD=HDMI,DEV=1
    HDA Intel HDMI, HDMI 1
    HDMI Audio Output
hdmi:CARD=HDMI,DEV=2
    HDA Intel HDMI, HDMI 2
    HDMI Audio Output
hdmi:CARD=HDMI,DEV=3
    HDA Intel HDMI, HDMI 3
    HDMI Audio Output
hdmi:CARD=HDMI,DEV=4
    HDA Intel HDMI, HDMI 4
    HDMI Audio Output
sysdefault:CARD=PCH
    HDA Intel PCH, VT1802 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, VT1802 Analog
    Front speakers
surround21:CARD=PCH,DEV=0
    HDA Intel PCH, VT1802 Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0
    HDA Intel PCH, VT1802 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
    HDA Intel PCH, VT1802 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
    HDA Intel PCH, VT1802 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
    HDA Intel PCH, VT1802 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
    HDA Intel PCH, VT1802 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers

Good grief that’s a lot, but I decided to try using -D to iterate through the list of supported analog PCH devices, and made a small bit of progress:

[kc5tja@fomalhaut ~]$ aplay -D surround71:0,0 --file-type wav /usr/share/sounds/alsa/Front_Center.wav 
aplay: main:828: audio open error: No such file or directory
[kc5tja@fomalhaut ~]$ aplay -D surround51:0,0 --file-type wav /usr/share/sounds/alsa/Front_Center.wav 
aplay: main:828: audio open error: No such file or directory
[kc5tja@fomalhaut ~]$ aplay -D surround50:0,0 --file-type wav /usr/share/sounds/alsa/Front_Center.wav 
aplay: main:828: audio open error: No such file or directory

Looking at https://github.com/bear24rw/alsa-utils/blob/master/aplay/aplay.c#L687-L691 seems to suggest that the necessary device files do not exist, even though I have a set of devices in /dev/snd:

[kc5tja@fomalhaut ~]$ ls -l /dev/snd
total 0
drwxr-xr-x 2 root root       80 Apr 11 11:22 by-path
crw-rw---- 1 root audio 116,  2 Apr 11 11:22 controlC0
crw-rw---- 1 root audio 116,  9 Apr 11 11:22 controlC1
crw-rw---- 1 root audio 116,  8 Apr 11 11:22 hwC0D0
crw-rw---- 1 root audio 116, 13 Apr 11 11:22 hwC1D0
crw-rw---- 1 root audio 116,  7 Apr 11 22:49 pcmC0D10p
crw-rw---- 1 root audio 116,  3 Apr 11 22:49 pcmC0D3p
crw-rw---- 1 root audio 116,  4 Apr 11 22:49 pcmC0D7p
crw-rw---- 1 root audio 116,  5 Apr 11 22:49 pcmC0D8p
crw-rw---- 1 root audio 116,  6 Apr 11 22:49 pcmC0D9p
crw-rw---- 1 root audio 116, 11 Apr 11 22:49 pcmC1D0c
crw-rw---- 1 root audio 116, 10 Apr 11 22:49 pcmC1D0p
crw-rw---- 1 root audio 116, 12 Apr 11 11:22 pcmC1D2p
crw-rw---- 1 root audio 116,  1 Apr 11 11:22 seq
crw-rw---- 1 root audio 116, 33 Apr 11 11:22 timer

I think I need to focus my attention onto whatever is determining the module selection to be loaded into the kernel (possibly udev configs?).


(Samuel A. Falvo II) #6

@bluemoon Oh, I wasn’t aware of this. I’ll give that a shot. Thanks!


#7

I don’t know if it was an error in copying but it should be:

ctl.!default {

You missed an l in ctl, which may be causing the Invalid value for card error.


(Samuel A. Falvo II) #8

@bluemoon Installation of the module did not seem to alter anything so far.

@hipperson0 Good point, and good eye. Goes to show you how long I’ve been hacking on it. I think this yielded the largest progress; however, it’s still not playing audio.

Here is what I currently have now:

pcm.!default {
	type hw
	card 1
}

ctl.!default {
	type hw
	card 1
}

and here’s what I get when I try to play a sound file:

[kc5tja@fomalhaut ~]$ aplay --file-type wav /usr/share/sounds/alsa/Front_Center.wav 
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: set_params:1345: Channels count non available

For grins, I also tried using alsactl init as well:

alsactl: sysfs_init:48: sysfs path '/sys' is invalid

Found hardware: "HDA-Intel" "Intel Haswell HDMI" "HDA:80862807,15587410,00100000" "0x1558" "0x7410"
Hardware is initialized using a generic method

I’m not sure if this information means anything to anyone. Curious that it has an issue with /sys, though I am able to list /sys just fine.


(Samuel A. Falvo II) #9

YAY! I fixed it!

After some more digging (had to look specifically for “Channels count non available”), I came across this forum post: [Solved] ALSA: Channels count not available

The solution that worked for me ultimately was the same as the solution in that article: setting the module configuration and rebooting. Sound now works great.

Thanks to @Erin, @bluemoon, and @hipperson0 for all your suggestions. They provided the intellectual walk-way that allowed me to eventually stumble upon the solution for my problem. You’ve all been very helpful!