FIX: MPD Failed to open ALSA device "hw:0,0" Device busy

No Sound / No Playback through MPD?
Sometimes MPD has a little heart attack and cannot playback if you are using multiple players.

Check the MPD log to see if you have this error:

tail -f  /var/log/mpd/mpd.log
alsa_output: Failed to open "Output" [alsa]: Failed to open ALSA device "hw:0,0": Device or resource busy

If you have the above error, its best to comment out the device parameter in mpd.conf

Edit mpd.conf

nano /etc/mpd.conf

edit as follows, comment out the device “hw:0,0”

[code]audio_output {
type “alsa”
name “Output”

device “hw:0,0”

             dsd_usb        "yes"
             auto_resample  "no"

}[/code]

Restart MPD

/etc/init.d/mpd restart

Could you explain when exactly does it happen?

I tend to notice it if I leave my Volumio running overnight, it dead in the morning and I have to SSH in.

I have not been able to reproduce the error in a consistent manner. My first thought was that it may be related to the updated version of MPD, so I switched back and tried the old one. Same issue… Phew, so its not the “new thing” that broke it :stuck_out_tongue:

Then, I traced through the logs and found that MPD explicitly tries to bind to the device 0,0. Which, as far as I understand, is not really required if you have configured ALSA to set the USB DAC as the default playback device. Binding to a device at application level, to my knowledge, will not allow anything else to playback to it.

This is not so much an issue if you are only using MPD, but I am also using Shairport and Squeeze, so I kinda need to make the amends I outlined.

Equally, you have to make sure the device bindings are commented out in Shairport and Squeeze :slight_smile:

ALSA Config in Volumio:

root@volumio:~# cat /etc/modprobe.d/alsa-base.conf
# autoloader aliases
install sound-slot-0 /sbin/modprobe snd-card-0
install sound-slot-1 /sbin/modprobe snd-card-1
install sound-slot-2 /sbin/modprobe snd-card-2
install sound-slot-3 /sbin/modprobe snd-card-3
install sound-slot-4 /sbin/modprobe snd-card-4
install sound-slot-5 /sbin/modprobe snd-card-5
install sound-slot-6 /sbin/modprobe snd-card-6
install sound-slot-7 /sbin/modprobe snd-card-7
# Cause optional modules to be loaded above generic modules
install snd /sbin/modprobe --ignore-install snd && { /sbin/modprobe --quiet snd-ioctl32 ; /sbin/modprobe --quiet snd-seq ; : ; }
install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi && { /sbin/modprobe --quiet snd-seq-midi ; : ; }
install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 && { /sbin/modprobe --quiet snd-emu10k1-synth ; : ; }
# Keep snd-pcsp from beeing loaded as first soundcard
options snd-pcsp index=-2
# Keep snd-usb-audio from beeing loaded as first soundcard
#options snd-usb-audio index=-2
# Prevent abnormal drivers from grabbing index 0
options bt87x index=-2
options cx88_alsa index=-2
options snd-atiixp-modem index=-2
options snd-intel8x0m index=-2
options snd-via82xx-modem index=-2
options snd-usb-audio nrpacks=1

We already have the USB as the default playback device (see below) :slight_smile: Do we have to explicitly configure the device in each player? By commenting it out I have not noticed any sound quality degradation and all players can now use USB Dac.

[code]

Keep snd-usb-audio from beeing loaded as first soundcard

#options snd-usb-audio index=-2[/code]

Will do some more debugging and let you know if the GUI crashes are fixed :slight_smile:

hello,
i thought I found the hooly grail by applying this method …
but it didn’t work :
I got a mutual exclusion between mpd and squeezlite : first come first served

apparently, the sound application grabs the output device at the physical layer, ot at the alsa subdevice layer.
This prevents simultaneous activation and playback of all apps (I also use shairport)
I am using a hifiberry dac

my sound driver configuration shows the following :
root@volumio:/var/log# aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=sndrpihifiberry
snd_rpi_hifiberry_dac,
Default Audio Device
sysdefault:CARD=sndrpihifiberry
snd_rpi_hifiberry_dac,
Default Audio Device
root@volumio:/var/log# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

I applied the recommendations of this post but no success.
mpd fails if squeezelite started and vice-versa

any idea on how to tweak alsa ?

This is meant to happen! Just one app has control over the alsa device.
The thing I can tell is just stop the squeeze if you’re using mpd, and viceversa.
I was looking at a way to make it automatically, using inotify. If mpd plays then stops squeeze…

I am not sure of what you mean by “meant to happen” …

Is this a deliberate choice to have only one app work exclusively with the device ?

or something we can’t fix ?

In the latter case, at the conceptual level, if we can configure alsa to accept multiple subdevices mixed into the default physical dac within the bcm2835, I am pretty sure we can find a similar configuration for the hifiberry dac.

I simply don’t know how.
Does anyone have a clue ?

if the choice has been made with regards to audiophilia principles, I can understand but I am not sure of how much perturbation alsa would add.
At least, I would like to hear the difference.

what do you think ?

Did anyone already found a solution for this?
I’m also having this problem using both Squeeze and Shairport (with Wolfson soundcard on RPI)

Some kind of automatic release of the ALSA-driver when switching apps would be great.

Hi
having the same problem.

Any solution in sight?

Thanks thomas

Commenting out the line in mpd.conf worked for me. I had tried the deselect i2s DAC/reboot/reselect i2s DAC/reboot method, but the “failed to open ALSA device HW:0,1” error continued. Thanks for this suggestion!

Raspi 3 with Hifiberry DAC+ Pro

I have the same issue now, but commenting out the line just changed the error to “device ‘default’ busy”. It’s on a Mini86 from your shop. Do you have any advice?