R
G

Back to list2022-145

Macbook Pro 11,3 disable nvidia chip on (Arch/Manjaro) Linux

This popular series of Macbooks comes in many varieties. My particular model is an A1398 with a 15 inch HiDPI display, 2.8 GHz i7 CPU and 16 GB of RAM. The dedicated graphics chip is an nvidia GT750M. However those laptops come with dual GPU capability switching the nvidia GPU on when the workload rises and returning to the much less powerhungy intel graphics chip.

When using MacOS X this works reasonably well. On Linux however the intel graphics chip doesn't even show up. Instead one is forced to use the nvidia chip full time increasing the heat output and of course decreasing battery life significantly.

My goal was to re-enable the intel GPU and to completely remove the nvidia driver as nothing worth it's presence is done on this macbook anyway. This is how I did it on Manjaro Linux KDE edition in mid 2022.

Verify your type of hardware

This is written for the Macbook 11,3 series. Other series might have different requirements to get this done. Sadly I cannot help with those.

To verify your hardware you can use sudo dmidecode -t system. The output should look something like this:

# dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 2.4 present.

Wrong DMI structures length: 2686 bytes announced, only 2468 bytes available.
Handle 0x000D, DMI type 1, 27 bytes
System Information
        Manufacturer: Apple Inc.
        Product Name: MacBookPro11,3
        Version: 1.0
        Serial Number: <REMOVED>
        UUID: <REMOVED>
        Wake-up Type: Power Switch
        SKU Number: System SKU#
        Family: Mac

Handle 0x0023, DMI type 12, 5 bytes
System Configuration Options

Handle 0x0025, DMI type 32, 20 bytes
System Boot Information
        Status: No errors detected

Notice the Product Name.

In addition to that run lspci | grep VGA. This may only result in one line:

01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 750M Mac Edition] (rev a1)

However, if you see an output including the intel chip there is no need to continue activating it:

00:02.0 VGA compatible controller: Intel Corporation Crystal Well Integrated Graphics Controller (rev 08)
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 750M Mac Edition] (rev a1)

Change your bootloader to rEFInd

WARNING: You are about to replace your bootloader. If something goes wrong your system will not boot. Unless you are aware on how to fix a broken bootloader I don't recommend you continue. Recovery is not explained in this post.

This step is optional. However I had trouble getting the required efi application to run in grub despite it being set up according to the manual. So feel free to try it using another bootloader. rEFInd worked best for me so I recommend installing it.

You can learn all about rEFInd on the official website: https://www.rodsbooks.com/refind/
And of course all Arch specific notes are on it's wiki page: https://wiki.archlinux.org/title/REFInd

The basic installation worked just fine for me:

sudo pacman -S refind
sudo refind-install

This should have replaced your bootloader already. Reboot and test it. If nothing went wrong you will notice that the bootloader changed.

Enable the intel chip

To enable the intel chip the bootloader needs to fake identify itself as Mac OS X. This can be done thanks to the work of github developer 0xbb and his project apple_set_os.efi.

Take a look at the code if you like. What it does is essentially changing the name of your OS.

You won't need to compile the code yourself. Instead use the already built *.efi file from the releases page.

Put apple_set_os.efi into /boot/efi/EFI/refind/drivers_x64.

You might get an error message about permission issues. However when you check if the file is there all is well.

This should be it for rEFInd. If you use another loader check how to chainload the efi file when booting.

Reboot again.

After rebooting check if the intel chip is now available lspci | grep VGA. The output should show two cards:

00:02.0 VGA compatible controller: Intel Corporation Crystal Well Integrated Graphics Controller (rev 08)
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 750M Mac Edition] (rev a1)

If not something is wrong. Make sure that the efi file is truly loaded and working.

Changing the X server to intel

Finally Changed the X config located in /etc/X11/xorg.conf.d/90-mhwd.conf. Ironically it was the nvidia package autocreating this file.

I added the native display resolution (see below) and replaced the nvidia driver with the intel driver. The final file looks like this:

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 390.147  (dvs-builder@U64-E08-29-1)  Mon Dec 13 13:50:12 UTC 2021

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "Files"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    #VendorName     "Unknown"
    #ModelName      "Unknown"
    #HorizSync       28.0 - 33.0
    #VertRefresh     43.0 - 72.0
    #Option         "DPMS"
    Modeline "2560x1600"  348.16  2560 2752 3032 3504  1600 1601 1604 1656  -HSync +Vsync
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "intel"
    VendorName     "Intel Corporation"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
    Modes       "2560x1600"
    EndSubSection
EndSection

Section "Extensions"
    Option         "COMPOSITE" "Enable"
EndSection

 
Section "InputClass"
    Identifier          "Keyboard Defaults"
    MatchIsKeyboard        "yes"
    Option              "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection
 
Section "ServerFlags"
  Option "IgnoreABI" "1"
EndSection

Adding multiple resolutions

You may have noticed the Modeline explaining the display resolution:

Modeline "2560x1600"  348.16  2560 2752 3032 3504  1600 1601 1604 1656  -HSync +Vsync

The tool gft can create those for you like this:

gtf 2560 1600 60

The last number specifies the refresh rate.

Feel free to add whatever resolutions works for you.

Troubleshooting KDE (stuck in 960x540)

For some reason my KDE settings got all messed up by the change and I got stuck with a 960x540 px resolution.

I solved this by resetting the KDE display settings like this rm ~/.local/share/kscreen/.

Troubleshooting no graphics

If something goes wrong with your graphical environment not loading, don't panic. You can still use the native Linux terminals to fix your issues.

Use CTRL-ALT-F2 to switch to this terminal. Log in normal and you can use the command line to undo changes or do whatever else you might need to do.

You can restart your graphical environment using systemctl restart sddm or try starting X yourself using xinit. If something goes wrong this will create a log file. Pay attention to the output to see where it is located.

But how to connect to wifi?

For some reason Apple things Ethernet plugs aren't required by professional users. So unless you have some USB adapter (the TB one does not work for me under Linux) you can still use your wifi using nmcli. Example:

nmcli --ask dev wifi connect WIFINAMEHERE

Using --ask will ask for the wifi password. Once connected you can use pacman, etc. as usual.

Removing nvidia for good

I went as far as removing the nvidia driver all together and disabling the nvidia card as an option in the kernel configuration:

pacman -R linux515-nvidia-390xx
pacman -R nvidia-390xx-utils lib32-nvidia-390xx-utils

# As root!

echo "options bbswitch load_state=0 unload_state=1" >> /etc/modprobe.d/bbswitch.conf
echo "blacklist nvidia
blacklist nouveau" >> /etc/modprobe.d/nvidia.conf

Summary

While it's a bit sad that these steps are needed at all Apple hardware is always a bit special. However once it's up and running these macbooks make for amazing linux machines especially due to their screen and the excellent keyboard.

This guide is probably not a 1:1 blueprint that applies for everyone but hopefully helps a few of you along to get this done on your own macbooks. Good luck!