r/linuxmint • • 3d ago

SOLVED Command to fix sound cutting out?

Post image

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?

EDIT: For anyone searching for a solution to this problem, u/Stevearino42 's comment below completely resolved it.

1 Upvotes

7 comments sorted by

•

u/AutoModerator 2d ago

Please Re-Flair your post if a solution is found. How to Flair a post? This allows other users to search for common issues with the SOLVED flair as a filter, leading to those issues being resolved very fast.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/Stevearino42 3d 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.

1

u/Regular-Coffee-1670 3d ago

Thank you very much - not a suggestion I've seen before, so I'll try it right now.

1

u/Regular-Coffee-1670 2d ago

u/Stevearino42 you're an absolute legend! Works perfectly.

I couldn't even tell you the number of times I've posted this on different forums, mostly with no solution at all, occasionally with a solution that didn't work.

Very much appreciated.

2

u/Stevearino42 2d ago

You're welcome! :)

Yeah I think I tried four or five different things before I stumbled across this one maybe 6 months ago. Don't remember exactly where I found it, but it may have been on the Ubuntu forums?

Cheers!

2

u/Silver_Train7685 3d 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_NAME

If sound is still silent in something that was already playing, also run:

pactl list short sink-inputs

and for each number in the first column:

pactl move-sink-input NUMBER THE_NAME

Once 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 3d ago

Awesome, thanks. If the power save suggestion doesn't work I'll do this.