Skip to content

Instantly share code, notes, and snippets.

@moroz
Last active June 8, 2026 13:36
Show Gist options
  • Select an option

  • Save moroz/5e911fac1038f092939abc4421cdff52 to your computer and use it in GitHub Desktop.

Select an option

Save moroz/5e911fac1038f092939abc4421cdff52 to your computer and use it in GitHub Desktop.
Fix wifi after system sleep on MSI prestige
#!/bin/sh
# /usr/lib/systemd/system-sleep/iwlwifi.sh
# https://forums.linuxmint.com/viewtopic.php?t=413512
# iwlmld and iwlmvm are mutually exclusive, and modprobe -r will fail if one of those is not loaded.
# That said, when waking up, you can try loading all of them and ignoring errors.
to_unload="$(lsmod | grep -oE 'iwlmld|iwlmvm' | head -1)"
case $1/$2 in
pre/*)
modprobe -r $to_unload iwlwifi 2>/dev/null || true
;;
post/*)
modprobe iwlwifi 2>/dev/null || true
modprobe iwlmld 2>/dev/null || true
modprobe iwlmvm 2>/dev/null || true
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment