Linux – Installing bootloader on a Mac

bootgrub2linuxmac

Due to a somewhat odd requirement for a particular Linux installation, with a particular software suite, I found it best to use ddrescue to populate the harddrive with the partitions and their data, taken from a similar setup made a while back. This, of course, after setting up the partition table accordingly. After double-checking everything, the hard drive now has the correct data (including the OS) on the correct partitions.

However, how do I go about setting up a bootloader? I've tried the usual trick of booting from an external USB and running grub-install /dev/sda, but the issue now is that when I boot the machine without the USB grub starts to complain: "error: no such device: 47f89855-8710-4fca-a395-913f70f7d94c".

I'm presuming that the device GRUB is missing is the USB stick I used to boot from when installing. I tried to work around it by doing a chroot to the machine's filesystem first, but the result seems to be the same.

System info:

  • MacBook Air 13"
  • One 128GB drive

    • partition 1: 512MB of spare space, in case I need it (See note regarding EFI boot)
    • partition 2: 2.5GB root filesystem of the OS I want to boot (Scientific Linux 6.6). This partition also holds a /boot directory.
    • partition 3: 2G Swap space
    • partition 4: rest of the disk, to be mounted by the OS
  • External boot device: A USB stick running Arch Linux (to be removed once everything works, of course)

It is worth noting that I am not a Mac person at all, so I've had to rely on my PC based experience, hoping that I was able to overcome any hardware related differences. Based on various googling, I see a lot of references to EFI boots, and I am new to that as well. So my question then is: Do I need to set up an EFI boot? (That's the only way I'm able to boot from the USB stick, at least).

Any help on how to somehow get the OS on the drive booted would be much appreciated. Leave a comment if more info is needed.

Note:
When booted from my USB stick, the drive I want to boot from shows up as /dev/sdc, and the USB stick as /dev/sdb. As I've been unable to boot without the stick, I can only presume that the drive of interest will remain /dev/sdc.
When connecting a second USB storage device, it comes up as /dev/sdd

Best Answer

  • Boot with usb-stick and check your grub.conf. Find the line with root=uuid= and se if it's set to root=UUID=47f89855-8710-4fca-a395-913f70f7d94c.

    If so, you need to change it to the your primary boot partitions uuid. ls -l /dev/disk/by-uuid/ to find the right partition and copy the uuid.

    if it's root=/dev/sda or something. Change it to root=UUID=therightUUIDhere

    also check your /etc/fstab and replace /dev/sd{a,b,c,d} to UUID=blabla-blabla-blabla-blabla / ext4(if ext4) 0 1 or if it's referring to your USB's UUID, change it to your boot partitions UUID

    /dev/sda,sdb,sdc,sdd can change order depending what media is connected to the computer, or not connected. But if you use UUID's instead. You are refering to right partiton/filesystem all the time.

  • Related Question