Difference between revisions of ""arecord: ... audio open error: Device or resource busy""

From Noah.org
Jump to navigationJump to search
(Created page with "Category:Engineering When trying to record some sound from the command-line you see an error message like this: <pre> # arecord -d 5 -f S16_LE -r 44100 -D plughw:2,0 test...")
 
m
 
Line 7: Line 7:
 
</pre>
 
</pre>
 
This puzzled me for a while because I couldn't see anything obvious running on my laptop.
 
This puzzled me for a while because I couldn't see anything obvious running on my laptop.
I figured some kernel thing had left something lying around. But I didn't see any defunct zombie processes running. So the process was still running or the kernel itself had the sound hardware reserved. This
+
I figured some kernel thing had left something lying around. But I didn't see any defunct zombie processes running. So the process was still running or the kernel itself had the sound hardware reserved. I used '''fuser''' to see what was using anything under '''/dev/snd/*'''.
 
<pre>
 
<pre>
fuser -fv /dev/snd/* /dev/dsp*
+
# fuser -fv /dev/snd/*
Specified filename /dev/dsp* does not exist.
 
 
                     USER        PID ACCESS COMMAND
 
                     USER        PID ACCESS COMMAND
 
/dev/snd/controlC0:  root        843 F.... pulseaudio
 
/dev/snd/controlC0:  root        843 F.... pulseaudio
Line 21: Line 20:
 
</pre>
 
</pre>
  
I don't know how pulseaudio got started and I don't know how I did not notice it running. Fortunately that what '''fuser''' was made for.
+
I don't know how pulseaudio got started and I don't know how I did not notice it running. Fortunately that what '''fuser''' was made for. The fact that all the pcm devices were mmap'ed is what was locking the audio device.

Latest revision as of 00:29, 14 January 2019


When trying to record some sound from the command-line you see an error message like this:

# arecord -d 5 -f S16_LE -r 44100 -D plughw:2,0 test.wav
arecord: main:828: audio open error: Device or resource busy

This puzzled me for a while because I couldn't see anything obvious running on my laptop. I figured some kernel thing had left something lying around. But I didn't see any defunct zombie processes running. So the process was still running or the kernel itself had the sound hardware reserved. I used fuser to see what was using anything under /dev/snd/*.

# fuser -fv /dev/snd/*
                     USER        PID ACCESS COMMAND
/dev/snd/controlC0:  root        843 F.... pulseaudio
/dev/snd/controlC1:  root        843 F.... pulseaudio
/dev/snd/controlC2:  root        843 F.... pulseaudio
/dev/snd/pcmC0D0p:   root        843 F...m pulseaudio
/dev/snd/pcmC1D0c:   root        843 F...m pulseaudio
/dev/snd/pcmC2D0c:   root        843 F...m pulseaudio
/dev/snd/pcmC2D0p:   root        843 F...m pulseaudio

I don't know how pulseaudio got started and I don't know how I did not notice it running. Fortunately that what fuser was made for. The fact that all the pcm devices were mmap'ed is what was locking the audio device.