Ubuntu 22.04 on MacBook A1286 2011 with broken GPU

The 15″ and 17″ Macbook Pro from 2011 are known for their dGPU failures (AMD-GPU). There are both software and hardware hacks to turn off the broken dGPU and use the iGPU found on the Intel processor.  The easiest is, of course, a software fix, the only problem with the software fix is that the fix will disappear after an NVRAM reset.

The UEFI bios on the Macbook has a varibale which instruct the bios as to which GPU to use.

The catch22 is that you can only set this variable from a booted system, but it can be impossible to boot if the dGPU is too broken, So what can you do?

  • Modify the UEFI bios to set the use-iGPU variable, I have seen no one do this, maybe this is what CMIzapper/Tiresias does. Tiresia is a PCB you add around the BIOS, it costs 30-58 Euro. If I knew more about UEFI, and its use in Macs I would think it would not be too difficult to extract a copy of the BIOS firmware, modify it with UEFItool to set the magic UEFI variable, and flash it back.
  • Remove a resistor R8911 which powers the AMD GPU, I am not sure if this is enough to be able to boot if the UEFI variable isn’t set, on a system with a really broken dGPU.
  • Boot Linux from a USB-stick and set the UEFI-variable
  • People also do this from MacOS Disconnecting the dGPU in a late 2011 MacBook Pro
  • Physically remove the gMux and hardwire the mainboard to use iGPU Permanently Disabling the Defective GPU
  • dosdude1 sells a solution where you reprogram the gMUX to only use iGPU
  • gMUXBypass is an open-source implementation of the same

I had originally planned on the last solution but I can still boot my MacBook from USB, so I will settle for a software-only solution.

For more inspiration see:

Here is what I did:

  • Download ISO for ubuntu-22.04
  • copy the content of the ISO to a FAT32 formatted USB stick with rsync – not dd, we need to be able to modify the ubuntu boot image.
  • On the USB stick, add a new menuentry to boot/grub/grub.cfg which turns of the dGPU
    menuentry "Try or Install Ubuntu on MacBook 2011 w broken GPU" {
    	set gfxpayload=keep
    	outb 0x728 1
    	outb 0x710 2
    	outb 0x740 2
    	outb 0x750 0
    	linux /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed maybe-ubiquity i915.lvds_channel_mode=2 i915.modeset=1 i915.lvds_use_ssc=0  --- 
    	initrd /casper/initrd
  • restart the MacBook, when the Apple chime sounds press the Option-Key
  • select the Orange EFI icon, I can still see half an icon on my MacBook.
  • select the just  added menuentry from the Grub menu
  • Install Ubuntu as usual. To make WiFi work. you need to enable 3rd prty drivers.

chroot into the just installed Ubuntu

To make apt and other commands work on the newly installed Ubuntu partition while still booted on the USB stick, you need to have access to parts of the current root filesystem.

Just open a WEB-browser on this page, and copy-paste the commands below:

# root-disk-partion will be mounted on /target
cd /target
for i in dev dev/pts proc sys run;do mount -o bind /$i $i;done
chroot .
apt update
apt install refind
# use efibootmgr to set bootorder, I have refind first

# let grub turnoff the dGPU
cat << EOF > /boot/grub/custom.cfg
outb 0x728 1
outb 0x710 2
outb 0x740 2
outb 0x750 0

# set cmdline for linux
sed s/^GRUB_CMDLINE_LINUX_DEFAULT=.*$/GRUB_CMDLINE_LINUX_DEFAULT="i915.lvds_channel_mode=2 i915.modeset=1 i915.lvds_use_ssc=0"/ -i /etc/default/grub

Note that we have not set the EFI variable that instructs the BIOS to only use the iGPU, so we will see a garbled screen just after power-up if we stop here and reboot.

Set UEFI  variable to only use iGPU

Under Linux you read and set UEFI variables under /sys/firmware/efi/efivars and to instruct the UEFI bios to use the iGPU all that is needed is the to set the correct variable to the proper value like this:

# check to see if gpu-power-prefs is set, and if so remove them
ls -l /sys/firmware/efi/efivars/gpu-* chattr -i /sys/firmware/efi/efivars/gpu-power-prefs-* rm /sys/firmware/efi/efivars/gpu-power-prefs-* # the gpu-power-prefs should be gone now, so create new one to select iGPU on boot ls -l /sys/firmware/efi/efivars/gpu-* printf "\x07\x00\x00\x00\x01\x00\x00\x00" > /sys/firmware/efi/efivars/gpu-power-prefs-fa4ce28d-b62f-4c99-9cc3-6815686e30f9 # just checking if things are as expected ls -l /sys/firmware/efi/efivars/gpu-*

Now we are almost done

Make sure the dGPU is powered off

The only problem left is that the BIOS might power the dGPU back on after sleep (laptop lid closed)  This could of course be fixed by performing the 4 outb instructions above, either in a stand-alone program called from /etc/acpi/events/laptop-lid, or through adding them to DSDT, but the easiest is to just remove the resistor R8911 which powers the dGPU 2011 MacBook Pro Video GPU issues successful repair with images

Next blogpost Catalina or High Sierra on MacBook A1286 2011 with broken GPU

Print Friendly, PDF & Email
This entry was posted in Linux, Mac. Bookmark the permalink.

1 Response to Ubuntu 22.04 on MacBook A1286 2011 with broken GPU

  1. Pingback: Catalina or High Sierra on MacBook A1286 2011 with broken GPU | StorePeter

Comments are closed.