It all started when my MacBook Pro showed me black screen after waking from sleep. After that, many times I would boot straight into Black Screen, and the only sign that the machine was awake could be just tested by pressing the CAPS LOCK key (turns on the button-light) or connecting an External USB with a indicator light.

I started asking myself why would this happen? Was it due to upgrade to High Sierra 10.13.3 or was it that my machine really developed some hardware problem? I asked a friend of mine what can I do and he suggested SMC Reset followed by PRAM (NVRAM) Reset. I tried all that, but it refused to work. I got my MacBook cleaned and then it booted fine. But as soon as, I started using it, all of a sudden it would show a Black Screen, but CAPS LOCK would still glow green and so I would then reboot it again, only to Black screen. Sometimes, upon restarting the first problem message that I got was GPU panic like the one shown below:

Anonymous UUID:       32BD6DA8-14C2-38AD-E466-F3B6DDCE6F7F

Fri May 18 19:43:24 2018

*** Panic Report ***
panic(cpu 2 caller 0xffffff7f916c29cf): "GPU Panic: mux-regs 4 0 a0 99 0 8 severity 3 WS-ready 1 switch-state 3 IG FBs 1 EG FBs 0:0 power-state 3 3D idle HDA idle : AGC GPU REGISTER RESTORE FAILED : rdar://7254528, VendorID invalid\n"@/BuildRoot/Library/Caches/com.apple.xbs/Sources/AppleGraphicsControl/AppleGraphicsControl-3.18.48/src/AppleMuxControl/kext/GPUPanic.cpp:162
Backtrace (CPU 2), Frame : Return Address
0xffffff81f9073a90 : 0xffffff800e66e166 
0xffffff81f9073ae0 : 0xffffff800e796714 
0xffffff81f9073b20 : 0xffffff800e788a00 
0xffffff81f9073ba0 : 0xffffff800e620180 
0xffffff81f9073bc0 : 0xffffff800e66dbdc 
0xffffff81f9073cf0 : 0xffffff800e66d99c 
0xffffff81f9073d50 : 0xffffff7f916c29cf 
0xffffff81f9073db0 : 0xffffff7f916bf1ae 
0xffffff81f9073df0 : 0xffffff7f916c2443 
0xffffff81f9073e30 : 0xffffff800ec9f71c 
0xffffff81f9073ea0 : 0xffffff800ec9f646 
0xffffff81f9073ed0 : 0xffffff800e6a77e4 
0xffffff81f9073f40 : 0xffffff800e6a7345 
0xffffff81f9073fa0 : 0xffffff800e61f4f7 
      Kernel Extensions in backtrace:
         com.apple.driver.AppleMuxControl(3.18.48)[09DFEF11-0A5B-369B-91C5-FD32B3E62DD3]@0xffffff7f916b4000->0xffffff7f916c6fff
            dependency: com.apple.driver.AppleGraphicsControl(3.18.48)[91D747FB-F341-33F2-BBDD-0CA45A3CC1B2]@0xffffff7f916b1000
            dependency: com.apple.iokit.IOACPIFamily(1.4)[95DA39BB-7C39-3742-A2E5-86C555E21D67]@0xffffff7f8f35a000
            dependency: com.apple.iokit.IOPCIFamily(2.9)[1850E7DA-E707-3027-A3AA-637C80B57219]@0xffffff7f8ef34000
            dependency: com.apple.iokit.IOGraphicsFamily(519.15)[D5F2A20D-CAB0-33B2-91B9-E8755DFC34CB]@0xffffff7f8fdb3000
            dependency: com.apple.AppleGraphicsDeviceControl(3.18.48)[89491182-0B41-3BC3-B16F-D5043425D66F]@0xffffff7f91219000

BSD process name corresponding to current thread: kernel_task
----

So, I started Googling for this GPU Panic problem and found that many laptops had this issue and that many forums said it was all due to a faulty discrete GPU on the logic board. I missed the replacement program (as I was not even aware that it existed until I hit this problem) and now my machine is out of warranty (more than 51/2 years now). The machine is a 15″ MBP 10,1 (mid-2012) with dual GPU system. I thought, if I could get Logic board changed, I should be okay, but in many forums many users who got that done were not still immune from that problem. It had all the possibilities of appearing once more (even after changed GPU). Secondly, Logic board replacement is an expensive affair! Last option, of course, is to get a new MPB, but I wanted to wait till the WWDC June 2018 announcement.

Anyways, I still wanted to make sure that this is indeed the same GPU problem that I was facing. So, I thought may be I should downgrade the OS X to El Capitan or Sierra and rule out my High Sierra upgrade. After checking with both the older OS X, I started getting very frequent GPU panics, like the one pasted above. With laptop in comatose mode 😉 I literally had to resuscitate it using SHIFT + OPT + COMMAND + Power (SMC reset) by counting 10 and then do a CMD+OPT+R+P+POWER (NVRAM Reset) and the wait for sometime and power up again. It all then depended on the spirit to re-enter the machine and bring it to life again :)) Many times, it had barely woken up and slipped into coma again. Then sometimes it would work for 2/3 days straight, until I don’t open up any BIG IDEs like Intellij or any program like Chrome or Firefox that caused a switch to dGPU.

In the Apple forums, I saw people had already disabled the on-board dGPU and they had a working system with only the built-in iGPU. However, it was done for older makes (year 2011) of the MBP. I searched for my particular make with NVIDIA GeForce GT650M Graphics card. I stumbled upon 2 links:

1) https://github.com/mayankk2308/purge-nvda/blob/master/purge-nvda.sh (NVIDIA driver)
2) http://www.javajirawat.com/2018/02/macbook-pro-2012-broken-gpu-work-around.html (AMD driver)

Thanks to them and I combined both their solutions to disable the dGPU on my system.

The Steps:

    I. Sanity Check (find the number of GPUs):

    • You can either go to Apple Menu > About This Mac… > Overview Tab > Press System Report…Under Hardware, look for Graphics/Displays…
    • Or you can type at terminal (and it displays the same information)
      $ system_profiler SPDisplaysDataType 
      
      Built-In GPU (Integrated GPU - iGPU): Intel HD Graphics 4000 1536 MB
         ...
         ...
      Second GPU (Discrete GPU - dGPU): NVIDIA GeForce GT 650M
      gMux Version:	3.2.19 [3.2.8]
         ...
         ...
      Display - Color LCD Resolution - 2880 x 1800 Retina Framebuffer Depth:	24-Bit Color (ARGB8888)
      Metal:	Supported, feature set macOS GPUFamily1 v3
      
  1. II. In Recovery Mode, do the following (Using the Recovery Terminal Utility), do the following:

  2. Boot into Recovery Mode (by holding Command+R while pressing the power button). At terminal prompt, we will disable SIP (System Integrity Protection)
        $ csrutil disable
        System Integrity Protection now disabled.
        
  3. Reboot again in Single User mode.
        $ reboot 
        $ # and then hold Command+S keyboard buttons
        $ # to boot in single user mode.
    
        
  4. III. In Single User Mode, do the following:

  5. Do a Hard disk Check:
     
        $ /sbin/fsck -fy
        $
        
  6. Mount Root file system in Read-Write (uw) mode:
        $ /sbin/mount -uw /
        $
        
  7. Create a backup directory to hold existing GeForce drivers:
        $ mkdir /GeForce_save
        $
        
  8. Move all the GeForce drivers to the backup directory:
        $ mv /System/Library/Extensions/GeForce* /GeForce_save
        $
        
  9. Delete Driver Cache
        $ rm -rf /System/Library/Caches/com.apple.kext.caches/
        $
        
  10. Force refresh of Driver cache:
        $ touch /System/Library/Extensions
        $ kextcache -q -update-volume /
        $
        
  11. Reboot again (into Recovery mode while holding Command+R)
        $ reboot 
    
        
  12. IV. In Recovery Mode, do the following (Using the Recovery Terminal Utility):

  13. Remove Nvda Booting GPU
        $ nvram boot-args="nv_disable=1" 
        # OR append existing boot-args 
        $ nvram boot-args="nv_disable=1 $(nvram boot-args 2>/dev/null | cut -f 2-)"
        $ nvram fa4ce28d-b62f-4c99-9cc3-6815686e30f9:gpu-power-prefs=%01%00%00%00
        $
        
  14. Enable SIP (System Integrity Protection)
        $ csrutil enable
        System Integrity Protection now enabled.
        
  15. Reboot machine in normal mode
        $ reboot
         
        

IMPORTANT NOTE:

  1. By using nvram boot-args=”nv_disable=1″, you will lose brightness control (F1/F2 keys) and sleep mode (clamshell open/close) does not work. When the computer awakes after sleep, it shows a black display. Also, the brightness slider will no longer show up in System Prefs -> Display. However, you can adjust the backlight to a fixed value. For example, I prefer the low backlight-level. In the recovery terminal,
    $ nvram backlight-level="\%00"
    
    

    Various valid values in the increasing order of brightness are: 0%00, C%00, \%00, z%00, %9f%00, %cb%00, %01%01, A%01, %8c%01, %e6%01, P%02, %d2%02, \%03, %ff%03.

  2. Once you use this patch, you won’t be able to connect to external displays and project on that screen (as MacBook-Pro routes to external ports – HDMI and thunderbolt using the dGPU)
  3. When the computer after sleep, it shows a black display but the machine is still running the OS. To get the screen back, I need to turn the machine off. But this means, its improper shutdown when you have processes running. One solution is that you can remote desktop into the system by using Screen Sharing or VNC. Using this you can get back into the machine, and work like usual until the process completes and then shutdown the machine. Also, while using Screen Sharing, you can project the shared screen on an external display from that client machine.

Update: After this I applied the Security Update 2018-001 and it went fine. I could boot back into my Mac and work with it just like before. I have not yet updated to High Sierra 10.13.5 yet. Once I am able to get that done as well, I’ll share my findings on this post. Stay tuned!

Advertisements