[SOLVED] grub: invalid magic number

Alessandro 123

Well-Known Member
May 22, 2016
653
24
58
40
Hi to all.
I'm moving a lot of VMs from XenServer to Proxmox. I did this more or less 90-100 times before with my conversion script, every time worked properly EXCEPT for 1 VM.

On the machine i'll add virtio_pci and virtio_blk modules to initramfs , then I install grub (if not already installed) and then export the machine from XS to PVE.
99% of the times, it works but this time grub is unable to load the kernel, i'm getting:

"you need to load the kernel first"

then if i go to grub rescue console, trying to manually load the kernel (grub is able to see all files with the native "ls" command) i'm getting:

error: invalid magic number.

Any idea ?
 
* Please post the VMs config (/etc/pve/qemu-server/VMID.conf)
* which OS is the guest running?
* what's the disk-layout of the boot-disk of the guest? (`lsblk`, `blkid`)
* any specifics in the grub.cfg?
 
* Please post the VMs config (/etc/pve/qemu-server/VMID.conf)
Code:
agent: 1
boot: cdn
bootdisk: virtio0
cores: 1
ide2: none,media=cdrom
memory: 512
name: xxxxxxxxxxxxxxxxxxxx
net0: virtio=0E:B1:42:0B:E9:A8,bridge=vmbr0,firewall=1
net1: virtio=0E:18:AB:4C:65:0D,bridge=vmbr1
numa: 0
ostype: l26
scsihw: virtio-scsi-pci
serial0: socket
smbios1: uuid=9c097ac9-c6bc-4aa6-9764-0ddc16ccf7f5
sockets: 1
virtio0: local-zfs:vm-118-disk-1,cache=writeback,size=4G
virtio1: local-zfs:vm-118-disk-2,cache=writeback,size=512M

* which OS is the guest running?
Debian 5

* what's the disk-layout of the boot-disk of the guest? (`lsblk`, `blkid`)
Code:
# blkid
/dev/xvdd: LABEL="CDROM" TYPE="iso9660"
/dev/xvdb1: UUID="76e21700-acce-4fa8-b799-251d764bef9b" TYPE="swap"
/dev/xvda1: UUID="3765189f-fdaf-48d4-a04b-d696e6cffdbd" TYPE="ext3"
* any specifics in the grub.cfg?
Code:
menuentry "Debian GNU/Linux, linux 2.6.26-2-xen-686" {
    set root=(hd0,1)
    search --fs-uuid --set 3765189f-fdaf-48d4-a04b-d696e6cffdbd
    linux    /boot/vmlinuz-2.6.26-2-xen-686 root=UUID=3765189f-fdaf-48d4-a04b-d696e6cffdbd ro console=ttyS0,115200 console=tty1 vga=792
    initrd    /boot/initrd.img-2.6.26-2-xen-686
}
 
hm - quite an old debian..

You could try to import the machine - boot it from an i686/32-bit debian live-cd, mount the disks (which would be called /dev/vda1, /dev/vdb,...), chroot into the system and run: update-grub

EDIT: do so on a copy of the machine (or have a working backup in place)

I hope this helps
 
hm - quite an old debian..

You could try to import the machine - boot it from an i686/32-bit debian live-cd, mount the disks (which would be called /dev/vda1, /dev/vdb,...), chroot into the system and run: update-grub

EDIT: do so on a copy of the machine (or have a working backup in place)

I hope this helps
I could try, but grub is already loaded and working. What's not working is the kernel. Grub is unable to load the kernel, but is able too see it ("ls" from grub rescue console, show all files)
 
never had experience with xen - but maybe you need to install the regular kernel image on debian 5? (not the one meant to run as DomU)?
Already done. (the kernel is compatible). As wrote, i did this procedure hundreds of time. This is the only one that doesn't work
 
Anyway, i'm trying with a standard 686 kernel image. let's see... maybe the xen kernel on lenny is not compatbile
 
Odd ..
my guest would be that the xen-kernel in debian 5 had some options set which are not compatible with running in a (rather new) qemu.

do you have other VMs running debian 5?

But in any case glad that worked! - please mark the thread as 'SOLVED'
 
Yes, I have another debian 5 VM , moved right now, in the same exact way, after installing linux-image-686-bigmem. Worked flawlessly at the first time
 
  • Like
Reactions: Stoiko Ivanov

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!