Skip to main content
Topic: Right way to reload *complete* sound system ? (Read 643 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Right way to reload *complete* sound system ?

Hello,
my Artix linux is broken after an update, again.
This time: sound system crashes when switching output to bluetooth headphones.
No more sound hardware visible after crash.

What I tried:
Code: [Select]
#!/bin/bash
#
sudo /etc/init.d/alsasound stop
killall -q pipewire-media-session
killall -q pipewire-pulse
killall -q pipewire

lsmod | sed -n -e 's/^\(snd[-_][^[:space:]]*\)[[:space:]].*/\1/p' | sed -e 's/_/-/g' >/tmp/alsa_modules-removed
for SNDMOD in $(cat /tmp/alsa_modules-removed);do sudo modprobe -v -r "$SNDMOD" ; done
for SNDMOD in $(cat /tmp/alsa_modules-removed);do sudo modprobe -v -r "$SNDMOD" ; done
for SNDMOD in $(cat /tmp/alsa_modules-removed);do sudo modprobe -v -r "$SNDMOD" ; done

sudo modprobe -v snd_hda_codec_realtek

for SNDMOD in $(cat /tmp/alsa_modules-removed);do sudo modprobe -v "$SNDMOD" ; done

rm /tmp/alsa_modules-removed

sudo /etc/init.d/alsasound start
nohup /usr/bin/pipewire >/dev/null 2>&1 &
nohup /usr/bin/pipewire-pulse >/dev/null 2>&1 &
nohup /usr/bin/pipewire-media-session >/dev/null 2>&1 &

But that seems not enough. The sound system get not resurrected.

What is the *right* way to restart my complete sound system ?

Re: Right way to reload *complete* sound system ?

Reply #1
sound system crashes when switching output to bluetooth headphones.
https://forum.artixlinux.org/index.php/topic,3532.0.html

Especially the posts since this one to end of thread: https://forum.artixlinux.org/index.php/topic,3532.msg22928.html#msg22928

Re: Right way to reload *complete* sound system ?

Reply #2
Thanks, but this does not reset my sound system.
I think I found now a working way:
Code: [Select]
#!/bin/bash
#
killall -q pipewire-media-session
killall -q pipewire-pulse
killall -q pipewire
killall -q mate-volume-control-status-icon
sudo /etc/init.d/bluetoothd stop
sudo /etc/init.d/alsasound stop

lsmod | sed -n -e 's/^\(snd[-_][^[:space:]]*\)[[:space:]].*/\1/p' | sed -e 's/_/-/g' >/tmp/alsa_modules-removed
for SNDMOD in $(cat /tmp/alsa_modules-removed);do sudo modprobe -v -r "$SNDMOD" ; done
for SNDMOD in $(cat /tmp/alsa_modules-removed);do sudo modprobe -v -r "$SNDMOD" ; done
for SNDMOD in $(cat /tmp/alsa_modules-removed);do sudo modprobe -v -r "$SNDMOD" ; done

sudo modprobe -v snd_hda_codec_realtek
for SNDMOD in $(cat /tmp/alsa_modules-removed);do sudo modprobe -v "$SNDMOD" ; done

rm /tmp/alsa_modules-removed

sudo /etc/init.d/alsasound start
sudo /etc/init.d/bluetoothd start

nohup /usr/bin/pipewire >/dev/null 2>&1 &
nohup /usr/bin/pipewire-pulse >/dev/null 2>&1 &
nohup /usr/bin/pipewire-media-session >/dev/null 2>&1 &
nohup /usr/bin/mate-volume-control-status-icon >/dev/null 2>&1 &

This makes the sound system work again without restart.
Edit: For what ever reason it must sometimes be *run twice* to work.