4

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?

6
  • One cause of this symptom that I've encountered is running 64-bit Xen on 32-bit hardware. Commented Aug 24, 2011 at 22:43
  • Actually it turns out it's to do with the grub2 config. This is fully 64bit hardware
    – hookenz
    Commented Aug 24, 2011 at 23:05
  • Does that mean you found a solution? If so, please do post it as an answer (so that others can benefit) and I'll upvote it. =) Commented Aug 24, 2011 at 23:07
  • No, I still can't get it to boot.
    – hookenz
    Commented Aug 24, 2011 at 23:08
  • When I install Xen on NetBSD, I do have the option of just booting my host OS without Xen (NetBSD 5 can natively boot into Xen without GRUB or GRUB2). Is GRUB2 not providing any other boot options? What parameters are you booting Xen with? Commented Aug 24, 2011 at 23:11

2 Answers 2

7

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.

1
  • 2
    +1 for sharing the solution to this problem with technical details as this may be helpful to others. Commented Aug 25, 2011 at 15:43
0

In order for grub2-mkconfig to detect your Linux kernel(s), they must be named vmlinuz-* or kernel-*. In some scripts you can see vmlinux-* too. For example (...-xen at the end is just my note):

/boot/kernel-3.6.2-xen

In order for 20_linux_xen script to include your Xen kernel, /boot must contain kernel config file with exact name config-* corresponding to your kernel file. For example:

/boot/config-3.6.2-xen

To make this file simply run zcat /proc/config.gz > /boot/config-[your_version], and you should run grub2-mkconfig again. At this moment script will probably generate duplicate records for Xen kernel, because (probably) you have a couple of symlinks to xen kernel. So remove them and leave only original file (xen-4.2.0.gz). (I hope this is safe, if removing of these symlinks is wrong, please keep your comment below.)

Same situation is with initrd/initramfs files, but a lot of variations.

Adding kernel parameters has been described here.

sources: kernel naming, 20_linux_xen:147, 10_linux:194-201

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .