After following the guide I found here I found that although my hardware is the same as its author I could not reproduce the same results. After creating the GRUB script to register the PCI registers during boot, making the file executable, and updating the GRUB config files (i.e., after following Step 3) I enter:

sudo setpci -s "00:17.0" 3e.b

According to step 4 it outputs 00 instead of the expected 08

However, when I enter

sudo setpci -s "04:00.0" 04.b

it returns the expected value of 07 as is found in the guide.

What else should I do to ensure I can utilize the nVidia drivers on my setup?

I don't completely understand the guide, but have the same hardware and followed the same instructions.

I have a dual-boot MacBook Pro (7,1) with OS X and Ubuntu 16.04 LTS.

rEFInd (version 0.10.3-1) is my boot loader.


After inputing

dmesg | grep -i efi

I get the following:

[    0.000000] Command line: \boot\vmlinuz-4.4.0-22-generic.efi.signed ro root=UUID=d5117e29-6aa7-46cb-ab22-616c19309a3c initrd=boot\initrd.img-4.4.0-22-generic
[    0.000000] efi: EFI v1.10 by Apple
[    0.000000] efi:  ACPI=0xbf96a000  ACPI 2.0=0xbf96a014  SMBIOS=0xbf71a000 
[    0.000000] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645519600211568 ns
[    0.000000] Kernel command line: \boot\vmlinuz-4.4.0-22-generic.efi.signed ro root=UUID=d5117e29-6aa7-46cb-ab22-616c19309a3c initrd=boot\initrd.img-4.4.0-22-generic
[    0.953332] efifb: probing for efifb
[    0.953363] efifb: framebuffer at 0xc0010000, mapped to 0xffffc90002800000, using 6400k, total 6400k
[    0.953370] efifb: mode is 1280x800x32, linelength=8192, pages=1
[    0.953374] efifb: scrolling: redraw
[    0.953378] efifb: Truecolor: size=8:8:8:8, shift=24:16:8:0
[    0.961402] fb0: EFI VGA frame buffer device
[    2.227701] EFI Variables Facility v0.08 2004-May-17
[    2.853971] [Firmware Bug]: ACPI(IGPU) defines _DOD but not _DOS
[    2.952253] fb: switching to nouveaufb from EFI VGA

These are more of my outputs when following said guide.

2. Find the right PCI-E bus identifiers

sudo lshw -businfo -class bridge -class display

Bus info          Device      Class          Description
pci@0000:00:00.0              bridge         MCP89 HOST Bridge
pci@0000:00:03.0              bridge         MCP89 LPC Bridge
pci@0000:00:0e.0              bridge         NVIDIA Corporation
pci@0000:00:15.0              bridge         NVIDIA Corporation
pci@0000:00:16.0              bridge         NVIDIA Corporation
pci@0000:00:17.0              bridge         MCP89 PCI Express Bridge
pci@0000:04:00.0              display        MCP89 [GeForce 320M]

3. Create a GRUB script for setting the PCI-E registers during boot

sudo nano /etc/grub.d/01_enable_vga.conf

Then enter the following:

cat << EOF
setpci -s "00:17.0" 3e.b=8
setpci -s "04:00.0" 04.b=7

Ctrl + X

Y for Yes to save config file.

Then run

sudo chmod 755 /etc/grub.d/01_enable_vga.conf
sudo update-grub

Both of those commands execute fine.

4. Reboot and check

Upon rebooting I run:

sudo setpci -s "00:17.0" 3e.b

And get 00 instead of the expected 08.

I also run:

sudo setpci -s "04:00.0" 04.b

which returns the expected 07, just like the guide.

Let me know if I can provide more details to help me solve this issue.


I had previously (i.e., before attempting to follow the guide) deleted the "ubuntu" folder (and therefore it's corresponding grub settings) that is installed on the EFI partition while installing Ubuntu in order to get rEFInd to show up on start-up. I had thought that the two were competing since back then I would start the MacBook and it would automatically boot into Ubuntu without showing the rEFInd menu.

After uninstalling rEFInd, reinstalling Ubuntu, and setting the Grub menu as shown here I ran the steps in the Nvidia Driver guide. I got the correct output this time.


However, now when selecting the "NVIDIA legacy binary driver version 304.131 from nvidia-304 (proprietary)" from the GUI 'Additional Drivers' menu and applying changes it doesn't switch the selection out of the Nouveau setting.

Thinking it was a GUI glitch, I wait a while then rebooted anyway, but no dice -- the Nouveau driver is still used after start-up.

I'm wanting to be cautious in proceeding so what command lines should I input from here?

(Note: An additional frustration is that after this reinstallation process my WiFi is now not working properly despite proper drivers being used. This was not an issue before, but I'll deal with that after I can resolve the Nvidia drivers. Perhaps the wifi woes for 16.04 and Broadcom 432b are related to something with the boot loaders as well?)

Thanks for the help thus far.

  • Testing if it works would be a good idea. Also, I'd read it again, or ask about stuff you don't understand. – mikewhatever May 14 '16 at 19:05
  • @mikewhatever It doesn't work. The screen goes black upon booting and TTY is inaccessible. Only rebooting in single-user mode via rEFInd and pressing "Enter" to enter maintenance will provide me with a command line. From there I sudo apt-get remove --purge nvidia-* and then sudo reboot. After rebooting, it defaults back to the nouveau driver which allows me to access the system again. What I don't understand is: 1) Why do I get 00 as output rather than 08? 2) What role dose grub play if I am using rEFInd? 3) What commands would help me diagnose / resolve this issue? – Joshua Drolte May 14 '16 at 19:32
  • 1) Hard to tell. You need to post the outputs from 2 and 3, or double check you've done everything right. 2) The guide is based on grub, so if you know how to pull the same trick with other boot loaders, let us know. 3)If the guide doesn't work, you'd need to do some research. – mikewhatever May 14 '16 at 20:23
  • @mikewhatever Added more info on the edit of the OP. Also, as far as I know rEFInd can boot grub EFI, but I'll have to do some digging to see if that process is the culprit on my setup. – Joshua Drolte May 15 '16 at 0:00
  • @mikewhatever Updated OP. I seem to have fixed the issue with getting different results upon checking the grub scripts, but am wanting some guidance for changing from the nouveau driver to the nvidia one. – Joshua Drolte May 15 '16 at 15:19

After uninstalling rEFInd, reinstalling Ubuntu so that the "ubuntu" folder appears in the EFI partition (e.g., opening 'Terminal' on OS X, running sudo mountesp and then viewing the EFI partition in Finder), setting the Grub menu (as detailed here) and following the instructions in the original guide I was able to get the expected outputs of 08 and 07 before attempting to install the proprietary nVidia drivers.

When first attempting to install the proprietary nVidia drivers via the "Additional Software" GUI they would not install and upon reboot the open source Nouveau driver was being used.

However, when on the login page I accessed TTY1 (i.e., FN + Control + alt + F1), logged in, ran sudo apt-get purge nvidia*, and rebooted. Once I logged back into Ubuntu, I opened "Terminal" and ran sudo apt-get install nvidia-340, then sudo apt-get update, followed by sudo apt-get dist-upgrade, and then rebooted.

This resulted in a successful start-up of Ubuntu 16.04 LTS on my MacBook Pro (7,1) in a dual-boot configuration (OS X 10.11.4 El Capitan) utilizing Grub as my boot loader.


Thank you to the guides linked herein and @mikewhatever for helping me address this issue. Hopefully this will help others who may encounter similar issues.


I finally solved the problem when setpci doesn't change the value of PCI-E bridge.

If you are unable to set the value of PCI-E brigde register using setpci command in order to get nVidia GeForce drivers working on your Apple MacBook machine try these steps:

1. Find your PCI-E bus identifiers

lshw -businfo -class bridge -class display

[root@kernelLinux]# lshw -businfo -class bridge -class display
Bus info          Device      Class          Description
pci@0000:00:00.0              bridge         MCP89 HOST Bridge
pci@0000:00:03.0              bridge         MCP89 LPC Bridge
pci@0000:00:15.0              bridge         NVIDIA Corporation
pci@0000:00:17.0              bridge         MCP89 PCI Express Bridge
pci@0000:02:00.0              display        MCP89 [GeForce 320M]

You will need the ID's of PCI Express Bridge and your display in format XX:XX.X

Your ID's can be different.

In this example our ID's are 00:17.0 for PCI-E brige and 02:00.0 for display [GPU].

2. Create a GRUB script

Our script will be slightly different than in mentioned post above.

I have noticed of two things. Grub2 installed using distro (mine is Centos) installation process doesn't contain setpci grub module. It's the reason why grub do not change registers while boot. Then It is necessary to load setpci module into grub before we run commands to change registers.

Download grub2-efi-modules

Ubuntu Linux

sudo apt-get install grub-efi-amd64-bin

Fedora Linux

sudo dnf install grub2-efi-modules

CentOS Linux

sudo yum install grub2-efi-modules

Modules will be installed in /usr/lib/grub/x86_64-efi/ but the setpci module files needs to be present in /boot/efi/EFI/ubuntu/x86_64-efi/

Create x86_64-efi folder.

Ubuntu folder in /boot/EFI/ can be different on your machine depends how you named it in OS installation process, do not paste it. Replace it with correct path.

sudo mkdir /boot/efi/EFI/ubuntu/x86_64-efi

Copy setpci module files into grub2 folder

sudo cp /usr/lib/grub/x86_64-efi/setpci.* /boot/efi/EFI/ubuntu/x86_64-efi

Create the 01_enable_vga.conf file.

sudo nano /etc/grub.d/01_enable_vga.conf

The file should contain these lines of code:

Do not forget replace 00:17.0 for PCI-bridge and 02:00.0 for display [GPU] with your values.

cat << EOF
insmod setpci
setpci -s "00:17.0" 3e.b=8
setpci -s "02:00.0" 04.b=7

Then repair permissions

sudo chmod 755 /etc/grub.d/01_enable_vga.conf

and update the /boot/efi/EFI/ubuntu/grub.cfg

Ubuntu Linux

sudo update-grub

Do this command only on other distributions (not necessary on Ubuntu after update-grub):

grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg

3. Reboot your system and check registers

Reboot your machine and check if it's working. Replace ID's with yours again. Your terminal should finally show 08 (PCI-E bridge) and 07 (GPU).

sudo setpci -s "00:17.0" 3e.b

sudo setpci -s "02:00.0" 04.b

4. Install nVidia drivers

Screenshot: http://imgur.com/a/YiBXi

  • The whole process is identical on any distro with grub2 efi bootloader. I only need examine which package in ubuntu repositories contains grub2-efi-modules. – ylwghst Aug 5 '17 at 7:18
  • I updated it.I would like to automatize it and create a script for whole thing in future. – ylwghst Aug 5 '17 at 7:41

You have to set the token spoof_osx_version in refind.conf. From rEFInd documentation http://www.rodsbooks.com/refind/configfile.html:

On some Macs, this option causes rEFInd to tell the firmware that the specified version of OS X is being launched, even when another OS is selected. The effect is that the firmware may initialize hardware differently, which may have beneficial (or detrimental) results. If your Mac's video output isn't working normally, this option may help. On the other hand, keyboards and mice are known to sometimes stop functioning if this option is used, so you shouldn't use it unnecessarily. This option has no effect on non-Apple hardware. The default is to not use this feature.

I have a Macbook Pro 7,1 with a dual boot of macOS Sierra and Ubuntu 16.04, so I set:

spoof_osx_version = 10.12

If you wonder on how to edit the refind.conf file, please refer to Where can I find the refind.conf configuration file?.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.