LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Restart Sound Daemon? (http://www.linuxquestions.org/questions/linux-software-2/restart-sound-daemon-637065/)

gymnart 04-22-2008 12:20 PM

Restart Sound Daemon?
 
Yesterday (4/21/08) I was trying out a radio stream (it did not work) and for some reason, after that, when I went to play music in Amarok and then XMMS, the sound no longer worked. I had to restart my computer (turn completely off then back on) to get the sound back. My guess is that the stream, which did not work, had "hijacked" my sound.

How can I restart the sound without having to shut down the computer then turning it back on?

atheist 04-22-2008 12:30 PM

I've had the same problem... Except that it was enough for me to restart the X server. Would love to get a solution, since it's really annoying having to exit X every few weeks.

tredegar 04-22-2008 01:23 PM

For debian (and the ?buntu's) you can restart the sound system with

/etc/init.d/alsa-utils restart

It'll be something similar for Suse, and you'll need to be root.

gymnart 04-22-2008 01:42 PM

I looked in the /etc/init.d directory and the only thing I found that was alsa related was, "alsasound"

So would it be, "/etc/init.d/alsasound restart"? (without the quotes of course).

tredegar 04-22-2008 01:45 PM

Quote:

So would it be, "/etc/init.d/alsasound restart"? (without the quotes of course).
You could give it a try, and see what happens ;)

gymnart 04-22-2008 01:57 PM

I just did and it worked. Funny thing was that the icon for KMix was gone after that. So I restarted KMix.

Thanks much for your suggestion!

tredegar 04-22-2008 02:06 PM

Pleased it worked.
kmix probably disappeared as there was no sound system for it to mix. If you had logged out and back in again (not rebooted), it probably would have reappeared, but you fixed it anyway.

To prevent things grabbing audio and not letting go, I have a KDE setting in kcontrol -> Sound system -> General, that is titled "Auto-suspend". I set this to "Auto suspend if idle after 1 second", and these things do not happen.

gymnart 04-23-2008 11:35 AM

Thanks for that info!
Mine was set to 5 seconds. I reset it like you have yours.

eeconsult 12-14-2009 12:24 PM

Another Option - restart alsa directly
 
Another option to consider if the methods in the above thread do not work, is to restart the alsa kernel drivers.

On my Debian Lenny installation, "alsa-utils reload" does not reload the kernel drivers (at least not successfully - assuming it tries at all).

After trying the other methods listed in this thread without success, I found that my audio would come back after typing "alsa force-reload" as root (which removes and replaces the alsa kernel drivers among other things.) (The alsa command should be in root's path, and on my system is located at /usr/sbin/alsa)

Note however that typing that command results in the immediate termination of applications that have the audio open. (The volume control in gnome, for example.) It also killed my firefox apparently because it had a flash object present. (Of course firefox came back nicely afterwards using its automatic session save feature.) Similarly, the gnome volume control restarted all by itself simply by clicking the "retry" button on the popup that was telling me the volume control had terminated unexpectedly.

I hope this helps.

Happy linuxing.

tredegar 12-14-2009 06:23 PM

eeconsult,

This LQ thread is dated March 2008.

It is well out of date, and not worth posting to.

But welcome to LQ!

eeconsult 12-15-2009 12:17 AM

tredegar,

The thread is certainly old, it's true.

However Google is giving is a second life, so to speak. It came up in my initial search when I had first encountered this issue, and still does today.

I therefore thought it deserved some update and expansion. It can now serve a broader audience (with a wider variety of system difficulties) because of the mixture of solution approaches.

And thanks for the welcome! I appreciate it.

gymnart 12-16-2009 01:46 PM

That's great! I was hoping that this thread would help someone like it did for me. :)

Shadow_7 12-16-2009 02:11 PM

/etc/init.d/alsasound stop
/etc/init.d/alsasound start

Although that does depend on a proper configuration to start with for module auto loading. Also it does not address WHY your sound device went out of bounds to start with. Most times I find that some sound daemon got started that I don't typically use. artsd? Which locks the sound device from being used by other means. XMMS lets you choose which method to use for access, but it doesn't to my knowledge auto detect, nor auto changes on the fly after launch.

Fortunately most media players let you choose, and if you know which access method you are / intend / got forced to use, you can configure accordingly. Just have a slight awareness of what's going on behind the magic curtain. And keep some familiarity with your ps output so that you know when one of these things is not like the others. It also helps you identify those, I closed this application, but ps says it's still running things. Which could also be WHY you lost access. From a certain point of view, rebooting, or restarting your drivers is a last resort. It's something that you should NOT have to do if things are working the way that they're supposed to work. Although it is generally the quickest fix.

agordillo 09-16-2010 03:37 AM

After much effort without success, I just tried as root the command:

alsa force-reload

and it worked fine. It killed all the process using the sound driver and restarted the sound system without restarting the X server.


All times are GMT -5. The time now is 12:27 PM.