Skip to content

Instantly share code, notes, and snippets.

@tarampampam
Last active January 9, 2024 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tarampampam/bbb44cf0b195369e599a0e6296a8c0ef to your computer and use it in GitHub Desktop.
Save tarampampam/bbb44cf0b195369e599a0e6296a8c0ef to your computer and use it in GitHub Desktop.
Fixing "no sound after suspending" error for Linux Mint on Xiaomi Notebook 15 pro

Fast checking

After suspending (when your system cannot play any sounds) try to execute in your terminal (after sudo su):

$ lspci -D | grep -i Audio | awk '{print $1}'

And then:

$ echo 1 > /sys/bus/pci/devices/<device_address>/remove
$ sleep 1
$ echo 1 > /sys/bus/pci/rescan

If all works fine, automate it

Create new file: /lib/systemd/system-sleep/99_restart_sound and insert the following source code:

#!/bin/sh
  
case "$1" in
    post)
        DEVICE_ID=`lspci -D | grep -i Audio | awk '{print $1}'`
        echo 1 > /sys/bus/pci/devices/${DEVICE_ID}/remove
        sleep 1
        echo 1 > /sys/bus/pci/rescan
esac

The file must be executable:

$ sudo chmod +x /lib/systemd/system-sleep/99_restart_sound

Solution source: https://askubuntu.com/a/1293238

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment