Apple OSX Grey Screen Recovery


Apple


Description:


2011 MBP models had a ton of issues with the incldued descrete GPU. When the GPU failed, it results in the inabilty to boot. Symptoms will include seeing the apple logo on boot, the progress bar will get about 50-75% through, and then you will see a multicolored line appear about 25% percent down from the top of the display for a few moments, before the display resets to a blank grey screen. Once at the grey screen, you will forever remain at the grey screen. Booting into recovery mode (commnd +R), or attempting to boot off of a boot USB/CD with the OSX installer will also result in landing straight back to the grey screen of forever. This apparently was a common issue caused by a bad GPU that shipped with the 2011 model Macbooks and MacBook Pros. Apple did issue an option in 2015 to fix the GPUs for free, but that generosity expired on Dec 31st 2016... So now if you come across this issue, Apple will simply tell you that the Macbook is Vintage, and your only option is to call a repair shop, that maybe can replace the logicboard for 600-800 dollars... umm no thanks... Luckily digging around the bowels of the intertubs did result in a fix that I am happy to report got my MacBook Pro back to normal. In addition to the discrete GPU, the logic board happens to have a shared, integrated video device as well. The Intel 3000 integreated card is shut off in the EFI on boot, but can be reactivated with a little hackery, which can return your MacBook Pro back to a fully running state... Why Apple couldn't just release a fix that would perform the following, I will never know.. but screw them, you can find everything you need right here!!


Pre-Requisites:


The following materials will be needed to get your Macbook back to a running state.


  • Another computer (preferably another Mac), with an internet connection
  • A USB Flash drive


Boot the Unbootable Mac:


The first step will be to get the unbootable mac to actually boot. We can do this by removing the kernel extentions for the discreate gpu. On boot if the MBP can't find the kernel extentions, then it will boot still activating the broken discreate GPU, but not instantiating its capabilities. This will result in a super blocky/choppy display, but it will boot.

In my case, again, recovery mode would not work, and attmpting to perform the following steps in save mode (command +S), will not work because of the new SIP protection built into El Capitan and later. SIP or Systemc Integrity Protection takes some of the power away from the root user, and doesn't allow even the root user to modify system files. This can be disabled in the recovery mode by normally being able to boot into recovery mode and using the csrutil disable command, but again being that I wasn't able to get into recovery mode, I pulled the bottom off the laptop, pulled the drive out and connected it directly to my iMac via a USB external HDD connector. This allowed the MacBook drive to be fully accessible from the terminal window on my iMac. Once connected, you need to perform the following steps:


Command Substitution:
For the following commands, cd into the /Volumes directory and use ls to obtain the Disk name, then replace DISKNAME with your disks name in all of the following commands


cd /Volumes/DISKNAME/
sudo mkdir Disabled_Extentions
cd /Volumes/DISKNAME/System/Library/Extensions
sudo cp -fr ATI* /Volumes/DISKNAME/Disabled_Extentions/
sudo cp -fr AMD* /Volumes/DISKNAME/Disabled_Extentions/
sudo ls -lah /Volumes/DISKNAME/Disabled_Extentions/
sudo rm -fr ATI*
sudo rm -fr AMD*
sudo touch /System/Library/Extensions/


Touch:
Be sure to use the last command even though the /System/Library/Extensions/ directory exists, doing so will update the timestamps so that on the next boot, new driver caches, without AMD or ATI drivers will be rebuilt


Now reboot.. Your Macbook should boot fully to your login screen.. Again, your video will be extreamly choppy, like loading a jpeg image on a 14400 modem back in the 90's choppy, but we will fix that next!


Burn off a Linux ISO:


The next step will be to burn off a linux ISO. Booting into Linux will allow us to change the EFI properties and tell the Macbook to not even try to load the discrete GPU, and instead always just load the Intel 3000 integrated video card. For this you will need a USB flash drive.


1.    Download Arch Linux

In this step we will download Arch linux, as it's ISO has the option to boot directly to the shell, without attempting to load a GUI (Graphical User Interface). As this is exactly what we need, we will go grab the latest version of Arch and use the ISO to make a bootable USB flash drive.


DOWNLOAD:
Arch Linux can be downloaded here


2.    Format the USB Flash Disk

Open DiskUtil, click on the USB disk and click on the Erase button at the top of the DiskUtil window. You can use MS-DOS/MBR (Master Boot Record) as the erase options.


3.    Unmount the USB Drive

Open a terminal window and use the following command to unmount the disk. You will want to use the command over just unmounting the disk by dragging it into the trash to ensure that it remains accesible to the terminal.


Command Substitution:
use the diskutil list command to obtain the disk id, you will see identifiers such as disk3 and disk3s1. The s1 in that example specifies the partition on the disk, for the following commands we will just be using the disk id as such in the example disk3


WARNING:
Double and Tripple check that you have the correct disk selected before performing the following commands. The next few steps will wipe out the disk to create a bootle disk. Make sure that the disk that you are using is in fact your USB drive.


In the following example I can tell for sure that /dev/disk3 is the USB stick, as it is only 3.9GB in size.


/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Sierra                  250.1 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3

/dev/disk1 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:          Apple_CoreStorage DATA                    999.9 GB   disk1s2
   3:                 Apple_Boot Boot OS X               134.2 MB   disk1s3

/dev/disk2 (internal, virtual):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS DATA                   +999.5 GB   disk2
                                 Logical Volume on disk1s2
                                 5FF76606-DD72-483A-BD4B-CA3A19306B63
                                 Unencrypted

/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *3.9 GB     disk3
   1:                       0xEF                         67.1 MB    disk3s2


diskutil unmountDisk /dev/diskX


4.    Create the Bootable USB Image

sudo dd if=path/to/arch_linux.iso of=/dev/rdiskX bs=1m


Info:
Once the USB stick has been written, OSX will automatically attempt to mount the device and will display a warning message that the disk is unreadable. This message can be ignored, the USB stick should be bootable, OSX just can't load the contents which is fine.


osx_warning


Boot into Linux:


Now that we have a bootable USB drive, plug the drive into the MacBook and reboot the Macbook holding down the option key. On boot, you should be presented with a menu that shows your normal disk and a new option called EFI Boot. Choose this option, and you will be presented a GRUB menu that lists options along the lines of:

  • Arch Linux
  • EFI Shell (some options)
  • EFI Shell (some more options)
  • Boot Normal


You will want to ensure the cursor is highlighting the first option for Arch Linux and press the e button. This will open a line at the bottom of the menu starting with initrd. Go to the end of the line using the right arrow button. Once at the end of the line, press the spacebar once, and then type nomodeset, and then hit the enter key. As long as everything was done correctly, you should see the Macbook boot into a linux shell.


Modify the EFI:


1.    Go to the EFI Directory:

Now we get to the meat and patatoes. Once you are in the Linux shell, navigate to the efivars directory

cd /sys/firmware/efi/efivars


2.    Remove any existing gpu-power-prefs:

In the directory issue a ls -lah | grep gpu to see if you have an existing gpu-power-prefs file, if you do remove it. The only thing that you should see with the ls command is a gpu-active file.


Info:
If you are unable to remove the file, the directory could be mounted in RO (Read Only) mode. In order to change it perform the following: cd /, umount /sys/firmware/efi/efivars/, mount -t efivarfs rw /sys/firmware/efi/efivars/ and finally go back to the directory using cd /sys/firmware/efi/efivars/


3.    Create a new power prefs file:

Next we need to create a gpu-power-prefs file to tell EFI not to activate the discrete gpu, but instead to activate the default intel graphics card. We do that with the following command:


Power Prefs UUID:
The format of the gpu-power-prefs file is gpu-power-prefs-uuid where UUID is a random identifier. To pick an ID I used the ls | grep gpu command to display the gpu-active-uuid file, and then copied that uuid into the command below


printf "\x07\x00\x00\x00\x01\x00\x00\x00" > /sys/firmware/efi/efivars/gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9


4.    Make the new file Immutable:

Next we need to change the permission of the new gpu-power-prefs file to make it immutable, meaning that nothing including the EFI can alter the file. We can do this with the following commmand:


chattr +i /sys/firmware/efi/efivars/gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9


5.    Unmount & Reboot:

The last step is to safely unmount the EFI directory, and then reboot the Mac:

Info:
If you recieve an error while attempting to unmount the efivars folder ensure that you performed the cd / command. If your prompt is in the path that you are attempting to unmount, then the unmount will error.


cd /
umount /sys/firmware/efi/efivars/
reboot


Boot into OSX:


Thats it, if everything was smoothe, you should now be able to boot back into the Macbook.. Looking at the About this Mac Display section should show that you are using the Intel 3000 Integrated display, and everything should be back to running smoothe. You may have lost a little GPU love when playing any games, but on the bright side your Macbook should be fixed, without having to replace the logic board, or spending a ton of money having a scamshop perform diagnostics, and you didn't even have to take it apart to fix it !! Enjoy


Post Requisites:


None


References:


apple.stackexchange.com

macrumors.com

macrumors.com write up

archlinux.org