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

 

Happy 2012! Install Linux on your MacbookPro


My last project of the last year was to get ready as a linux user. All my setup in OSX was targeting toward ‘getting used to using terminal,’ and after all, I couldn’t wait to move to Linux.

Yeah. I have only Apple computers (PowerPC, MBP 4,1, MBP 8,1) , and after a long time as a Apple user, I feel very much tired of how the apple system becomes ‘closed.’

I know a lot of people might argue about this, but I would like to be able to configure my own environment that follows users’ preference, not something that a system offers for the users to fit into.

I though linux is perfect for that,  although after some time of struggling to install, and having a scary moment that I needed  to ‘open up’ my laptop, and now all my three old and new apple computers have both osx and linux!!! yay!!

Alright. so I would like to briefly talk about how I installed it, and what, and of course, everyone can find this from ubuntu forum with better detailed explanations. I deeply admire those people who give this document to everyone.

 Macbook pro 4,1 -> Ubuntu 11.10

For the Macbook pro 4,1; I installed Ubuntu 11.10 Oneiric Ocelot (http://cdimage.ubuntu.com/releases/11.10/release/) . Well, before I found this ‘mac’ specified version, I installed like… 5 different versions, and threw away all cds and dvds that I experimented.

So for you, this will be helpful. I downloaded ubuntu-11.10-desktop-amd64+mac.iso .

My CD room of the computer is broken. But i was able to install it with my usb stick. The thing is that Ubuntu forum explains how to install with USB. But somehow it was not working (failing to boot from there properly.) After a while of googling, I found this application for window. (yeah. I also have a window installed with VMware, this is just to do ‘online banking’ from Korean banks…!!)

This progam is called UFDISK. (download : http://goo.gl/UYitG)

You put your usb stick into the port, and run this. (backup all your files before) then you push ‘Auto run’ . Select your iso file, and run it. Then done!!

Then you need to install ‘ReFit’ (http://refit.sourceforge.net/)

After install, open the terminal and type

sudo sh /efi/refit/enable-always.sh

then you will see this when you boot,

you can select your usb to boot it.

Some remarks on Refit

When you first put your usb (or cd) and run REFit, you will see the login window that you can choose from where to boot. Before you choose, at the bottom part, there are some menus like shell script.. I don’t remember by heart right now, and choose the second one, and run. This will make everything suitable to boot. Then ‘shut down’ once, and then on next boot, choose your booting harddrive.

Make sure you are connected to internet (ethernet connection), and for more help, http://www.ubuntubuzz.com/2011/10/ubuntu-1110-in-macbook-pro.html

 Macbook pro 8,2 -> Ubuntu 11.04

here, I needed to have both CD, and USB in order to boot properly. Go here http://cdimage.ubuntu.com/releases/11.04/release/ download ubuntu-11.04-desktop-amd64+mac.iso

For the procedure for usb, please look up, and for burning CD, just to burn with DiskUtility on osx. (I have ‘lion’ installed)

Also you need REFit. (also look up for the explanation and download) On lion, I had a hard time for this to run. After few times of reinstalling, it was just working. I cannot explain what it was.. but it works!

Alright. Then put usb and CD together. when Refit login window, you will only see two linux install. Choose the first one, and run the install.

Make sure you check this site : https://help.ubuntu.com/community/MacBookPro8-1/Natty for more help and additional install.

 

Some remarks :

For ubuntu 11.10, I made two partitions for ubuntu, one as root(/), and one as /home. (except for swap disk) this was working fine. But on ubuntu 11.04, this was not working. (trouble on booting with Refit.) so do not make seperate partitions for your ubuntu. just make one, (again, except for swap disk)

 

Hope this helps. well, I had a hard time figuring out all. I might have missed some important part that I was struggling. Then I will update later on.

Now I have Ubuntu working with ‘awesome’ window manager. Good bye mouse!

 

**28.02.2012 updated:

If you have an issue with rEFit regarding OSX security setting, check this page. It will guide you the way.

http://sourceforge.net/tracker/?func=detail&aid=3488641&group_id=161917&atid=821764