Ubuntu 16.04 on Dell XPS suspend occasionally fails

Solution 1:

I had the exact same problem. The solution is to create a file in /etc/pm/config.d/ with just one line:

SUSPEND_MODULES="brcmfmac"

Solution 2:

The solution suggested by @user716336 works for me as well. You should give the created file the right permissions though:

sudo chmod 777 /etc/pm/config.d/suspend_broardcom

(I called the file suspend_broardcom)

Solution 3:

Adding a file with SUSPEND_MODULES="brcmfmac" to /etc/pm/config.d/ didn't work for me, which might be an issue between systemd and pm, but I was able to get suspend with Broadcom wifi card to work by creating a simple script for systemd to run before and after suspend.

Create a file in /usr/lib/systemd/system-sleep/ (or wherever your systemd unit files are, might have to be /lib/systemd/system-sleep/) with the following:

#!/bin/sh

case $1 in
    pre)  modprobe -r brcmfmac ;;
    post) modprobe brcmfmac  ;;
esac

You can name it e.g. 10-brcmfmac.sh - the script name doesn't matter as long as it's in this directory and has the executable bit set (e.g. sudo chmod +x /usr/lib/systemd/system-sleep/10-brcmfmac.sh).

More information about systemd suspend hooks: https://wiki.archlinux.org/index.php/Power_management#Hooks_in_/usr/lib/systemd/system-sleep