So, for various reasons I wanted to install the wonderfull Elementary OS on an old MacBook Air (13″ ultimo 2010, 2.13 GHz Intel Core 2Duo) I had lying around. Mostly because, why not? but also because I really like Elementary OS. Quickly I ran into what must be a very common problem, namely that after succesful installation, one is rewarded with a completely black screen. No signs of life, not even during booting. However, my MacBook Air did in fact boot and did even sign onto my wifi – my router’s web interface revealed the IP address the MacBook had been assigned, and I could ping that address. So the issue was clearly related to the video driver, but also hard to fix, since, well – no screen. This is probably keeping some from repurposing old Macs, which I think is a great thing to do.
Initially I found this answer: https://elementaryos.stackexchange.com/questions/17007/first-install-on-a-macbook-air-black-screen , which turned out to be mostly a wild goose chase for my particular problem. The problem, it turns out, is that when EFI-booting a Mac, some PCI-settings are not set, and this messes with the Nvidia driver. To fix this, these settings apparently must be set before the driver is loaded for the first time, and since the first time is probably when the compressed ram disk is loaded (initrd.img), the PCI settings must be set even before this. One suggested solution I found was to change these settings by having Grub run a script (placed in /etc/grub.d) during the boot process:
https://askubuntu.com/questions/264247/proprietary-nvidia-drivers-with-efi-on-mac-to-prevent-overheating/613573#613573
This also turned out to be a wild goose chase for my case – my guess would be, that even the Grub scripts are run to late in the boot sequence, i.e. after drivers are loaded. The linked article did however show me how to locate the settings that should be set.
In short, it seemed that I needed to change the PCI settings even earlier by e.g. having the an EFI boot manager run a script. That is exactly what this guy over at the Archlinux forum did, and it turned out to work for me as well.
Below are the steps that worked for me.
The easiest way is to download the ISO, burn it to a USB stick using Balena Etcher, then simply boot from it and install Refind.
For this simply boot from the USB-stick you used to install Elementary OS from, but instead of installing choose to “try out” the OS. For some reason this works just fine (I assume that the demo does not load Nvidia drivers).
Now fire up a terminal, and type:mount /dev/sda2 /mnt
This of course assumes that you installed Elemantary OS to the second partition on your drive, which is typically the case, since the first is used for EFI. Now type:sudo chroot /mnt apt update
sudo chroot /mnt apt install ssh
To disable the graphical UI, type:sudo systemctl disable lightdm
Now reboot and wait a little. In whatever way suits you, find out the IP address your Macbook has been assigned, and ssh into it.
Download them from Nvidia, or download a slightly patched version here as suggested here. Run the installer, but choose not to use DKMS – this did not work for me. Assuming you have ssh’ed into your MacBook, type:wget https://www.nvidia.com/content/DriverDownload-March2009/confirmation.php?url=/XFree86/Linux-x86_64/340.108/NVIDIA-Linux-x86_64-340.108.run&lang=us&type=TITAN
chmod 775 NVIDIA-Linux-x86_64-340.108.run
sudo ./NVIDIA-Linux-x86_64-340.108.run
Type:wget https://github.com/tianocore/edk2/blob/UDK2018/EdkShellBinPkg/FullShell/X64/Shell_Full.efi
sudo mv Shell_Full.efi /boot/efi/EFI/refind
First find the two relevant PCI registers by typing:sudo lshw -businfo -class bridge -class display
and note the two PCI addresses in the last two lines, which should be the PCI Express Bridge and the GPU. Mine were: 00:17.0 and 02:00.0.
Now create a text file in /boot/efi/startup.nsh
with this content:mm 02000004 1 ;PCI :7
mm 0017003E 1 ;PCI :8
fs1:\linux.efi root=/dev/sda2 rw initrd=/initrd.img
Where you replace the PCI addresses and the root with your own info, which should be very similar.
And because EFI apparently only loads things that end in .efi, type:ln -s /vmlinuz /linux.efi
Add the lines below to the text file located at /boot/efi/EFI/refind/refind.conf
:menuentry "Elementary" {
icon /EFI/refind/icons/os_elementary.png
loader /EFI/refind/Shell_Full.efi
options "fs0:\startup.nsh"
}
To reenable lightdm, type:dpkg-reconfigure lightdm
Now reboot and enjoy Elementary OS 🙂 Drop a comment if you run into problems.
Update / note-to-self:
apt install lightdm-gtk-greeter
apt remove gnome-screensaver
echo “greeter-session=io.elementary.greeter” >> /etc/lightdm/lightdm.conf
llightdm –show-config