Standby and Shutdown Hang on Macbook Pro 11,4

I just managed to get Ubuntu Desktop 14.04 and Mac OS 10.10.4 (Yosemite) to dual boot on my mid 2015 (11,4) Macbook Pro a few weeks ago. For some reason, the machine hangs on shutdown and on standby. Specifically:

  • Telling the machine to shutdown (e.g., sudo poweroff, sudo shutdown now, etc) causes the normal shutdown routine until the final line "System will now halt." Once here, the system freezes and the only way I can get it to turn off is to manually hold down the power button for a few seconds for a hard shutdown.

  • Telling the machine to standby causes it to go to a black screen and become unresponsive. Only way to bring it back is to hold down the power button for a few seconds for a hard shutdown. After bring the machine back up, I get a "System Error Detected" notification on resume.

A few pertinent notes:

  • The MBP is running an integrated intel iris pro and an AMD Radeon R9 M370X combo for graphics, and I'm using the proprietary driver from fglrx-updates. I know from other seemingly related cases in earlier versions of Ubuntu, the problem stems from the proprietary graphics driver. However, switching back to the open XOrg driver and apt-get purging fglrx-updates does not solve either problem.

  • If I try and hibernate instead of standby, the display goes back and returns back to the desktop a few moments later (as if it's waking itself from hibernate).

  • Reboot works fine. In fact, the only way I can get a clean shutdown on the machine from Ubuntu is to reboot and either shutdown from rEFInd or boot into OS X and shutdown.

I'm not sure what logs make the most sense to post (it's my first time asking a question), but if anyone has any insights I would be happy to get the right ones posted ASAP.

UPDATE 1: Putting it in standby actually causes the screen to turn off, then turn on almost immediately, then turnoff again and hang. The system error I receive when returning to Ubuntu is the following:

ProblemType: KernelOops
Annotation: This occured during a previous suspend and prevented it from resuming properly.
Architecture: amd64
Date: Thu Sep 10 22:50:55 2015
DistroRelease: Ubuntu 14.04
ExecutablePath: /usr/share/apport/apportcheckresume
ExecutableTimestamp: 1439395460
Failure: suspend/resume
InterpreterPath: /usr/bin/python3.4
Package: linux-image-3.19.0-25-generic 3.19.0-25.26~14.04.1

I've also attached the sleep log below.

Initial commandline parameters: 
Thu Sep 10 22:50:05 EDT 2015: Running hooks for suspend.
Running hook /usr/lib/pm-utils/sleep.d/000kernel-change suspend suspend:
/usr/lib/pm-utils/sleep.d/000kernel-change suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/000record-status suspend suspend:
/usr/lib/pm-utils/sleep.d/000record-status suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/00logging suspend suspend:
Linux fruit 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Module                  Size  Used by
nvram                  16384  0 
msr                    16384  0 
btusb                  40960  0 
joydev                 20480  0 
bcm5974                20480  0 
pci_stub               16384  1 
vboxpci                24576  0 
vboxnetadp             28672  0 
vboxnetflt             28672  0 
vboxdrv               450560  3 vboxnetadp,vboxnetflt,vboxpci
xt_CHECKSUM            16384  1 
iptable_mangle         16384  1 
ipt_MASQUERADE         16384  1 
nf_nat_masquerade_ipv4    16384  1 ipt_MASQUERADE
iptable_nat            16384  1 
nf_conntrack_ipv4      16384  1 
nf_defrag_ipv4         16384  1 nf_conntrack_ipv4
nf_nat_ipv4            16384  1 iptable_nat
nf_nat                 24576  2 nf_nat_ipv4,nf_nat_masquerade_ipv4
nf_conntrack          106496  4 nf_nat,nf_nat_ipv4,nf_nat_masquerade_ipv4,nf_conntrack_ipv4
xt_tcpudp              16384  5 
bridge                110592  0 
stp                    16384  1 bridge
llc                    16384  2 stp,bridge
iptable_filter         16384  1 
ip_tables              28672  3 iptable_filter,iptable_mangle,iptable_nat
x_tables               36864  6 xt_CHECKSUM,ip_tables,xt_tcpudp,ipt_MASQUERADE,iptable_filter,iptable_mangle
applesmc               20480  0 
input_polldev          16384  1 applesmc
x86_pkg_temp_thermal    16384  0 
intel_powerclamp       20480  0 
coretemp               16384  0 
kvm_intel             151552  0 
kvm                   479232  1 kvm_intel
brcmfmac              278528  0 
brcmutil               16384  1 brcmfmac
lpc_ich                24576  0 
cfg80211              524288  1 brcmfmac
bdc_pci                16384  0 
mei_me                 20480  0 
mei                    90112  1 mei_me
sbs                    16384  0 
sbshc                  16384  1 sbs
apple_gmux             16384  0 
mac_hid                16384  0 
snd_hda_codec_cirrus    20480  1 
snd_hda_codec_generic    69632  1 snd_hda_codec_cirrus
snd_hda_codec_hdmi     53248  1 
snd_hda_intel          32768  10 
snd_hda_controller     32768  1 snd_hda_intel
snd_hda_codec         143360  5 snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_intel,snd_hda_controller,snd_hda_codec_cirrus
snd_hwdep              20480  1 snd_hda_codec
fglrx               12460032  127 
snd_pcm               106496  4 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel,snd_hda_controller
snd_seq_midi           16384  0 
snd_seq_midi_event     16384  1 snd_seq_midi
snd_rawmidi            32768  1 snd_seq_midi
snd_seq                65536  2 snd_seq_midi_event,snd_seq_midi
snd_seq_device         16384  3 snd_seq,snd_rawmidi,snd_seq_midi
snd_timer              32768  2 snd_pcm,snd_seq
snd                    86016  31 snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_seq,snd_rawmidi,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel,snd_seq_device,snd_hda_codec_cirrus
apple_bl               16384  1 apple_gmux
amd_iommu_v2           20480  1 fglrx
soundcore              16384  2 snd,snd_hda_codec
shpchp                 40960  0 
bnep                   20480  2 
rfcomm                 69632  0 
bluetooth             491520  11 bnep,btusb,rfcomm
binfmt_misc            20480  1 
parport_pc             32768  0 
ppdev                  20480  0 
lp                     20480  0 
parport                45056  3 lp,ppdev,parport_pc
nls_iso8859_1          16384  1 
dm_crypt               24576  1 
hid_generic            16384  0 
hid_apple              16384  0 
crct10dif_pclmul       16384  0 
crc32_pclmul           16384  0 
ghash_clmulni_intel    16384  0 
aesni_intel           172032  2 
aes_x86_64             20480  1 aesni_intel
lrw                    16384  1 aesni_intel
gf128mul               16384  1 lrw
glue_helper            16384  1 aesni_intel
ablk_helper            16384  1 aesni_intel
cryptd                 20480  4 ghash_clmulni_intel,aesni_intel,ablk_helper
uas                    24576  0 
usb_storage            69632  1 uas
ahci                   36864  3 
usbhid                 53248  0 
libahci                32768  1 ahci
hid                   110592  3 hid_generic,usbhid,hid_apple
video                  20480  1 apple_gmux
             total       used       free     shared    buffers     cached
Mem:      16306696    1188872   15117824      22748      47276     365684
-/+ buffers/cache:     775912   15530784
Swap:      4194300          0    4194300
/usr/lib/pm-utils/sleep.d/00logging suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/00powersave suspend suspend:
/usr/lib/pm-utils/sleep.d/00powersave suspend suspend: success.

Running hook /etc/pm/sleep.d/10_grub-common suspend suspend:
/etc/pm/sleep.d/10_grub-common suspend suspend: success.

Running hook /etc/pm/sleep.d/10_unattended-upgrades-hibernate suspend suspend:
/etc/pm/sleep.d/10_unattended-upgrades-hibernate suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/49tlp suspend suspend:
/usr/lib/pm-utils/sleep.d/49tlp suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/50unload_alx suspend suspend:
/usr/lib/pm-utils/sleep.d/50unload_alx suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/60_wpa_supplicant suspend suspend:
Failed to connect to non-global ctrl_ifname: (null)  error: No such file or directory
/usr/lib/pm-utils/sleep.d/60_wpa_supplicant suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/75modules suspend suspend:
/usr/lib/pm-utils/sleep.d/75modules suspend suspend: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/90clock suspend suspend:
/usr/lib/pm-utils/sleep.d/90clock suspend suspend: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/94cpufreq suspend suspend:
/usr/lib/pm-utils/sleep.d/94cpufreq suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/95anacron suspend suspend:
stop: Unknown instance: 
/usr/lib/pm-utils/sleep.d/95anacron suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/95hdparm-apm suspend suspend:
/usr/lib/pm-utils/sleep.d/95hdparm-apm suspend suspend: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/95led suspend suspend:
/usr/lib/pm-utils/sleep.d/95led suspend suspend: not applicable.

Running hook /usr/lib/pm-utils/sleep.d/98video-quirk-db-handler suspend suspend:
ATI Catalyst driver detected, not using quirks.
/usr/lib/pm-utils/sleep.d/98video-quirk-db-handler suspend suspend: success.

Running hook /usr/lib/pm-utils/sleep.d/99video suspend suspend:
kernel.acpi_video_flags = 0
/usr/lib/pm-utils/sleep.d/99video suspend suspend: success.

Running hook /etc/pm/sleep.d/novatel_3g_suspend suspend suspend:
/etc/pm/sleep.d/novatel_3g_suspend suspend suspend: success.

Thu Sep 10 22:50:06 EDT 2015: performing suspend

UPDATE 2: It looks like this issue may extend beyond Ubuntu. I'm not sure how to begin debugging it. Any thoughts??

https://forums.gentoo.org/viewtopic-p-7772846.html?sid=7ab6dd35c3dfc7a38a2c1b02edb15044

https://bbs.archlinux.org/viewtopic.php?id=199388


Solution 1:

It turns out this is now a documented problem with the MacbookPro 11,4 and 11,5 within the latest mainline linux kernel (I think up until 4.6 at the time of writing this). There is a work-around that requires patching/compiling a custom kernel. It's located at Comment #172 of https://bugzilla.kernel.org/show_bug.cgi?id=103211. Specifically,

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index ee72ebe..d3ec833 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2775,6 +2775,13 @@ static void quirk_hotplug_bridge(struct pci_dev *dev)

 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HINT, 0x0020, quirk_hotplug_bridge);

+static void quirk_hotplug_bridge_skip(struct pci_dev *dev)
+{
+       dev->is_hotplug_bridge = 0;
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x8c10, quirk_hotplug_bridge_skip);
+
 /*
  * This is a quirk for the Ricoh MMC controller found as a part of
  * some mulifunction chips.

From within the comments, it looks like a handful of people have confirmed that this indeed works in Ubuntu 14.04 and 16.04 with different 4.X variations of the Linux kernel. I'm testing this now on 16.04, and will accept this answer if everything works OK. If anyone else is willing to confirm this patch on 14.04 with an earlier kernel release (3.X), please comment below.

UPDATE: I can confirm that this works in Ubuntu 16.04 with Kernel v4.4.0-28-generic. I did the following steps:

  • Obtain the correct kernel from the Ubuntu kernel git repo (https://wiki.ubuntu.com/Kernel/Dev/KernelGitGuide)
  • Implement the above patch by manually adding the quirk_hotplug_bridge(...) method and the DECLARE_PCI_FIXUP_HEADER(...) call
  • Compile the Kernel and dpkg install it (https://help.ubuntu.com/community/Kernel/Compile)

Everything seems to be working as it should.