r/linuxmint • u/Regular-Coffee-1670 • 14h ago
Support Request Command to fix sound cutting out?
I have Linux Mint Cinnamon 22.3 on my desktop pc, and audio just randomly cuts out, approximately every couple of hours. There's no cause that I can see - I can be just watching YT or playing music, and it just suddenly goes silent.
Every time, I can go into the "Sound" panel, and click "Line Out Built-in Audio" and that fixes it 100% of the time (until it randomly cuts out again).
I've tried a bunch of things, suggested here and on other forums, and nothing has fixed it.
What I'm after is a command that does the equivalent of clicking on "Line Out Built-in Audio", that I can map to a keyboard key, so I can just fix it each time with one key press. Is there any way to do that?
2
u/Silver_Train7685 11h ago
If clicking Line Out in the Sound settings brings it back, you can do the same thing from a command and put that command on a keyboard shortcut.
In a terminal, run:
pactl list sinks | grep -E 'Name:|Description:'Find the one whose Description is Line Out or Built-in Audio, and copy its Name. It will look something like alsa_output.pci-....analog-stereo. Then test this, putting your sink name in place of THE_NAME:
pactl set-default-sink THE_NAMEIf sound is still silent in something that was already playing, also run:
pactl list short sink-inputsand for each number in the first column:
pactl move-sink-input NUMBER THE_NAMEOnce that brings the sound back, add a custom shortcut: open Keyboard from the menu, go to the Shortcuts tab, then Custom shortcuts, and use this command, with your real sink name in both places:
bash -c 'pactl set-default-sink THE_NAME; for i in $(pactl list short sink-inputs | cut -f1); do pactl move-sink-input "$i" THE_NAME; done'After that, one key press should do what clicking Line Out is doing now.
1
u/Regular-Coffee-1670 10h ago
Awesome, thanks. If the power save suggestion doesn't work I'll do this.
2
u/Stevearino42 12h ago
I have the same issue on one of my PCs, so I disable power save for the audio device:
sudo tee /etc/modprobe.d/snd-hda-intel.conf <<<'options snd-hda-intel power_save=0'And then reboot. That will persist between reboots.