Ubuntu VM not starting on XenServer after kernel upgrade

A few weeks ago I explained how to get Ubuntu 12.04 LTS running on Citrix XenServer 5.6.

Today, after upgrading the VM’s kernel from 3.2.0-24-virtual to 3.2.0-25-virtual, the VM didn’t start anymore. XenCenter showed the following error message:

16.06.2012 10:49:55 Error: Starting VM 'Heiner' - Using <class 'grub.GrubConf.Grub2ConfigFile'> to parse /grub/grub.cfg - WARNING:root:Unknown directive load_video - WARNING:root:Unknown directive terminal_output - WARNING:root:Unknown directive else - WARNING:root:Unknown directive else - WARNING:root:Unknown directive else - WARNING:root:Unknown directive else - WARNING:root:Unknown directive else - WARNING:root:Unknown directive export - WARNING:root:Unknown image directive recordfail - WARNING:root:Unknown image directive gfxmode - WARNING:root:Unknown image directive recordfail - WARNING:root:Unknown directive submenu - WARNING:root:Unknown image directive recordfail - WARNING:root:Unknown image directive gfxmode - WARNING:root:Unknown image directive recordfail - Traceback (most recent call last): - File "/usr/bin/pygrub", line 746, in ? - raise RuntimeError, "Unable to find partition containing kernel" - RuntimeError: Unable to find partition containing kernel


As it turned out, although I selected to remove the no longer required old kernel in aptitude, the corresponding entries remained in grub.cfg and hindered the VM to boot up.

To fix it, I logged into the XenServer console and ran the following command:

xe-edit-bootloader -n your_vm_name -p 1

Replace your_vm_name with, well, your VM’s name. The -p parameter’s value can vary, try 0 if 1 doesn’t work.

Now, look out for a “submenus” section that contains references to the old kernel version. It should look like:

submenu "Previous Linux versions" { ... }

Comment out the whole submenu section.

After I did that, my VM booted up smoothly again.

21 thoughts on “Ubuntu VM not starting on XenServer after kernel upgrade”

  1. I Ran the command xe-edit-bootloader -n your_vm_name -p 1 but in my case no joy

    [[email protected] /]# xe-edit-bootloader -n 3.17zimbra.meritool.com -p 1 -f /grub/grub.cfg
    Creating dom0 VBD: c53d70c9-cd58-bb65-cc8f-f1cdf355ad03
    Plugging VBD:
    Waiting for /dev/xvda1: .. done
    Mounting filesystem: done
    Unable to find a valid bootloader config file in:
    /grub/grub.cfg
    Please specify one with the -f option
    Unplugging VBD: . done
    [[email protected] /]# xe-edit-bootloader -n 3.17zimbra.meritool.com -p 0 -f /grub/grub.cfg
    Creating dom0 VBD: e5e8bd66-5912-ba15-95f6-dced901fb10e
    Plugging VBD:
    Waiting for /dev/xvda0: …..Device /dev/xvda0 not found.
    You must specify the correct partition number with -p
    Unplugging VBD: . done

    how do we edit the submenu's section?

  2. Thank you! My Ubuntu 12.04 is working again.
    Some idea to avoid this problem? It sounds like a problem on kernel updating

  3. yes, this is a problem with kernel updates.
    I have found that you can update the kernel location (from xen shell) with
    xe vm-param-set uuid= PV-bootloader-args="–kernel=/vmlinuz-3.2.0-25-virtual –ramdisk=/initrd.img-3.2.0-25-virtual"

    and you MAY also need
    xe vm-param-set uuid= PV-args="root=UUID= ro quiet"

    1. Thanks!

      I am running an XCP on Ubuntu 12.04 (Kronos) and encountered this problem. Due to many bugs, xe-edit-bootloader is not working properly, so your solution helped me to get the virtual machine up and running 🙂

      To clarify a little bit more, the first command (xe vm-param-set uuid="uuid-of-the-vm-here" PV-bootloader-args="–kernel=/vmlinuz-3.2.0-49-generic –ramdisk=/initrd.img-3.2.0-49-generic") is bringing you in a busybox shell.

      Use this shell to get the UUID of the root hard disk. and then run the second command: xe vm-param-set uuid="uuid-of-the-vm-here" PV-args="root=UUID=uuid-of-hard-disk ro"

      You can find the uuid like this:
      # ls -la /dev/disk/by-uuid/
      total 0
      drwxr-xr-x 2 root root 100 Jul 5 16:31 .
      drwxr-xr-x 5 root root 100 Jul 5 16:31 ..
      lrwxrwxrwx 1 root root 10 Jul 5 16:31 0340e537-8e19-444b-9983-f9c6fd471e52 -> ../../dm-0
      lrwxrwxrwx 1 root root 11 Jul 5 16:31 2c2bfdf6-80e8-4323-a5bb-c128cedf4ed5 -> ../../xvda1
      lrwxrwxrwx 1 root root 10 Jul 5 16:31 99550193-13e9-4335-81c0-f94cbf1a4bf5 -> ../../dm-1

      In my case, dm-0 is the root so my second command looked like this: xe vm-param-set uuid="uuid-of-the-vm-here" PV-args="root=UUID=0340e537-8e19-444b-9983-f9c6fd471e52 ro"

  4. I was able to edit the file and commented the whole submenu section, still same problem. XS6.0 and upgraded Ubuntu from 10.04 to 12.04

    Thanks

  5. Had the same problem, actually this seems to happen with only some kernel updates but not all?

    Anyway, I found out that what happens is that it adds an extra closing } to the Previous-Linux-versions-section, it's enough to just delete it and you're fine.

    1. Thanks to Dan.

      This worked for me. Saved me hours.

      There is a 2 lines with
      }
      }

      obviously a syntax error. Wish there was a syntax checker that checks BEFORE the reboot/install.

      I had to boot from a Linux rescue disk, mount the partition and take one line out.

  6. Thank you very much, it worked.

    Everyone please note that you have to comment the *whole* section. In my case it started at the submenu line and finished at end of file.

  7. I have the same problem using Xen4.4 where an update has stopped a VM booting with the same error. Is there an alternative to xe-edit-bootloader to allow me to edit grub.cfg? I use xl as xe is not installed.

Leave a Reply

Your email address will not be published. Required fields are marked *