Skip to content
July 15, 2010 / ftth

Finding which application is blocking access to an audio device on Linux

Many Linux applications will lock access to a device (e.g. Alsa audio source) when using it; the ones that don’t are the ones using daemons implementing resource sharing (e.g. PulseAudio server), and these are sometimes the ones that don’t work, so you might need this tip with either legacy software or when having trouble with middle layer daemons.

Classical case would be when a Flash player does not render audio, and you don’t undestand why; let’s just find the process using the audio device (thus, blocking access to the Flash player), and kill it.

To find which application is blocking the device, let’s just use the fuser UNIX utility:

user@machine:~$ fuser -v /dev/snd/*

/dev/snd/controlC0:  user   17365 F…. gst-launch-0.10
/dev/snd/pcmC0D0c:   user   17365 F…m gst-launch-0.10
/dev/snd/pcmC0D0p:   user   17365 F…m gst-launch-0.10
Now, let’s just kill the application using kill:
kill 17365
Note: you can also use lsof for this, but it will list ALL open files on the system, and is very resource-consuming.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: