How to install Debian 9 on Macbook 13″ (end 2009)

Here how i installed Debian 9 stretch on my old macbook 6,1 (mid 2009)
NB: where you’ll see a # before command, means you should be root or need to use sudo.

Hardware:
Video card NVIDIA  GeForce 9400M with 256 MB of SDRAM shared with main memory
Screen size 13″
Wireless card Broadcom BCM4360
Disk 256 Gb Serial ATA (5400 RPM) hard drive
Ram 8 gb SODIMM 1600MHz
Wi-fi controller Broadcom Corporation BCM43224 802.11a/b/g/n (rev 01)
Ethernet controller NVIDIA Corporation MCP79 Ethernet (rev b1)
USB 2.0 ports (2x)
Audio in/out port NVIDIA Corporation MCP79 High Definition Audio (rev b1)
Mini DisplayPort that supports an external display at 2560×1600

Procedure :
1)From mac OS , using utility disk, i resized Osx partition freeing up space for Linux ( i did not format this empty space)
2) i ‘ve downloaded a debian image (i used netinst ) and put in a usb pen (i used unetbootin)
3) i have connected wired cable (wi-fi will not work at first time)
4) inserted usb pen, turned on mac holding down the Option key while booting
5) I have installed Debian – i formatted free space as ext4,  i choose Mate as display manager, because is light (Kde would have been unfeasible)- LightDM was selected automatically as login manager.
After reboot, MBR will be overwritten by Grub, so only Debian will start (for now)

Fix Reboot
Shutdown, suspend and hibernate all work out of the box. For reboots, a modification should be made.
# /nano/etc/default/grub
adding  “reboot=pci” in GRUB_CMDLINE_LINUX DEFAULT row
if e.g. you have
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
will become GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash reboot=pci
Now, on the terminal run sudo update-grub, shutdown macbook and power it on again.
Reboot should works at the end.

Refind Bootloader installation
Since i have Mac Osx in the other partition, i need to install Refind boot manager, that will allow to choose between Debian/Mac during system startup, therefore :
# apt-get install refind
After installation, at startup time you will have in addition to Mac, 2 (?) Debian icons, each of which respectivaly run initrd (initial ramdisk) and vmlinuz (kernel).
Leaving aside initrd/vmlinuz explanation, (is not the scope of this post) , important thing to know is that if we will boot using initrd we’ll use Grub, while if we will boot choosing kernel we’ll not use Grub
/boot/initrd.img-4.9.0.3-amd64 –> start with grub
/boot/vmlinuz-4.9.03-amd64 –> start without grub
Since as i described in Grub section, reboot works thanks to grub modification (reboot=pci); therefore clearly we need to start image that uses grub (unless you want to reboot the macbook by turning it off and then turning it back on with the button 🙂
Only option is to use initrd.img, so we have to modify refind configuration in order to hide vmlinux image in refind startup menu:
# nano /boot/efi/EFI/refind/refind.conf
and we add:
dont_scan_files vmlinuz-4.9.0-3-amd64
scan_all_linux_kernels false
Save and Exit.

Video drivers
I don’t like nouveau driver:basically, in my opinion Nvidia drivers working better, so i don’t see any reason to not use them; furthermore, i needed to have possibility to work also with an external monitor and this is perfectly working using nvidia drivers
Therefore i installed nvidia-drivers (340) and  nvidia-settings (optional but strongly suggested)
# apt-get install nvidia-legacy-340xx-driver nvidia-settings-legacy-340xx
Nvidia-settings-legacy is a GUI with all settings, useful especially if you need to use an external monitor (but not only, as you can see later).
After reboot you will see nvidia logo before login-manager (obviously you can remove it).
NB i tried to install drivers with version > 340 but did’nt work out , so don’t waste your time:-)

Wi-fi
At first boot,Wi-fi will be not recognized
we have to install broadcom drivers
# apt-get install linux-image-$(uname -r|sed ‘s,[^-]*-[^-]*-,,’) linux-headers-$(uname -r|sed ‘s,[^-]*-[^-]*-,,’) broadcom-sta-dkms
let’s avoid that other wifi modules would be in conflict with my broadcoam
# modprobe -r b44 b43 b43legacy ssb brcmsmac bcma
now  we add our wl module
# modprobe wl
at reboot you should have your working Wi-fi.

Audio
Work out of the box, Nvidia audio card was recognizes, however checking alsamixer*configurations i noticed that pulseaudio was present as additional sound card, so i decided to remove it
# apt-get remove pulseaudio
After reboot , default card will be HDA Nvidia

Headphone as default are set to zero volume; with alsamixer you can active them (headphone section)
*i strongly suggest to install alsamixer and alsamixer-gui

Isight (webcam)
Work out of the box     make a first check doing (being root) dmesg | grep iSight 

to see cam in action you can also install cheese, and guvcview to change settings.
# apt-get install cheese guvcview

Optional ( isight-firmware-tools)
this part is optional (if cam works, skip this part)
i installed isight-firmware-tool
I wanted to try isight-firmware tool extracting original firmware directly from Mac Osx partition : In order to avoid boring useless permission problems, instead to specify Mac Osx path in tool i prefered to copy in advance the file AppleUSBVideoSupport from Mac Osx partition to my Desktop , so path was /home/fafa/Scrivania/AppleUSBVideoSupport
Then i have execute command:
root@MacDebian:/home/fafa/Scrivania#
ift-extract -a /home/fafa/Scrivania/AppleUSBVideoSupport
As result:
** Message: Found firmware signature at offset 0x1998.
** Message: Firmware extracted successfully in /lib/firmware/isight.fw
………………………………………….
** Message: Firmware patched successfully
Now, looking in /lib/firmware you can see isight.fw
I must say i did’nt notice any difference after installation of this firmware, so if your webcam will immediatly works , you can avoid to install isight-firmware-tools

NB: Scrivania is Desktop in italian language :-).

f1-f2  buttons( backlights)
At beginning will not work, i fixed problem adding in /etc/X11/xorg.conf following row, under Device section
Option “RegistryDwords” “EnableBrightnessControl=1”

if xorg.conf is not present, you can easily edit/save it trough nvidia-settings tool:
Go to Server Display Configuration , then on the bottom right corner clickbutton “save toX configuration file” , before save, click “show preview” and addOption “RegistryDwords” “EnableBrightnessControl=1” under Device section
After reboot , f1-f2 should work – in order to preserve backlight level after reboot, i strongly suggest to add string in grub
# /nano/etc/default/grub
then in GRUB_CMDLINE_LINUX_DEFAULT section i added
acpi_backlight=vendor
so (if you followed my previous suggestion ) will have situation below

NB: i have also removed from grub “quiet-splash ” cause i like to see loading services (of course you can leave it.

f10-f12 buttons (sound level regulation )
Work out of the box.

Bluetooth
It seems working; i wrote “seems” because i did not tested it with other bluetooth devices.
as default is enabled, to disable it:
nano /etc/bluetooth/main.conf
Then look for a row named Initially powered =true and replace “true” with “false”
Save, exit and reboot: Afterthat Bt should be off.

Final result 
(click image below for enlarge)
Debian 9 stretch + Mate+Docky on macbook 6.1

This entry was posted in Gnu-Linux, Mac Os. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *