Arch Linux on a Black MacBook2,1

rikerjoe

Tinkerer
Oct 31, 2021
146
220
43
I recently restored a Black MacBook2,1 Mid 2007 sporting a 2.16 GHz Intel Core 2 Duo chip. Back in the day, this is the MacBook I really wanted, but since I had a White MacBook1,1 from 2006, I didn’t satisfy my urges back then. Now, I have a near mint condition Black MacBook that I painstakingly restored to its former glory. The latest version of Mac OS X that can run on it natively is 10.7 Lion. It is possible to install 10.8 - 10.11 via hacks such as NexPostFacto, but in today’s world that does not offer much in the way of expanded usability. I wanted to surf the modern web and do as many modern things on it that I can. It’s a real beauty.

Therefore, I decided to take the plunge and install Linux on it. Moreover, I wanted to be able to dual-boot into Mac OS X and Linux. I chose Arch Linux as a good option. Although I have a unix-y background in my past, it has been since the mid-1990’s that I installed Linux on anything. Back then, I installed Red Hat Linux on an IBM Thinkpad flown on a NASA Space Shuttle mission so that the astronauts could run the exact same monitoring software we were using in Mission Control for that mission (a story for another time). Therefore, I was coming into this with some basic but rusty Linux installation skills.

First, I prepared the MacBook by using Disk Utility before the Lion install to set up a 50 GB partition for Lion and the rest set aside for the Linux install on a 250 GB SSD I put into the MacBook during the restoration.

Next, I grabbed a copy of an Arch Linux installation ISO on my modern Mac that I grabbed from here: https://archlinux.org/download/. The latest version I got was archlinux-2023.02.01-x86_64.iso.

I then copied the download to a USB stick on my modern Mac.

Googling around I found instructions for installing Arch Linux on a MacBook for dual booting with Mac OS X.

https://ianmcdowell.net/projects/macbook-arch/
http://codylittlewood.com/arch-linux-on-macbook-pro-installation/
https://medium.com/@philpl/arch-linux-running-on-my-macbook-2ea525ebefe3#.ai90cnihe

I booted up the USB stick on the MacBook and mainly followed the first guide. I set up the following partitioning scheme using cgdisk, where I didn’t touch the first three partitions, deleted the empty fourth partition I had set aside using Disk Utility, and created a 500 MB fourth partition to hold the Arch Linux boot information and devoted the remaining space to a fifth partition for the Arch Linux install:

/dev/sda1 200M EFI System - contains Apple boot information from Lion install
/dev/sda2 46G Apple HFS/HFS+ - contains Mac OS X Lion
/dev/sda3 620M Apple boot - contains Recovery disk installed by Lion
/dev/sda4 500M EFI System - target for Arch Linux boot information
/dev/sda5 191G Linux filesystem - target for Arch Linux install


I followed the first guide to install Arch Linux on the fifth partition, then followed the “setting up the bootloader” instructions in the first guide on the fourth partition.

However, when it came time to boot from the copy installed on my internal drive, the system wouldn’t boot into Linux. I could still boot from the USB, and booting into Mac OS X Lion worked fine.

I found a post that talked about the same problem on a MacBook4,1. The hint in the post that set me on the track for a solution has to do with the EFI implementation on the early Intel MacBooks: pre-2008 Macs mostly have 32-bit EFI firmware while 2008 and later Macs have mostly 64-bit EFI. All the guides I followed assumed the EFI was 64 bit.

To find out whether the EFI firmware in a Mac is 32-bit or 64-bit, this Arch Linux wiki page said to type following into the Mac OS X terminal:

$ ioreg -l -p IODeviceTree | grep firmware-abi

If the command returns EFI32 then it is IA32 (32-bit) EFI firmware. If it returns EFI64 then it is x86_64 EFI firmware.

MacBook2,1 returned IA32. Suspicion confirmed - I was installing a 64-bit EFI where I needed to be installing a 32-bit EFI. This meant I needed to modify the bootloader installation instructions in the first guide to use i386-efi wherever x86_64 appeared. Through some trial and error, I used the following three commands to install and configure the bootloader:

$ grub-install --target=i386-efi --efi-directory=/boot --bootloader-id=GRUB
$ grub-mkconfig -o /boot/grub/grub.cfg
$ grub-mkstandalone -o /boot/System/Library/CoreServices/boot.efi -d /usr/lib/grub/i386-efi -O i386-efi /boot/grub/grub.cfg

I rebooted the MacBook, held down the Option key, selected the EFI Boot disk in the boot options, and BAM - I was greeted with Arch Linux booting from the install on the MacBook.

There may be a better way to handle the bootloader, but at least the above is what I got to work. If anyone has any suggestions on how to make this better, I welcome the feedback.

I immediately installed GNOME as a desktop and started playing around. It was nice to surf the modern web on the MacBook, which is near impossible under Mac OS X Lion. I’m looking forward to more playing around with the Black MacBook2,1, perhaps even untethered at the local coffee shop. It should be an attention-getter.



IMG_1389.jpeg
 

speakers

Tinkerer
Nov 5, 2021
98
76
18
San Jose, CA
peak-weber.net
Many thanks for salvaging a BlackBook. One gave me many years of faithful service .. yet I had the foolishness to send it to the recycler after I moved on to a supreme MacBook Air.

A curiosity of this machine is that despite its 32-bit EFI, it has a 64-bit processor and, despite defaulting to the 32-bit kernel, it was capable of running the 64-bit kernel. All built-in device drivers were 64-bit-capable. Of course, you don't gain much by running the x86_64 kernel -- but doing so is to visit a very obscure corner of Apple's 64-bit transition! Boot with the "6" and "4" snag-keys held down or google for other incantations.

[I wrote the majority of the assembly code in the Darwin kernel to do this stuff.]
 
  • Like
Reactions: rikerjoe

Arbystpossum

Tinkerer
Jan 8, 2024
46
27
18
USA
I was given a 2.4Ghz 2008 Black MacBook several years ago. All it needed was a new battery. I got one of those black OWC batteries that was DOA, they were super cool and gave me a new one. Playing with it for a while, I'm amazed at what these things are still capable of, though I have 10.6 triple booting with Linux and Windows XP
 
  • Like
Reactions: rikerjoe

speakers

Tinkerer
Nov 5, 2021
98
76
18
San Jose, CA
peak-weber.net
I've been longing to replace the MacBook4,1 that I'd foolishly recycled years ago, so I acquired a cheap, semi-functional unit and restored it. It needed only a hard-drive, a new battery and a RAM upgrade to 4GB. It's a bit more battered than my original pristine machine .. but its perfectly functional.

I used a spare 160GB laptop harddrive which I partitioned as 2 equal parts and installed Snow Leopard on the first partition (yes, I know later releases run but I have a soft spot for 10.6). I installed from USB thumbdrive after dd'ing a 10.6.3 dmg to it. I updated to 10.6.8 but then back-revved boot.efi to 10.6.1 so I could patch it (see: https://web.archive.org/web/2010112...our-machine-good-enough-for-snow-leopard-k64/) to permit booting the 64-bit kernel. There's no real point in doing this except that you can.

On the second half of the drive, I installed Linux. I chose the latest version of Lubuntu since I'd not heard of it previously although I'm familiar with Ubuntu. Again, I dd'ed an ISO (Jammy Jellyfish, lubuntu-22.04.4-desktop-amd64.iso) of the live/install DVD to a USB thumbdrive and option-booted on to that. I chose for simplicity to use the entire sound partition as the ext4 root. The installation was easy and Lubuntu option-booted and ran well. To use Airport wifi you then need to install the Broadcom drivers - firmware-b43-installer package - and of course you have to use wired ethernet to do that. But after another reboot Airport comes up fine.

At this point I wanted to install a raft of handy Linux packages. I first installed openssh-server. Then I installed more packages from the command line over ssh from a remote modern Mac .. but installations stalled. After much poking around, it turned out that DNS was silently and randomly failing. Oddly, the package manager was interpreting this a temporary metwork glitch and was repeatedly retrying rather than erroring out! DNS recovered after a reboot but would drop off aagin at random. It appears that nameservice has been going through systemd rework and it's unreliable (https://mvysny.github.io/linux-dns/). Anynow, a full Lubuntu update seems to fix this issue.

I haven't install a boot manager but simply use option-boot and/or the Linux efiboootmgr command. Works well enough though.

The Lubuntu desktop is LXQt is certainly an appropriately lightweight UI for a laptop and it runs nicely on the MacBook. The trackpad can even be configured with mac-friendly natural scrolling and tap-to-click. But I could not get it work with a VNC server to be able to VNC into Linux from a Mac. I installed the tightvncserver but that only seems to work with the Xcfe4 desktop. Argh - needing 2 desktops installed is clumsy and confused.

Anyhow, another Blackbook brought back to both retro and modern life.