[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

grub error after kernel upgrade: invalid arch independent elf-magic



Greetings everyone,

today I ran into a weird problem I can't get my head around.
I run a debian 8 jessie server which was last updated around 4 weeks
ago. I did an apt-get update/upgrade today which only involved
around 20 packages, one of which was an update to the
linux-image-3.16.0-4-amd64 package.

The server has a 2009 asus mainboard which is not uefi capable. It is
booted via a 120MB bios_grub type gpt partition and the system resides
on the following 2TB ext4 partition.

Rebooting after the upgrade led to grub immediately reporting:
error: invalid arch independent ELF magic.
grub rescue>

I then tried to use the rescue prompt to get the system to boot
manually. I set the root to (hd0,gpt2) and was able to use ls to
navigate to the grub folder. Upon issuing an
insmod linux
grub immediately responded with:
error: invalid arch independent ELF magic.
I get the same error if I for example try to insmod configfile or a
couple other modules. the modules gzio, part_gpt and ext2 work fine!

I then proceeded to boot a grml rescue image from a usb stick and after
mounting the root filesystem and taking care of the sys,dev,proc
folders I chrooted into the mounted root filesystem and did a:
grub-install /dev/sda

The grub installation went fine, no errors and after a reboot I did get
back the grub boot menu.
However trying to boot the first entry which contains the 3.16 kernel
image grub responds with:
error: invalid magic number.
Loading initial ramdisk...
error: you need to lead the kernel first

If I try to boot the old 3.2 kernel which I still had on that root
filesystem instead I can boot the system just fine. 

I can repeat this behaviour as many times as I want. Doing a
grub-install from my booted system leads to the invalid arch message
and no way to boot anything. Booting a rescue disk and doing another
grub-install gets my system back to the grub menu and I can at least
boot the old 3.2 kernel. rinse repeat.

After spending more than 10 hours so far on the issue I still don't
know what exactly is causing this behaviour. It can't really be an
uefi issue as this mainboard is not uefi capable. It has been
running fine in legacy gpt mode since 2009.

Also I am usure as to what the arch independent elf-magic error message
means. And is that the same "magic" as the "invalid magic number"
message I can achieve the other way?

So, help me please, since I am running out of things to try.

Best regards
Alexander M. Heuer

Attachment: signature.asc
Description: PGP signature


Reply to: