Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am in a particular situation. I have a MacBook Pro with no internal CD drive and both MacOS X (minimal setup) and Linux (my main system) is installed. During a cross-upgrade to Ubuntu 12.04 I messed up grub, so that my /boot/grub directory is basically empty. This means I can't boot Linux on the laptop anymore but only get into grub rescue.

Normally this is no issue as you'd just boot from a rescue CD or USB stick, but unfortunately with a MacBook Pro this is not possible (I have reFIT installed and it attempts to boot, but it fails and the manual says that Apple's EFI firmware is not able to handle this situation).

From MacOS X, however, I still have write access to the Linux partition. I've now been trying to figure out how to populate the /boot/grub folder with the necessary files, to no avail so far. The ISO image of Ubuntu 12.04 contains an EFI folder which is not what I am looking for, instead I need the normal.mod files for the grub version of Ubuntu 12.04. I do not have any other machine to set up a virtual machine of Ubuntu 12.04 to extract this from after a grub-install, so I am asking for ideas here how to solve this mess.

P.S.: I installed the Linux previously when I still had a working internal CD drive. This is gone now.

share|improve this question
add comment

2 Answers

It would help to know what version of Grub you're running. Grub1 vs Grub2 actually has a large number of (often annoying) differences. The main relevant one here is whether you have a /boot/grub/menu.lst file (grub1) or /boot/grub/grub.cfg (grub2).

These are the files that control what you see in the Grub menu when you first turn on your computer. Under normal conditions you should not edit these manually since the update scripts handle that for you, but as you said that's not possible under this situation. So back up these files, then manually edit them for your appropriate kernel versions. If just fixing one of these files isn't enough (since as you said, /boot/grub is mostly empty), I would install the same version of ubuntu on another machine or drive, then copy over the contents. Hopefully the configs are similar enough that you would then be able to boot, but there is no guarantee that this will work.

Whatever you do, back up any files before you edit or replace them!

share|improve this answer
    
I am running the version that Ubuntu 12.04 has (grub2-1.99something). However the point is that I cannot install anything new on this machine and I do not have another. There is also no point fixing the grub.cfg as I am missing all other files (e.g. normal.mod). –  Jacky Jun 30 '12 at 22:16
    
I would suggest finding another system, because if you can't even boot this one from CD, USB, or disk, then you have to have something working to actually try and fix the problem. –  New sysadmin Jul 1 '12 at 0:37
add comment

If you have access to another machine with a working cd drive, you can make a bootable usb with some linux distro, like knoppix. Then you can boot the machine from the cd and fix grub.

share|improve this answer
    
Like I said, I can not boot from either USB or CD on this machine. –  Jacky Jun 30 '12 at 21:19
    
In that case, i think that even if you populate /boot/grub, you can't run linux to execute update-grub2, so probably grub will don't run. –  linux with a hammer Jun 30 '12 at 21:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.