7

I am running Ubuntu 16.04 LTS on a Dell XPS 15 9550 (16 GB RAM, FHD screen, 512 GB SSD, Intel i7-6700HQ). It is dual booted with Windows, for which I followed the instructions in this thread.

Almost everything works very well. However, when I suspend either by closing the lid, or using systemctl suspend sometimes (about 50% of the time) Ubuntu doesn't suspend. The screen goes dark as if it is about to suspend, but then it flashes back directly to the login screen.

I believe the issue must be related to my Broadcom wifi card/driver. The output of dmesg during a failed suspend is:

[36482.669029] PM: Syncing filesystems ... done.
[36482.697429] PM: Preparing system for sleep (mem)
[36482.698220] vgaarb: this pci device is not a vga device
[36483.937858] Freezing user space processes ... (elapsed 0.002 seconds) done.
[36483.940227] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[36483.941564] PM: Suspending system (mem)
[36483.941623] Suspending console(s) (use no_console_suspend to debug)
[36487.637784] brcmf_pcie_suspend: Timeout on response for entering D3 substate
[36487.637802] pci_legacy_suspend(): brcmf_pcie_suspend+0x0/0x1b0 [brcmfmac] returns -5
[36487.637808] dpm_run_callback(): pci_pm_suspend+0x0/0x140 returns -5
[36487.637813] PM: Device 0000:02:00.0 failed to suspend async: error -5
[36487.637902] PM: Some devices failed to suspend, or early wake event detected
[36487.641932] rtc_cmos 00:02: System wakeup disabled by ACPI
[36488.017866] ata2: SATA link down (SStatus 4 SControl 300)
[36488.149475] PM: resume of devices complete after 511.560 msecs
[36488.158754] PM: Finishing wakeup.

There is also the message

brcmfmac 0000:02:00.0: Direct firmware load for brcm/brcmfmac43602-pcie.txt failed with error -2

whenever I boot or resume from a [successful] suspend. Also to note: when suspend fails, my wifi stops working (I believe it says "no device"). The only ways to get it to work again are to either reboot, or:

sudo rmmod brcmfmac
sudo modprobe brcmfmac

Here is the output of a wifi info script. Any help at all would be very much appreciated! Thank you in advance, and let me know if any more information would be helpful.

EDIT: Issue has returned after upgrade to 18.04. The previously accepted answer no longer seems to work because systemd does not unload modules from suggested file before suspending.

  • 1
    Note that as a quick one-off fix, I was able to suspend by running sudo rmmod brcmfmac first. After unsuspending, I can get wifi working again with sudo modprobe brcmfmac. (After doing this, future suspends seem to work fine so far, though I assume it'll stop working again at some point and a more permanent fix will be needed.) – tobek Jan 20 '21 at 07:30

2 Answers2

4

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

sudo -e /etc/pm/config.d/suspend_broardcom/suspend_broadcom

Add the following:

SUSPEND_MODULES="brcmfmac"

And set the permissions of the file:

sudo chmod 775 /etc/pm/config.d/suspend_broadcom
NotTheDr01ds
  • 17,888
  • Thank you for the response! Two questions: 1. Does the file need to follow any naming conventions? 2. I assume I need to change the permissions on the file, is this correct? I notice the files in /etc/pm/sleep.d have permissions 755, is this adequate for the file I create? – Daniel Hathcock Jul 24 '17 at 02:23
  • I tried implementing your fix 1 day ago, and the very first suspend failed, but no suspend has failed since then. I suppose that could just be chance. Any idea if having the first suspend fail can be explained? – Daniel Hathcock Jul 25 '17 at 04:54
  • I recently upgraded to 18.04, and the issue came back. I realized the file I had created was deleted, so I recreated it, but this time it did not fix the issue. After some research I believe it is related to the difference between suspending through systemd and pm. systemd does not remove modules using that config file. Do you know of a way to fix the issue that works in 18.04 using systemctl suspend? – Daniel Hathcock Jul 10 '18 at 20:33
  • Another answer (that probably should have been an edit) suggested permissions of 775. It's likely that 755 would be more appropriate, so if anyone agrees or can confirm, feel free to edit my edit. – NotTheDr01ds Jan 14 '23 at 14:26
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

tobek
  • 131
  • Had to change pre) modprobe -r brcmfmac ;; by pre) modprobe -r brcmfmac_wcc brcmfmac ;; See https://askubuntu.com/questions/521222/how-to-unload-a-kernel-module-which-is-in-use – Maxime Pacary Oct 05 '23 at 22:01