Skip to content

Ubuntu 26.04

Sound problems

Sometimes it may fail to play any sound…
This page provides some clue.

#!/bin/bash
# https://ubuntu.fan/en/docs/ref/troubleshooting/no-sound

[ -e /proc/asound/cards ] || {
    echo "No ALSA drivers/cards -- no way."
    exit 1
}>&2

if [ "${1,,}" = fix ]; then
    # rm -rf ~/.config/pipewire ~/.local/state/pipewire
    systemctl --user restart pipewire pipewire-pulse wireplumber
elif [ -n "$1" ]; then
    echo "$0 [fix]" >&2
    exit 1
fi

timeout 1 amixer get Master >& /dev/null ||
systemctl --user restart pipewire pipewire-pulse wireplumber

timeout 1 amixer get Master || { echo cannot restart sound system; exit 1; }>&2

aplay -l
cat /proc/asound/cards
wpctl status | grep -A 20 Audio | grep -B 20 Video | grep -vw Video
wpctl inspect @DEFAULT_AUDIO_SINK@