Ubuntu – ELF header smaller than expected

dual-bootgrubrescuessd

I have a Dell XMP-13 Ultrabook (SSD drive only) with 12.04 installed dualboot with the original windows. It has been running flawlessly for many many months.

Today in the middle of a system update (kernel) I accidentally put it in suspend mode. Then it got frozen whenever I tried to boot.

I then booted in a previous ubuntu version and the partial upgrade dialog box appeared. I started it and the computer got frozen again.

Now it stops in the Dell logo screen with the message:

error: ELF header smaller than expected. 
grub rescue>_

I did some research and tried to find the linux images as suggested in this answer: Recovering moved .mod files using grubrescue

However I always get the error: no such partition. when trying to ls on the drives:

grub rescue>ls
(hd0) (hd0,gtp10) (hd0,gtp9) (hd0,gtp8) (hd0,gtp7) (hd0,gtp6) (hd0,gtp5) (hd0,gtp4) (hd0,gtp3) (hd0,gtp2) (hd0,gtp1)

grub rescue>ls (hd0,gtp1)
error: no such partition.

grub rescue>ls (hd0,gtp1)/boot
error: no such partition.

This is the same for all drive numbers with and without the "/boot"

Any idea of what should I try?

Best Answer

First of all: if you come across this error do not despair. Despite the horrendous appearance of the situation it seems that in most cases it is savable.

After some research and help from Julian Stirling in the comments of my question I got the problem resolved by using boot-repair.

I had to:

  1. Use my ubuntu desktop to create a bootable USB stick on Ubuntu

  2. Then in order to be able to boot from the USB I had to change the BIOS Boot Mode Setting to Legacy Boot Mode, Secure Boot Off change the BIOS boot mode Legacy Boot Mode, Secure Boot Off

  3. After booting from the USB I selected the Try Ubuntu

  4. connected to the internet (WiFi in my case)

  5. open a new Terminal, and installed boot-repair:

    sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update

  6. When the update finishes run boot-repair:

    sudo apt-get install -y boot-repair && (boot-repair &)

  7. Then I clicked the "Recommended repair" button. In this step I got a little worried when prompted to choose Yes or No to the message "The boot of your PC is in Legacy mode. You may want to retry after changing it to EFI mode.". It turns out I had to click Yes or the boot-repair would not run. After a little wait boot-repair did its magic and when it finished I took note of the URL as instructed.

  8. Finally I changed the BIOS Boot Mode Setting back to what it was before I started. Rebooted and boom! Everything was back to normal.

Related Question