Sometimes an Ubuntu VM doesn’t start up anymore on XenServer. The following error is shown in XenCenter:
Error: Starting VM 'My VM' - 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 elif - 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 850, in ? - raise RuntimeError, "Unable to find partition containing kernel" - RuntimeError: Unable to find partition containing kernel
The problem here is that the VM has performed a kernel upgrade and has changed the contents of the grub configuration file /boot/grub/grub.cfg. When the VM is started, XenServer tries to read this file and detects an error. We can fix this error with the following command on the console of the XenServer host:
export EDITOR=vi xe-edit-bootloader -n "My VM" -p 1
You must give the name of the VM with the “-n” switch and the partition number with the “-p” switch (most likely 0 or 1). This command gives you a text editor with the contents of the grub.cfg file of the VM. Locate the line with the submenu for previous Linux versions and delete or comment out that line:
submenu "Previous Linux versions" {
Move down to locate two consecutive lines with closing curly braces:
} }
Delete or comment out one of these two lines and write the file (:wq!). Now you can start the VM again as normal.
The problem is in the 10_linux file that grub loads. How do you edit that from xenserver console?
THANK-YOU-VERY-MUCH!