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've got Ubuntu 12.04.1 running as a Virtualbox on Windows 7. Ubuntu crashed (it claimed the host had too little memory, but this seems a bit odd as I have 6 Gb of ram and was only giving Ubuntu 2 Gb), so I restarted Ubuntu. However, when I did this, I got the following error:

error: ELF header smaller than expected
grub rescue>

I initially tried the solution provided at http://ubuntuforums.org/showthread.php?t=1599293 - but couldn't find the location of the iso in Step 4 (presumably because it's a VirtualBox anyway?)

When I boot from the iso, I don't get an option to repair, only boot from CD or install from scratch.

Is there a way to either:

  • boot Ubuntu from the iso and then repair the appropriate files by mounting the harddrive

or

  • install a fresh version of Ubuntu, and mount my 'old' harddrive to it so that I can recover the files

Is either option possible / better than the other one?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

http://opensource-sidh.blogspot.co.uk/2011/06/recover-grub-live-ubuntu-cd.html works perfectly, with very clear instructions!

share|improve this answer
    
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  Peachy Oct 3 '12 at 7:52
add comment

Ensure that the ISO is mounted on the VM; if it is, then it should appear in the results when you do 'ls' at the grub rescue prompt, and you should be able to continue with step 4 as normal.

That said, it may be simpler just to rebuild the VM from a fresh Ubuntu install, and recover your files from there. If you go that route, I'd suggest cloning a safe copy the new VM as soon as you've finished the stock Ubuntu install, or else right before you recover your data; that way, if the VM crashes and dies again, you can just clone the safe copy and start from there, rather than having to rebuild from scratch again.

share|improve this answer
    
Hmm, the bad news is that I have mounted the iso, and it still doesn't appear anywhere logical (I've tried all the folders that appear in ls (hd0,msdos1)/ –  ChrisW Oct 2 '12 at 10:06
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.