After upgrading to Mac OSX High Sierra, I start to see split and blue screens on my MacBook Pro (early 2011). This normally indicates a failed graphics card on my old laptop. I send it to Apple store and the diagnostic results confirm it is indeed the discrete graphics card problem. Unfortunately, they don’t have any spare parts for my vintage model.

Many people are having the same issues from a simple Google search, like stackexchange and macrumors posts. Depending on usage, it normally dies in 5-7 years. Apple has a MacBook Pro Repair Extension Program for Video Issues program but my model is no longer eligible for this program.

Looks like I am on my own now and I have to hack it myself. The steps from the stackexchange post look scary initially but it turns out to be pretty simple. My MacBook Pro is working (well mostly, details below) with Intel integrated graphics card.

This following steps are mostly copied from stackexchange for future quick reference.

  1. Prepare a bootable ArchLinux live USB
  1. Use Linux to change EFI vars
  • Hold Option key while booting and choose “EFI boot” (ArchLinux live USB)
  • Edit (e) GRUB options to append nomodeset to Linux kernel flags
  • Clear existing EFI vars
cd /
umount /sys/firmware/efi/efivars/
mount -t efivarfs rw /sys/firmware/efi/efivars/
cd /sys/firmware/efi/efivars/
chattr -i "gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9"
rm gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9
  • Create a new gpu-power-prefs file
printf "\x07\x00\x00\x00\x01\x00\x00\x00" > /sys/firmware/efi/efivars/gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9
  • Add immutability to the gpu-power-prefs file
chattr +i "/sys/firmware/efi/efivars/gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9"
  • Unmount efivars and reboot
cd /
umount /sys/firmware/efi/efivars/
reboot

This github ticket from gpu-switch mentioned that it is possible to edit NVRAM variable directly from Single-User mode (boot by pressing Command-S) to replace step 1 and 2.

sudo nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00

It WORKS after reboot! I am very happy to see it working again so I leave it running during the day and put it back to sleep without doing step 3 (see below or the original post). The screen never comes back after sleep even though the keyboard lights up and the entire system is running. Step 3 removes AMD kernel kexts so is it possible that the system is using discrete graphics card again after sleep?

I want to redo the above two steps again but the screen stays black for some reason. I reset the NVRAM using Option-Command-P-R key combination from Mac startup key combinations and magically I see the Apple logo again after the chime sound. I can’t find the gpu-power-prefs file this time so I guess this is due to the NVRAM reset. I am so happy that I have my laptop up and running AGAIN. Now, I really want to remove kexts.

Obviously, I failed to move AMD kexts to a backup directory due to permission issues. Even you are a super user, Apple is still protecting you from doing stupid things. WTF?! I can use Command-R to boot into recovery mode, right? No!! For some other unknown reasons, when you first boot into OSX, in the second boot, the system is possibly using the discrete graphics card again which leaves you a black screen or boot looping.

I am now repeating step 1 and 2 for the third time and immediately after that, I am able to boot into recovery mode without entering OSX first. I am afraid Apple SIP might restore deleted kexts for me even in recovery mode so I disabled SIP first according to this stackoverflow post.

csrutil disable
reboot
  1. Remove AMD / NVIDIA kexts
diskutil cs list # find Logical Volume UUID: last item
diskutil coreStorage unlockVolume YOUR-VOLUME-UUID # UUID: from previous command
cd /Volumes/OSX
mkdir AMD_Kexts
mv /System/Library/Extensions/AMD*.* AMD_Kexts/
reboot

One interesting I found is when I move AMD kexts from system extensions, they come back after several minutes (I don’t have an exact number) even though SIP is disabled already. When I try to remove the recovered AMD kexts again, the /System/Library/Extensions folder becomes read-only. Again, these are all the Apple magic which I can’t explain. I ignore them and boot into OSX normally. AMD kexts are not in /System/Library/Extensions folder so I assume I have moved them successfully?

From my testing, after removing kexts, system start, shutdown, reboot work fine but waking up from sleep still gets a black screen. I turn sshd on and login remotely from my Ubuntu box to my MacBook Pro while doing sleep and wake up testing. I can confirm the entire system is up but the screen is just black. I also disable graphics card switching in power settings but that doesn’t seem to affect anything.

One more thing I want to note is how to copy data from Apple HFS+ journaled partition to a Ubuntu box. Is it as simple as putting the hard drive in a external drive enclosure and do this?

sudo apt install hfsprogs
sudo mount -t hfsplus -o force,rw /dev/sdXY /path/to/mount/point

No!! It failed to mount because HFS+ partition is wrapped in a CoreStorage volume since OSX Yosemite. What you really need to do first is to use testdisk utility to analyze your disk and get the real size inside CoreStorage volume. I am able to backup some of my data before I can test the graphics card hack.

TestDisk

Updated on June 5, 2018

Note after upgrading to MacOS High Sierra 10.13.5: Looks like system upgrade re-generates AMD kexts so that I have to redo all the steps again. In recovery mode, /System/Library/Extensions is always read-only after the upgrade. It is possible to mount system partition as read/write.

mount -u -w /

Updated on August 8, 2018

Two more useful links reported by Jackie (haven’t tested though):

Updated on November 20, 2018

Jeff Geerling Fixing a 2011 MacBook Pro booting to a Grey Screen - AMD Radeon Video Glitch

(Image from superuser / CC BY-SA 3.0)