How do I set up grub2 with Xen?

Matt H

I am booting a new Xen kernel and it all goes fine up until some point during the boot process when the machine reboots without warning. Unfortunately, I don't see errors flash up just before that happens.

Is there a way of booting the machine with a working kernel and looking at a log of the previous boot or something?

EDIT: What I didn't notice is that there is actually an error on the screen. It just flashes up very quickly before the reboot. The error is related to not being able to mount the root filesystem because there is something wrong with my grub configuration.

A normal entry in grub.cfg looks like this:

menuentry 'Ubuntu, with Linux 2.6.32-33-server' --class ubuntu --class gnu-linux --class gnu --class os {
        recordfail
        insmod ext2
        set root='(hd0,1)'
        search --no-floppy --fs-uuid --set 75475e50-82e2-4f74-b860-6cf92c91b42e
        linux   /vmlinuz-2.6.32-33-server root=/dev/mapper/xenserver-root ro   crashkernel=384M-2G:64M,2G-:128M 
        initrd  /initrd.img-2.6.32-33-server
}

I added the following in /etc/grub.d/40_default

menuentry 'Xen 4 with Linux 2.6.32.45-xen' --class ubuntu --class gnu-linux --class gnu --class os --class xen {
        recordfail
        insmod ext2
        set root='(hd0,1)'
        search --no-floppy --fs-uuid --set=root 75475e50-82e2-4f74-b860-6cf92c91b42e
        echo 'Loading Xen 4 ...'
        multiboot /xen.gz placeholder
        echo 'Loading Linux 2.6.32.45-xen ...'
        module  /vmlinuz-2.6.32.45-xen placeholder root=/dev/mapper/xenserver-root ro iommu=1
        echo 'Loading initial ramdisk ...'
        module  /initrd.img-2.6.32.45-xen
}

But it's not working for some reason. Any ideas?

EDIT: I also tried the 20_linux_xen script. Unfortunately that's not working. See these errors:

Found linux image: /boot/vmlinuz-2.6.32.45-xen
Found initrd image: /boot/initrd.img-2.6.32.45-xen
Found linux image: /boot/vmlinuz-2.6.32-33-server
Found initrd image: /boot/initrd.img-2.6.32-33-server
/etc/grub.d/20_linux_xen: 57: uses_abstraction: not found
Found linux image: /boot/vmlinuz-2.6.32.45-xen
Found initrd image: /boot/initrd.img-2.6.32.45-xen
/etc/grub.d/20_linux_xen: 156: gettext_printf: not found

gettext is installed.
I'm on ubuntu 10.04 LTS.

The error flashed up on boot is something like "please insert a correct root=boot kernel option..."

Why is this so hard and why are there so many different examples of grub2 xen? some put /boot in front some just /. I tried putting /boot in front but that didn't help. Also some have --set=root uuid and yet all my other working entries just have --set uuid. is this something to do with a different grub2 version?

Matt H

To answer my own question. This grub2 entry worked.

menuentry 'Xen 4 with Linux 2.6.32.45-xen' --class ubuntu --class gnu-linux --class gnu --class os --class xen {
        recordfail
        insmod ext2
        set root='(hd0,1)'
        search --no-floppy --fs-uuid --set 75475e50-82e2-4f74-b860-6cf92c91b42e
        multiboot /xen.gz placeholder
        module  /vmlinuz-2.6.32.45-xen placeholder root=/dev/mapper/xenserver-root ro 
        module  /initrd.img-2.6.32.45-xen
}

However, I also had a problem with the kernel. So I had to rebuild it. Once I did that it was all go.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related