Web lists-archives.com

"Invalid arch-independent ELF magic" in grub after SSD migration


I've just migrated my Debian testing/unstable install from a HDD to a SDD (too many custom configurations to go for a clean install). The hardware is a Dell Precision M4500 notebook.
The HDD is a Seagate 250GB 7200rpm, the SDD is a Samsung 250GB EVO 850. The total capacity matches exactly.

Here is how I copied the disk contents over the SDD.
I booted a live Ubuntu from CD media, checked with fdisk that every partition is starting 4K aligned and used the following command to copy the disk contents:

dd if=/dev/sda of=/dev/sdb status=progress bs=4K

Then I shut off the notebook, swapped disks and booted with the SDD. The result was:

error: invalid arch-independent ELF magic.
Entering rescue mode...
grub rescue>

I've tried suggestions from Google, e.g. live boot, install grub-efi-amd64, grub-install /dev/sda and so on. It worked once only, but I'm not even sure it was thanks to what I did. Please note that I have no EFI partition and the BIOS is configured for Legacy boot, not EFI.

I've also tried the advice here http://stackoverflow.com/questions/18120835/debian-grub-rescue-invalid-arch-independent-elf-magic (first reply, e.g. reinstall grub-pc) but it didn't work, I still get the same error.

Any clues?