Ubuntu on a MacBookPro 8,2
Partition
In OSX, open the Disk Utility, select the main disk. We're going to split this in to two parts. Up to you how much you want to dedicate to OSX. Set the 2nd partition to be "Free Space".
rEFInd
Because Apple is a super-special-snowflake, it's not possible to directly install Ubuntu onto the new partition. We need to first install rEFInd. There are specific instructions for Yosemite.
- Download rEFInd.
- Extract it onto your Mac.
- Open a Terminal and navigate to the directory.
- Run this command
sudo ./install.sh --esp
- We need to edit some files. Still in the Terminal
mkdir /Volumes/esp
then
sudo mount -t msdos /dev/disk0s1 /Volumes/esp
- Edit the file "/Volumes/esp/EFI/refind/refind.conf". Change the line
#dont_scan_volumes
to
dont_scan_volumes foo,bar
- Save the file. When you reboot, rEFInd should ask you which OS you want to boot to.
Get Ubuntu
Probably the easiest bit! Download the 64 bit version of Ubuntu. I used another Ubuntu machine to create the Boot Disk on a USB stick.
Install Ubuntu
Turn your MacBook off, insert the USB drive, turn the device on. All being well, rEFInd will give you a choice of devices to boot into. You probably want the one which says something like
/USB/EFI/grub64
You should see a grub style boot screen. Use the cursor keys to move down to "Install Ubuntu". Do NOT press enter! Press "e" to edit the boot options.
If you don't do this - your screen will be blank. And a black screen will make you sad.
Remove the words
quiet nosplash
and replace them with
nomodeset
. Then press the "F10" key to boot.
You'll be taken through the normal Ubuntu installation screen. It's pretty much just clicking "Next" until it is installed.
Partitions
...With the exception of setting up the partitions!
- Create a 130MB empty partion. Macs get sad if OSX is bundled up next to a proper OS.
- Create a 512MB partition and assign it to "/boot"
- At the end of the free space, create a "Swap" parition. Personally, I use as much swap as there is RAM.
- With the remaining free space, create a partition and assign it to "/".
- Which device to you want to boot from? I chose the partition assigned to "/boot" - that way you go straight into Ubuntu when you start the machine. If you ever need to get into OSX, hold down "alt" while turning the machine on.
Keep clicking next! Eventually Ubuntu will be installed and you can reboot!
Setting Up Video
When the grub screen comes up, again you'll need to hit "e" to edit the default boot options.
Scroll down to "load_video" and add these lines below it. I don't know what they mean - it's just magic.
Lorsque l'écran grub apparaît, vous devrez à nouveau appuyer sur "e" pour modifier les options de démarrage par défaut.
outb 0x728 1
outb 0x710 2
outb 0x740 2
outb 0x750 0
set timeout=5
menuentry "Try Ubuntu without installing" {
set gfxpayload=keep
outb 0x728 1
outb 0x710 2
outb 0x740 2
outb 0x750 0
linux /casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash i915.lvds_channel_mode=2 i915.modeset=1 i915.lvds_use_ssc=0 ---
initrd /casper/initrd
}
Faites défiler jusqu'à "load_video" et ajoutez ces lignes en dessous. Je ne sais pas ce qu'ils veulent dire, c'est juste magique .
Cela devrait vous démarrer sous Linux. Nous devons maintenant rendre ces changements permanents. Ouvrez un terminal et exécutez
sudo nano /etc/grub.d/10_linux
Appuyez sur CTRL+W pour trouver la ligne contenant "gzio".
Ajoutez ces lignes avant, de sorte que la nouvelle section ressemble à
echo " outb 0x728 1" | sed "s/^/$submenu_indentation/"
echo " outb 0x710 2" | sed "s/^/$submenu_indentation/"
echo " outb 0x740 2" | sed "s/^/$submenu_indentation/"
echo " outb 0x750 0" | sed "s/^/$submenu_indentation/"
echo " insmod gzio" | sed "s/^/$submenu_indentation/"
Pour appliquer ces modifications, exécutez les commandes suivantes.
sudo update-grub
sudo apt-get update
sudo apt-get dist-upgrade
Ventilateurs
Pour une meilleure performance du ventilateur...
sudo apt-get install lm-sensors
sudo sensor-detect
Répondez oui à toutes les questions. Puis:
sudo apt-get install macfanctld
Redémarrez et profitez d'Ubuntu ! Tout semble "fonctionner" - même si j'écrirai un autre article de blog expliquant comment je l'ai personnalisé.
Wifi
apt-get install firmware-b43-installer
Chroot Grub
Boot with your Live CD, selecting "Try Ubuntu without installing".
Once it boots, open a terminal (ctrl-alt-t) and mount your Ubuntu partition on /mnt. I'm assuming the Ubuntu partition is /dev/sda5, but you should determine this yourself. Let me know if you need help to do this:
sudo mount /dev/sda5 /mnt
Then mount a few more directories that are needed:
sudo mount --bind /dev /mnt/dev
sudo mount --bind /sys /mnt/sys
sudo mount --bind /proc /mnt/proc
Also, if you have a separate Ubuntu boot partition (pretty uncommon these days, but it may be the case):
sudo mount /dev/sdaX /mnt/boot
How can you tell if you have a boot partition?
Once you have your Ubuntu partition mounted, open /mnt/etc/fstab
. If you see an entry for /boot
, note which device it is pointing to (/dev/sda4
maybe?). This is the one you have to mount.
Once these are mounted, do chroot to start using the mounted directory as the root partition:
sudo chroot /mnt
You'll get a #/
prompt. First thing to do is confirm that you're using the correct /boot
directory. Go to /boot/grub
and look at the files there. There should be a bunch of .mod files and a grub.cfg file. If the directory is empty, don't continue, because it means this is NOT your actual boot
directory. Look above to see how to determine if you need to mount an additional boot
directory.
Once you've confirmed that /boot/
contains the correct files, meaning that it is the correct location, type:
sudo update-grub
sudo grub-install --boot-directory=/mnt/boot /dev/sda
This should rebuild your /boot/grub/grub.cfg file with the menu entries.
Then exit the chroot:
exit
At this point you may want to check that things were correctly updated. For this, cd /mnt/boot/grub
and check that grub's files are there, there should be a bunch of .mod files and grub.cfg, the latter should have entries for your Ubuntu kernels. If you only see grub.cfg and no .mod files, it means that this is NOT the correct boot directory, look above for how to mount a separate boot partition.
Unmount the filesystems:
sudo umount /mnt/dev
sudo umount /mnt/sys
sudo umount /mnt/proc
sudo umount /mnt/boot #Only if you mounted it earlier
sudo umount /mnt/
And then reboot, hopefully your Grub menu will be restored.
V2
-
Install linux to a flash drive on a different PC. Load from one stick, and use another as a target drive.
-
Boot from that linux-on-stick on PC.
-
Use this tutorial https://www.variadic.xyz/2020/06/15/ubuntu-2011mbp/ to modify default GRUB options
-
Boot MBP off this modified live stick, install linux to your Mac. (In Ubuntu, the GUI for installing os is named Ubiquity, and can be installed like any other application:
apt install ubiquity
.) -
After installation is complete, don't reboot, but chroot to an installed Ubuntu. To do that, from terminal enter the following:
sudo mount /dev/[your new root partition] /mnt sudo cp /etc/resolv.conf /mnt/etc/resolv.conf sudo mount --bind /dev /mnt/dev sudo mount --bind /proc /mnt/proc sudo mount --bind /sys /mnt/sys sudo chroot /mnt /bin/bash sudo mount -a
After that, repeat step 3.
-
Exit the chroot and reboot:
exit umount /mnt* reboot
-
Now Macbook should boot, function with Intel GPU and survive OS updates. If not, just boot that "rescue usb" you made in step 3 and repeat steps 5-6.