Macbook Pro 7.1 and Debian 9 Full Install

Share your own howto's etc. Not for support questions!

Macbook Pro 7.1 and Debian 9 Full Install

Postby djairguilherme » 2017-08-06 19:52

I recently installed Debian 9 on my Macbook Pro 7.1. I had to track in many forums some solutions to the problems of connection with Wifi and drivers of Nvidia. I decided to put together everything I discovered in one place. I hope this is useful.

NVIDIA DRIVERS - (Nvidia-340).
I followed this tutorial for Ubuntu.
What it took to find out was which was the correct driver (when I tried to install Ubuntu, the system informed me that the correct driver was Nvidia-304. But it wasn't. The correct driver for this machine is NVIDIA-340.

1. Install Ubuntu in UEFI mode with the Nvidia drivers
I will not go into details here because there are lots of articles on the web showing you how to do this and end up with the nouveau drivers running your machine hot or with the black screen after installing the Nvidia drivers (e.g.

Please note however that the following instructions assume you have successfully installed and booted in UEFI mode. You can verify that by checking for existence of the directory /sys/firmware which is only created after booting in EFI mode.
2. Find the right PCI-E bus identifiers

We need both the IDs for the graphics card and the PCI-E bridge that it is connected to. Issue the following command in a shell:

Code: Select all
~$ sudo lshw -businfo -class bridge -class display

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

Have a look at (1) the line saying display and (2) the line with bridge right before that display line. Write down the PCI-E bus ids (format XX:YY.Z) of the bridge device (here 00:17.0) and the display device (here 04:00.0) and remember which is which. Note: Those IDs may be different on your machine, depending on your Mac model and revision.
3. Create a GRUB script for setting the PCI-E registers during boot

Fire up a text editor with sudo nano /etc/grub.d/01_enable_vga.conf and copy/paste the content below. Replace 00:17.0 with the PCI-E ID of your bridge device noted in step 2. Replace 04:00.0 with the PCI-E ID of your display device noted in step 2.
Code: Select all
cat << EOF
setpci -s "00:17.0" 3e.b=8
setpci -s "04:00.0" 04.b=7

Finally, make the created file executable and update your grub config files using the following TWO commands.

Code: Select all
~$ sudo chmod 755 /etc/grub.d/01_enable_vga.conf
~$ sudo update-grub[/b]

4. REBOOT and check
If, after rebooting, the register values have been set to 8 (bridge device) and 7 (display device), everything went fine:
Code: Select all
 ~$ sudo setpci -s "00:17.0" 3e.b
 ~$ sudo setpci -s "04:00.0" 04.b


5. Install Nvidia drivers and enjoy!
Use Ubuntu's Additional drivers GUI to install the Nvidia drivers. (NVIDIA-340!!!!!)

I installed the b43-firmware-installer package, which worked on the first boot. But in the second boot, the wifi networks disappeared and Network-Manager could not find any network.

Scanning the system error messages, I discovered that the card driver was changing the MAC address at all times. This is a bug already commented and I did the same ... bug=863463

Code: Select all
# sudo nano /etc/NetworkManager/conf.d/10-mac-randomization-off.conf

Wifi.scan-rand-mac-address = no

A second problem is that the wifi card needs to be informed about which country you are in. This is done by changing the / etc / defaut / crda file in the REGDOMAIN =

In my case, I put REGDOMAIN = BR

Then I ran the following command:
$ sudo Iw reg set BR

With these two steps, my wifi was stable.

Another thing that is not done in the default installation is to enable the applesmc and coretemp modules.

My /etc/modules file looks like this...
Code: Select all
# /etc/modules: kernel modules to load at boot time.
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

I also installed the macfanctld package.
Posts: 1
Joined: 2017-08-06 19:21

Re: Macbook Pro 7.1 and Debian 9 Full Install

Postby sunrat » 2017-08-08 04:07

I don't get it. Step 1 you say to install with nvidia drivers, then step 5 is install nvidia drivers. Please explain.
Also you say to install Ubuntu drivers, did Debian ones not work?
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
Posts: 3307
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 5 guests