Linux on Macbook: Black screen on boot

Now it happened the second time: After a Ubuntu Linux system crash I had to reboot my Macbook Air and, instead of seeing GRUB, a black screen with a lonely blinking cursor illuminated my face. The mac did not boot Ubuntu anymore - rEFIt still worked, but loading grub completely failed.

I tried booting with the official boot loader (holding alt/option during boot) and selecting the (wrongly labeled) "windows" installation there, re-installing rEFIt, re-blessing the linux boot partition and re-setting the boot partition bootable in MBR - nothing helped. The cursor flashed and flashed for minutes, not doing anything.

In the end, I had to reinstall GRUB to make my linux partition bootable again.

Rescue boot

The beginning of the procedure was the same as the installation process:

  1. Use UNetbootin to put the Ubuntu 64bit Mac CD ISO onto an USB stick
  2. On OSX, copy that onto the 4th partition (my linux boot partition that somehow got damaged):

    $ sudo dd if=/dev/disk2s1 of=/dev/disk1s4 bs=1m
  3. Reboot from that partition into live cd mode

Now when that's done, GRUB needs to be re-installed. We need to chroot into the old system to do that, but before we have to make the partition writable. Since we booted from it, we cannot change it by default, but since we have enough RAM it's easy:

$ sudo bash
$ cp -r /cdrom /cdrom2
$ umount -lfr /cdrom
$ rmdir /cdrom
$ mv /cdrom2 /cdrom

Now chroot into the old system:

$ sudo bash
$ mount /dev/sda5 /mnt
$ mount -o bind /proc /mnt/proc
$ mount -o bind /dev /mnt/dev
$ mount -o bind /dev/pts /mnt/dev/pts
$ mount -o bind /sys /mnt/sys
$ chroot /mnt /bin/bash

And finally reinstall GRUB:

$ sudo grub-install --force /dev/sda4

Shutdown the live cd and boot your mac. It will start the old Linux system now without problems.

Written by Christian Weiske.

Comments? Please send an e-mail.