0

Ok, I've read a few posts about that, but either the people who wrote had a dual-boot Windows/Ubuntu, or I didn't understand the solution in the end... Anyway I'm just too scared of doing something wrong at this level, so here is the situation:

What happened

I had an iMac with rEFIt installed and a dual boot with Ubuntu 12.04. I went on Mac, and decided to free some space for Ubuntu, so I just shrunk the Mac partition cutting off 30Gb at the end (free space), that's ALL, and all was well. At least that's what I thought..

What's the current situation

Now I can still boot on Mac, but when I try to boot on Ubuntu I get a error: unknown filesystem with the grub rescue> prompt. I followed what I read on the forum to boot on Ubuntu:

set root=(hd0,3)
set prefix=(hd0,3)/boot/grub
insmod normal
normal

and this works well, but it's not a long term solution. I heard about BootRepair, but I'm on Mac, and from what I've seen, all the options of this software are for MBR, not EFI...

My opinion

From what I understand I need to tell EFI where to "redirect the bootloader" when I select the linux option in the rEFIt menu. Can't I do that from OSx directly? Or is it just grub that's messed up? If I have to use a liveUSB, please explain me what to do as if I was dumb, I really don't want to mess things up more... :S

2
  • Ok, this might be a start: mennucc1.debian.net/macbook_linux_efi.html
    – Jonathan H
    Jun 16, 2013 at 23:36
  • Tried the steps in this link, here's what I got; new badge in rEFIt when booting, selecting it leads to grub menu, selecting option in this grub menu led either to a black screen or weird graphics depending on the insmod option in the load_video function in grub.cfg. Meanwhile, this broke the former linux badge in rEFIt, which now leads to a black screen with a blinking prompt, and no grub rescue anymore.
    – Jonathan H
    Jun 17, 2013 at 23:15

1 Answer 1

1

There are a number of possible solutions, but it's hard to say what will work best, since it's unclear how Linux is installed (BIOS mode or EFI mode), although my guess is you've got a BIOS-mode installation.

One possible quick fix is to run update-grub within Ubuntu. If successful, this will update the GRUB files, thus restoring it to proper functionality. If unsuccessful, though, this could make matters worse, possibly making it impossible to boot Linux in the way you're doing it now.

Another option is a bit more complex, and is more likely to work, but is still not without risks:

  1. In Linux, type df / and take note of the device filename associated with /. It's probably /dev/sda3, /dev/sda4, or some other numbered partition.
  2. In OS X, download and install rEFInd.
  3. In OS X, install the EFI filesystem driver for whatever filesystem you use on your Linux root (/) filesystem (or on /boot, if it's separate). rEFInd ships with drivers for ext2/3fs, ext4fs, and ReiserFS. You install a filesystem driver by copying it to the drivers or drivers_x64 subdirectory of the rEFInd installation directory (normally /EFI/refind).
  4. Reboot. rEFInd should appear.
  5. Highlight one of the vmlinuz-{version} options on the menu and hit F2 or Insert twice. This should open a simple line editor.
  6. Add ro root=/dev/sda3 to the options, changing /dev/sda3 to the partition you identified in the first step.
  7. Hit Enter. Linux should boot.
  8. Locate the mkrlconf.sh script that came with rEFInd and run it. This should create a file called /boot/refind_linux.conf, which will obviate the need to add kernel options (steps 5-6) when you boot Linux the next time; just hitting Enter should do the trick.

This procedure bypasses GRUB and is likely to be more robust than GRUB in the long term; however, some Macs don't work well when booted directly in EFI mode (as this solution does), so it's conceivable that it won't be an acceptable option for you. If so, you'll need to get a BIOS-mode version of GRUB (or some other boot loader) working. You may also need to clean up your boot menu. Consult the rEFInd documentation for refind.conf, paying particular attention to the dont_scan_dirs, dont_scan_files, and scanfor options, for details on how to do this. Deleting files (such as the refit.efi file) can also do the trick.

3
  • First of all, thank you so much for your help!! :) I'm going to try the steps you suggested (I think you're right for the BIOS mode for the Linux installation), but if it can be of any help, here is what happened since the OP:
    – Jonathan H
    Jun 17, 2013 at 23:17
  • I first tried to boot from a live CD, chroot into my Ubuntu partition, and run a grub-install with two options (root-directory and recheck I think); the command exited with an error saying something about "not GPT something" and that I could use "blocklists" instead but that they were unsafe.
    – Jonathan H
    Jun 17, 2013 at 23:18
  • Then I tried what was suggested in the link I posted as a comment of the OP. The result is the second comment. Then I booted again from a live CD, chrooted in my Ubuntu partition, purged grub-efi-amd64, cleanded the grub directory out of the EFI partition (/dev/sda1), and ran update-grub2. The result is that I deleted the "new" badge in rEFIt menu (normal), but the old one still leads to a black screen with blinking prompt. In short; I think I made things worse :/
    – Jonathan H
    Jun 17, 2013 at 23:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .