[TIPS] Solving Ubuntu Sound Problem Without Restart

Have you ever had the sound problem in Ubuntu, especially in Ubuntu 8.10 Interpid Ibex? And to fix it you need to restart your computer, and if the sound stop working again then restart again… it’s so frustrating, isn’t it?

Now i would like to share with about how to fix it, but not really fix it, at least you don’t need to restart your computer if the sound stop working. This is based on my experience using Ubuntu 8.10 Interpid Ibex with Intel x86 processor, the sound occasionally stop working, and i don’t know why. After i tried to search what is the trigger why the sounds stop working, i found that Rhytm Box or Totem Media Player doesn’t like to play together with Mozilla Firefox 3.0.8 with Flash Media Player.

In my computer the sound will stop working if i play my songs in Totem or Rhtym Box and open Youtube site. Once again, this is based on my experience on my machine, so correct me if i’m wrong. And if you know what is the real problem, please leave me a comment.

Ok, this is how i fix the sound problem without restart:
1. Open your shell and find all process that currently using sound with this command:

lsof | grep pcm

2. After you get all proceess with the proceess id, kill all that process with this command:

kill -9

3. Restart ALSA (Advanced Linux Sound Architecture) driver with this command:

sudo /etc/init.d/alsa-utils restart

4. That’s it

How to avoid that sound problem (once again based on my experience), use banshee media player instead and you can freely watch youtube 🙂

Will this problem or “bugs” fix in Ubuntu 9.04 Jaunty Jackalope? Let’s see then… (red: This post was publish 1 day before new Ubuntu release).

If you find this tips is useful, please leave any comment. Thanks and have a nice day…

Update: This bugs have been fix in the later Ubuntu release. I’m using Ubuntu 11.04 now. and it’s working like a charm.

Comments

  1. Me says:

    I am having the exact same problem with Ubuntu 9.04. The sound will stop working after watching a few videos on youtube. I skipped your first two steps, and just entered:

    sudo /etc/init.d/alsa-utils restart

    into the command line, and that seems to fix the problem. I do appreciate your help with not having to restart the computer every time I want the sound to work. Please, does anyone know how to fix this problem? I don't have a doctorate in Linux and Ubuntu, so dumb down the answer, please.

  2. Me says:

    I am having the exact same problem with Ubuntu 9.04. The sound will stop working after watching a few videos on youtube. I skipped your first two steps, and just entered:

    sudo /etc/init.d/alsa-utils restart

    into the command line, and that seems to fix the problem. I do appreciate your help with not having to restart the computer every time I want the sound to work. Please, does anyone know how to fix this problem? I don’t have a doctorate in Linux and Ubuntu, so dumb down the answer, please.

  3. Sam says:

    Why kill -9? If you're trying to avoid a restart, why orphan all of those shared memory segments? You don't like using your RAM?

    • Anonymous says:

      i'm using "-9" because to kill the process immediately and cannot be blocked. Do you have a better idea?

  4. Sam says:

    Why kill -9? If you’re trying to avoid a restart, why orphan all of those shared memory segments? You don’t like using your RAM?

  5. Dan Stiverson says:

    The conflict between devices sounds like a lack of disconnect at the end of the previous use, and without the disconnect command there is no way for the sound device to release from your you tube site so that the sound device can reset. In doing the kill command what you are doing is providing a release of the previous connection and idling the device so that it can be reset and reused. I am not a coding expert so I cannot help resolve the issue but maybe an expert will make note of this idea and provide code to add the kill command to the buffer that connects the sound card to the website.

    • Anonymous says:

      Hi Dan,
      thanks for the idea, to be honest i'm not a coding expert too. I just try to solve the problem with my ubuntu machine.
      I hope the next release can do better.

  6. Dan Stiverson says:

    The conflict between devices sounds like a lack of disconnect at the end of the previous use, and without the disconnect command there is no way for the sound device to release from your you tube site so that the sound device can reset. In doing the kill command what you are doing is providing a release of the previous connection and idling the device so that it can be reset and reused. I am not a coding expert so I cannot help resolve the issue but maybe an expert will make note of this idea and provide code to add the kill command to the buffer that connects the sound card to the website.

    • Ivan says:

      Hi Dan,
      thanks for the idea, to be honest i’m not a coding expert too. I just try to solve the problem with my ubuntu machine.
      I hope the next release can do better.

  7. Klaas says:

    Actually, I was not viewing any videos at all, did not have a Youtube tab open in firefox and _still_ my sound system suddenly stopped working in the middle of a Coldplay song. I tried all the steps you explained, but none of them work _at all_. I just don't have any sound anymore. Seems like I have to restart my system, which actually pisses me off, if you'll excuse my French, since I am in the middle of a project.
    This is exactly one of the reasons why I left Windows about 6 months ago. I do like Linux (Ubuntu 9.04), but it still is a far cry from _the ideal system_ as so many people claim. It may be better, faster and prettier than Windows in many respects, but being free and open does have its disadvantages as well…
    Off to rebooting my system now (he wrote, angrily typing away… 😉

  8. Klaas says:

    Actually, I was not viewing any videos at all, did not have a Youtube tab open in firefox and _still_ my sound system suddenly stopped working in the middle of a Coldplay song. I tried all the steps you explained, but none of them work _at all_. I just don’t have any sound anymore. Seems like I have to restart my system, which actually pisses me off, if you’ll excuse my French, since I am in the middle of a project.
    This is exactly one of the reasons why I left Windows about 6 months ago. I do like Linux (Ubuntu 9.04), but it still is a far cry from _the ideal system_ as so many people claim. It may be better, faster and prettier than Windows in many respects, but being free and open does have its disadvantages as well…
    Off to rebooting my system now (he wrote, angrily typing away… 😉

  9. Anonymous says:

    Hi Klaas,
    Actually restart the ALSA should be enough to solve your problem.
    With this command:
    sudo /etc/init.d/alsa-utils restart
    If the sound still stopped working, please update your Ubuntu kernel to the latest release. Maybe that would help.

  10. Ivan says:

    Hi Klaas,
    Actually restart the ALSA should be enough to solve your problem.
    With this command:
    sudo /etc/init.d/alsa-utils restart
    If the sound still stopped working, please update your Ubuntu kernel to the latest release. Maybe that would help.

  11. cesium62 says:

    Didn't work for me. Using Karmic Koala 9.10, I get static when playing YouTube videos. Restarting Also didn't fix the problem.

  12. cesium62 says:

    Didn’t work for me. Using Karmic Koala 9.10, I get static when playing YouTube videos. Restarting Also didn’t fix the problem.

  13. Zelalem says:

    Hi Ivan, it is very nice. Thank you. I always used to restart and couldn't get this kind of solution.

    Cheers,

    Zelalem

  14. Zelalem says:

    Hi Ivan, it is very nice. Thank you. I always used to restart and couldn’t get this kind of solution.

    Cheers,

    Zelalem

  15. Stefan says:

    For me it seems like npviewer is usually the culprit. So if you just kill the npviewer process and then reload the youtube page, then everything should work again.

    Since alsa wasn't killed that way, you don't need to restart that.

    • Anonymous says:

      Hi Stefan,
      This is new for me.
      Thanks for sharing it with us.
      I'm using Ubuntu Karmic Koala now. And it is pretty stable, no sound and video problem anymore.
      Cheers…

  16. Stefan says:

    For me it seems like npviewer is usually the culprit. So if you just kill the npviewer process and then reload the youtube page, then everything should work again.

    Since alsa wasn’t killed that way, you don’t need to restart that.

    • Ivan says:

      Hi Stefan,
      This is new for me.
      Thanks for sharing it with us.
      I’m using Ubuntu Karmic Koala now. And it is pretty stable, no sound and video problem anymore.
      Cheers…

  17. Judson Ruhl says:

    How do you write the following command from your text:lsof | grep pcm I can't find the vertical line anywhere on my keyboard. It makes a difference because the command won't work without it.

  18. Judson Ruhl says:

    How do you write the following command from your text:lsof | grep pcm I can’t find the vertical line anywhere on my keyboard. It makes a difference because the command won’t work without it.

  19. Tony says:

    I found this same fix elsewhere, and it worked for me… precisely once. Now I get nothing. Even worse, now when I do "sudo lsof | grep pcm", it hangs and I have to Ctrl-C to get out of it. I need to use "sudo" because the problem is always that I have a multi-user laptop and the sound problem ONLY occurs when I switch from my wife's to MY user account.

    I actually don't have to restart the entire computer. I just need to switch users, log out of my wife's account, then switch back to me. But that is still really annoying and shouldn't be that way.

    I have Ubuntu 9.10 on a Dell Inspiron 1525 – it is completely up-to-date, and was installed fresh (not updated from 9.04 or anything). Any ideas?

    • Anonymous says:

      Hi Tony,
      I have the same problem lately when using the latest kernel of ubuntu karmic.
      I will find solution and post on my blog soon.
      Cheers
      Ivan

  20. Tony says:

    I found this same fix elsewhere, and it worked for me… precisely once. Now I get nothing. Even worse, now when I do "sudo lsof | grep pcm", it hangs and I have to Ctrl-C to get out of it. I need to use "sudo" because the problem is always that I have a multi-user laptop and the sound problem ONLY occurs when I switch from my wife's to MY user account.

    I actually don't have to restart the entire computer. I just need to switch users, log out of my wife's account, then switch back to me. But that is still really annoying and shouldn't be that way.

    I have Ubuntu 9.10 on a Dell Inspiron 1525 – it is completely up-to-date, and was installed fresh (not updated from 9.04 or anything). Any ideas?

    • Ivan says:

      Hi Tony,
      I have the same problem lately when using the latest kernel of ubuntu karmic.
      I will find solution and post on my blog soon.
      Cheers
      Ivan

  21. Tony says:

    Fixed it!

    The "bug" is described here: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/433654/

    Go to comment #47. The fix is described there.

  22. Tony says:

    Fixed it!

    The "bug" is described here: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/433654/

    Go to comment #47. The fix is described there.

  23. Jesse says:

    Kudos to you man, thanks for making my life (using Ubuntu anyway) a lot easier. This sound thing was plaguing my big time. Who thinks restarting is a viable option when you've got several windows open and a bunch of work to do? Kudos, kudos.

  24. Jesse says:

    Kudos to you man, thanks for making my life (using Ubuntu anyway) a lot easier. This sound thing was plaguing my big time. Who thinks restarting is a viable option when you've got several windows open and a bunch of work to do? Kudos, kudos.

  25. sunny says:

    awesome thanks man…fixed my problem as well…hated rebooting :))

  26. sunny says:

    awesome thanks man…fixed my problem as well…hated rebooting :))

  27. used computers says:

    I actually don't have to restart the entire computer. I just need to switch users, log out of my wife's account, then switch back to me. But that is still really annoying and shouldn't be that way.

  28. hestle says:

    this problem was the norm for me till now. thanks heaps.
    by the way, it was interesting to notice that i used to be able to just close the program wether it be mozilla or totem and then it would let me used the sound device again for another program i started, without having to restart the computer.
    but now, it completely locks down and i have to restart.
    but thanks to you it should be solved. 🙂

  29. hestle says:

    Im a bit stupid for not trying it before i said it would work.
    because, my computer will not list the processes when i used that command, because it says that "output information may be incomplete" and gives a warning.
    then, i tried to kill -9 and it didnt understand that it tried to suggest the sequence in which i should use that command.
    on the otherhand, the alsa restart command works fine. but it still doesnt let me used the sound device, /dev/dsp.
    thanks anyway, just thought id let you know, about my retarded computer. and me.

  30. Roadapathy says:

    This is great info but I can say that Maverick sound was even worse than Lucid. I think Ubuntu needs to take the sound issues seriously. They did so well on everything else.

  31. Gustin g says:

    i tried it on ubuntu 10.10 and the reply was the command is not found

  32. mad2bthere says:

    its incredible it still works for ubuntu 18.04

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.