279

I was listening to music, and my sound suddenly went dead in all my applications. I'm using Ubuntu 12.04, which uses pulseaudio, so I tried sudo /etc/init.d/pulseaudio restart, but nothing happened. According to lsof | grep pcm, nothing is using the soundcard at the moment, although I'm not entirely sure if my source for that command is applicable.

Is there a way another way to restart Ubuntu 12.04's sound system from the command line without rebooting the system?

Organic Marble
  • 23,641
  • 15
  • 70
  • 122
  • 2
    This answer worked for me. http://askubuntu.com/questions/15223/how-can-i-restart-pulseaudio-without-logout – rickfoosusa Aug 25 '14 at 23:58
  • I think the solution really depends on the computer you have and the ubuntu version installed on it. For me none of the 2 top answers worked. joeytwiddle's answer worked. I have a Lenovo Legion Y520 with Ubuntu 16.04: sudo pm-suspend is the only thing that worked for me. – Yoann Pageaud Sep 03 '19 at 13:05
  • This is NOT an answer to the question, however, this page show up in the top when searching for how to fix the sound in Ubuntu 18 and 19. When having trouble with the motherboard built-in Intel soundcard, this solution has worked for me: https://www.linuxuprising.com/2018/06/fix-no-sound-dummy-output-issue-in.html Excerpt: Ubuntu 18: add "options snd-hda-intel model=generic" at the end of the /etc/modprobe.d/alsa-base.conf reboot Ubuntu 18, 19, 20. Kernel 5.3.0-41 and -42: Edit /etc/modprobe.d/alsa-base.conf as root and add "options snd-hda-intel dmic_detect=0" Edit /etc/modprobe.d/blacklist.c – thomasa88 May 16 '20 at 15:07

10 Answers10

529

I've used pulseaudio -k && sudo alsa force-reload a couple of times, and it worked well. The first part kills pulseaudio, the second reloads ALSA. You don't need to restart pulseaudio, because it auto-restarts.

mikewhatever
  • 32,638
  • 18
    This helped to me to fix the issue 'no sound after suspend' I have suffered from for don't remember how long. – khustochka Aug 31 '13 at 19:19
  • Ubuntu sometimes freezes for me and goes mental for about 10 minutes, after which it "wakes up" in a bit of a daze, including the sound not working. This fixed it! – Matt Fletcher Nov 28 '13 at 14:19
  • This can also occur if the AudioThread is killed by the OOM killer thanks to misbehaving apps. The above worked perfectly. – Ken Sharp Mar 03 '14 at 14:41
  • 2
    Sometimes you might need to clear pulse config with "rm -R ~/.pulse*" before issuing any restart. – Radu Maris Sep 23 '14 at 11:33
  • 1
    It works for me after my USB headphone stop to work. – Felipe Oct 20 '14 at 22:47
  • This works when I plug laptop to TV via HDMI, it helps to show hdmi option in sound output so I can select it. I would like to be able to do this via GUI or trigger it once device is plugged to hdmi port. – umpirsky Jan 16 '15 at 16:59
  • I had to instead sudo service pulseaudio stop && sudo alsa force-reload && sudo service pulseaudio start. Thanks for the answer! – Mike S Aug 26 '15 at 22:24
  • At my side I had to also re-plug the HDMI cable of the monitor to get sound working again. – Tino May 26 '16 at 17:32
  • This worked for me after the left headphones stopped working. – crafter Sep 27 '16 at 09:34
  • This worked for me in Ubuntu 16.04.2 when used HDMI audio and closed the lid on my DELL laptop. Audio in built in speakers or headphone didn't work until I ran this command! Thanks! – user886869 Apr 07 '17 at 11:31
  • I don't have a pulseaudio service (17.04), so wasn't able to restart it (Failed to restart pulseaudio.service: Unit pulseaudio.service not found.) but I did have sound again after /usr/bin/pulseaudio --start. I'm sure rebooting would've worked, too, but couldn't at the time. – michael Aug 09 '17 at 11:32
  • Very good, i open my voice card to capture microphone. when finishing program with ctrl + c , and run program next time error: client-l2cap: pcm_params.c:2290: snd_pcm_hw_refine: Assertionpcm && params' failed. Aborted (core dumped) ` and must be restarting system to use next time sound card, reloading voice module works great, you save me time. – EsmaeelE Sep 04 '17 at 04:39
  • 14
    pulseaudio -k saved my life ! no sudo needed – Aitch Apr 10 '18 at 21:15
  • 6
    still work in 18.04 – Fat Mind Jan 29 '19 at 18:34
  • It seems that my soundcard hangs hard enough in Ubuntu 18.04 that I need to do this twice with a two second sleep in between. If I run it once or twice without a delay, it does not fix the audio. (My hardware is integrated audio on Asus P8H77-M PRO.) – Mikko Rantalainen Aug 22 '19 at 17:02
  • alsa executable missing, any replacement? – akostadinov Feb 06 '20 at 19:46
  • after one entire year rebooting the machine, I found the solution. Really, I want to cry! Thank you :P (I don't know why I did not look for a solution before). It works for Xubuntu 18.04 too – Leos313 Apr 24 '20 at 14:39
  • 1
    Confirmed for the upcoming 20.4 Ubuntu. fixes HDMI audio corruption. – twobob May 02 '20 at 23:10
  • 1
    Yep. The HDMI audio on Ubuntu 20.04 dies after the screen saver goes on -- this command restores it (as does replugging the HDMI). – Chris Nadovich Aug 13 '20 at 18:02
  • Solved the stream sounds going noisy bug for me. – Pica Dec 15 '20 at 10:23
  • still work in 21.10 – rfrp Mar 17 '22 at 13:05
  • In my case, plugging my HDMI cable into a different TV than normal is what caused me to lose audio. @Aitch' s answer is what did the trick for me pulseaudio -k which, as the man page for pulseaudio explains, will "kill an already running PulseAudio daemon of the calling user (Equivalent to sending a SIGTERM)." – hlongmore Feb 18 '23 at 04:11
  • I needed to launch: pulseaudio --start because I didn't have alsa binary – Et7f3XIV May 26 '23 at 22:30
  • Running pulseaudio -k returns an error for me on the standard desktop edition of 22.04. I needed to run systemctl --user restart pulseaudio-x11 instead. – Cory Gross Nov 10 '23 at 10:00
70

What I do when my sound doesn't work is

killall pulseaudio

and then I press Alt + F2 and type in pulseaudio. It usually works for me.

Pablo Bianchi
  • 15,657
tofurator
  • 1,379
  • What is the difference between this and systemctl --user restart pulseaudio? The restart worked for me before, but today it did not and I needed to kill it (it seemed to automatically restart, when I typed pulseaudio in a terminal it errored that the daemon is already running). – Luc Sep 23 '21 at 12:32
  • There isn't much difference in practice. This answer relies on systemd detecting that pulseaudio has crashed and restarting it. Your version does this explicitly. – Tim McNamara Sep 27 '21 at 07:17
62

Just for completeness, in newer Ubuntus versions that use systemd, I used this and it worked well:

systemctl --user restart pulseaudio

Governa
  • 751
  • 6
    this answer fixed my problem – Marlon Jun 21 '20 at 17:23
  • 4
    This is the way to restart PulseAudio in Ubuntu 20. Thank you! – kas Nov 01 '20 at 19:43
  • 1
    This, along with killing/restarting Alsa, allowed me to get the audio working on my Acer Swift 3 (Ryzen 4700U) under Kubuntu 20.10. – Pockets Nov 12 '20 at 04:46
  • 1
    This answer is very useful since pulseaudio won't function properly after a session change (or CTRL-ALT-BACKSPACE) in ubuntu 20.04 – JB. Jun 03 '21 at 14:13
  • still works in 2023 with an up-to date ubuntu – Martin Krung Jul 04 '23 at 07:54
  • Looks like the service is now named pulseaudio-x11. Running systemctl --user restart pulseaudio-x11 worked on my system running the standard desktop edition of version 22.04. – Cory Gross Nov 10 '23 at 09:57
29

In my case there were nasty messages in kern.log / dmesg:

sound hdaudioC0D2: HDMI: invalid ELD buf size -1

The solution was simply to suspend and resume the machine!

$ sudo pm-suspend
joeytwiddle
  • 1,957
11

For the new multimedia framework Pipewire, which became the default since Ubuntu 22.10, restart the Pipewire services.

❯ systemctl --user restart pipewire.service

if the above is not enough, try

❯ systemctl --user restart pipewire-pulse.service

Rahil Wazir
  • 319
  • 6
  • 11
1

I had exactly the same symptom: sound suddenly died (after trying to use Audacity, in my case). The OP didn't mention he was/wasn't wearing headphones, which was my case. I tried all options here and, when going to Preferences and changing to HDMI or Speaker output worked, but switching to Headphones didn't work (no sound). I then tried to unplug and re-plug the headphones and it worked.

1

I encountered this issue with a USB audio device that would sometimes when booting the machine, not connect properly leaving me without audio until a reboot. If you are someone who is having the same issue but with a USB audio device then I recommend the following which fixed it for me:

sudo rmmod xhci_pci && sudo rmmod xhci_hcd && sudo modprobe xhci_pci xhci_hcd

None of the other answers would fix it and I assume that came down to the USB device not registering properly on boot. This simply reboots the USB devices. Note: you should only run all commands at once, running sudo rmmod xhci_hcd alone will disable all USB devices e.g., your keyboard, meaning the remaining commands cannot be run.

I will be honest and say that I doubt that the xchi_pci part is necessary, so if someone is more knowledgeable regarding this please correct me.

Hive7
  • 111
  • 2
1

For me on MX Linux 23 (Debian 12.1) the following worked:

sudo alsactl -F restore
SimonH
  • 115
0

Sleeping + waking up the PC is the only thing that's fixed it for me (other than a reboot). I'm using bluetooth audio w/ the notoriously buggy intel ax20x.

0

Have you looked inside the folder to see if pulseaudio was available in init.d, try replacing pulse audio with alsa-utils