How To Install Archlinux on MacBook Pro 8,2 [Part.1]

After a long time struggling, finally I am able to write this post on Archlinux!

The reason why I choose Arch; simplicity/configurable/curiosity

I am not a long-term linux user yet, and this installation process has helped me to understand further how the system works. Especially, this apple product made it extra hard, which challenged me even more. I had so much fun(?) and quite happy for now.

I thought it is really necessary to post this, since when I was installing, I had lack of information especially on MacBook pro 8,2. Some existing post for me was very confusing ; this is probably because I am not mature enough on this world. I wish this can be a help for people like me.

Part 1 is going to be focused on the installation process, and Part 2 is to work with Xorg-server by configuring those two problematic video cards!

0. Before you install

-Install rEFit on OSX for choosing the boottable partition. I have seen some complains that this doesn’t work on OSX, but it works fine without any issue.

-check your harddrive name; in orx ->disk0s1 disk0s2 but in Linux -> sda0 sda1. You should know which hard drive you are going to use in order to avoid an accidental erase of your other system.

You need to be able to use either ‘nano’ or ‘vi’ in order to edit some files on the process.

1. Choosing the right installation method

You will need a cd room for installation. The UEFI system on apple machin makes tricky to install from USB. This is the same as any other installer such as Ubuntu.  I will not talk about how to make partition. This can be done with DiskUtility from OSX.

I installed first with the official iso, and yes you can install with this. But there is a bug when you meet the moment to choose which harddrive partition you would like to install. So I choose ‘Archboot‘ Download this iso for macbook pro.

Download it -> make a CD -> boot with CD (pressing C button when booting)

2. Remarks on Installation Process

Then there is setup process. I will explain only remarkable parts because the installer is quite friendly and there is a wonderful document ‘Beginner’s guide’ After you setup font/date etc, you will enter here.

   Menu2: Prepare hard drive 

Do not use the first option ‘Auto-Prepare’ which will erase all data from the harddrive. Go to the 4th option ‘Set Filesystem Mountpoints’

This is to set where you would like to install the system.

If you have an extra partition for swap, set up here too. I set one swap partition and one main one with ‘EXT3.’ (Some how EXT4 had more trouble with booting. Ext3 is more stable for me.)

It will ask for label and additional setup, which you can skip, but I set up the label only as ‘Arch.’

Then it will prepare the partition for you.

**warning message -> /boot is not set : you can ignore this unless you have a different partition for the booting sector. I did on .’/’ .

Then it will install the core system for you. Packages were already choosen by default and you can just follow it easily.

After that, it will show a menu for system configuration. Please check the beginner’s guide for any other information

For MBP, here you need to do somethings like;

mkinitcpio.conf : add on the MODULE=”ahci libahci’

pacman.conf : go down to mirror connection-> remove ‘#’ mark for [core][extra][community] sections.

  Installing Bootloader

There are two options ‘Refind’ Grub2′. Either is okay, but I only tried here with Refind. This will be installed on your top partition for EFI drive. (/dev/sda1) I was frightened when I realize that. rEFind is fine for anything, but your kernel will be uploaded up there, and then you will have to mount this partition all the time. So I recomment ‘Grub2’ which is easier to figure out, and many information is out there to help you.

The installer will lead you to the ‘editing’ the configuration for grub. Skip this part because any way you should come back and install grub again!

Then the installation finished.

3. After the installation; the real war

Reboot and come back to CD. then do;

 mkdir /mnt/arch
 mount /dev/sdXX /mnt/arch ###X is your system partition number. mine is sda4
 cd /mnt/arch
 mount -t proc proc proc/
 mount -t sysfs sys sys/
 mount -o bind /dev dev/
 chroot .

(You can do this whenever you need to configure the new system from the LiveCD.)

Now you get into your new system. Here you are going to install grub correctly and configure.

Install grub

mkdir -p /boot/efi

mount /dev/sdXX /boot/efi ### yes you are mount the disk you are in into the booting erea.sdXX for me is sda4 again.

grub-install --directory=/usr/lib/grub/x86_64-efi --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=arch_grub --boot-directory=/boot --recheck --debug

Create the configuration file;

grub-mkconfig -o /boot/grub/grub.cfg

That’s it.

Then let’s check the grub.cfg file. Go down a bit and find like this;

/boot/grub/grub.cfg
menuentry 'Arch Linux GNU/Linux, with Linux mainline kernel' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-mainline kernel-true-a8ca6c35-c261-4b1c-9858-88a12804302d' {
 load_video
 set gfxpayload=keep
 insmod gzio
 insmod part_gpt
 insmod ext2
 set root='hd0,gpt4'
 if [ x$feature_platform_search_hint = xy ]; then
 search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4 a8ca6c35-xxxx-xxxx-xxxx-xxxx
 else
 search --no-floppy --fs-uuid --set=root a8ca6c35-c261-4b1c-9858-88a12804302d
 fi
 echo 'Loading Linux mainline kernel ...'
 linux /boot/vmlinuz-linux root=/dev/sda4 ro nomodeset
 echo 'Loading initial ramdisk ...'
 initrd /boot/initramfs-linux.img
}

-‘root’ part will be shown up with UUID. check your UUID of your disk and see if that matches. (don’t worry if it looks not exactly the same as this. I added some things too. We’ll discuss it later.)

ls -l /dev/disk/by-uuid/

-Important!!! : there in the middle of the ‘grub.cfg’ file, you can see ‘ro’ and you won’t see ‘nomodeset’, which you will need to add like I did. Otherwise your videocard will prevent from booting. We are going to do the videocard set up later on. For now we set up like this.

-Copy ‘grubx64.efi’ in /boot/efi/EFI/arch_grub/ into /boot/efi/EFI/boot/bootx64.efi in order to make a backup. This will prevent any problem from linux kernel upgrade.

Now you need to re-generate initramfs-linux.img file. Do it as below;

mkinitcipio -p linux

Then please check on /boot directory if you have those two files;

initramfs-linux.img 
vmlinuz-linux

Then go boot to OSX. We are going to set the efi booting.

on terminal :

mkdir /Volumes/esp
 sudo mount -t msdos /dev/disk0s1 /Volumes/esp   ####disk0s1 here should be your linux system partition; it can be disk0s2, disk0s3 etc.
 sudo bless --mount /Volumes/esp --setBoot --file /Volumes/esp/EFI/arch_grub/grub.efi

This worked for me only once, and I cannot explain why it is not working anymore.

If this doesn’t for you, try to install ‘OSXFUSE’ together with ‘fuse-ext2’ on OSX, which will support mounting ext2, ext3 format on osx.
This is the way to do with those tool;

sudo fuse-ext2 /dev/disk0s4 /Volumes/arch -o force

If bless doesn’t work after all you have tried, this worked for me too;

sudo /usr/sbin/bless --device /dev/disk0s1 --mount /Volumes/esp --setBoot --file /Volumes/esp/EFI/arch_grub/grub.efi

Now you should be able to boot to the new system. Check if refit can show your partition.

Please feel free to ask any question. I have spent quite a few days to figure this out, and I think I know all possible errors it can take. I did this procedure over 10 times, and wrote this by heart.

Blacklist some modules;
 go to /etc/modprobe.d/modprobe.conf and add
blacklist sdhci-pci
blacklist sdhci

I didn’t explain how to configure all the other files such as /etc/rc.conf. Those can be found on the arch wiki page below. So please do not think that this is all that you need.

I will see you on Part2 soon!

References :
grub2: https://wiki.archlinux.org/index.php/GRUB2
MBP on arch: https://wiki.archlinux.org/index.php/MacBook_Pro_8,1_/_8,2_/_8,3_(2011_Macbook_Pro)
https://wiki.archlinux.org/index.php/MacBook_Pro_8,1_/_8,2_/_8,3_(2011_Macbook_Pro)
https://bbs.archlinux.org/viewtopic.php?pid=1117490

 

2 Comments

  1. Interesting, thanks.
    I have a couple of questions:
    1. It is not clear from the post how you booted the installation CD. Some references claim that the CD should be booted in EFI mode in order to perform an EFI installation, but, if I understand correctly, you booted in BIOS mode from rEFIt. Is that correct? The reason I am asking is that there seem to be many issues with Archboot in EFI mode on MBP 8,2, and you don’t mention any of these.
    2. Did you have any luck with the Intel card? The only reason I want to switch my current Linux installtion to EFI is that card. I have everything running well in BIOS mode, but the Radeon card really heats up and causes very poor battery life.

  2. Sorry for the late reply.
    1. I am booting as EFI mode from refit. I actually mentioned it on the post ‘Then go boot to OSX. We are going to set the efi booting.’ This part. 🙂
    2. Yes it works. I can only choose one of those between Intel and Radeon. Also How to install Archlinux on MacBook Pro 8,2[Part.2] post will help I hope. 🙂

Leave a Comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.