Skip to content

Solving “Unable to find partition containing kernel”

Why isn’t it working it was working just before now it should be working

tl;dr: If you’re using the pygrub loader, make sure /boot/grub/ exists!

The Error

I was updating some virtual servers (Xen DomUs); I shut one (hestia) down, then tried to bring it back up using xl create hestia.cfg. But it didn’t start. Xen complained:

libxl: error: libxl_bootloader.c:635:bootloader_finished: bootloader failed - consult logfile /var/log/xen/bootloader.2.log
libxl: error: libxl_exec.c:118:libxl_report_child_exitstatus: bootloader [2058] exited with error status 1
libxl: error: libxl_create.c:1223:domcreate_rebuild_done: cannot (re-)build domain: -3
libxl: error: libxl.c:1575:libxl__destroy_domid: non-existant domain 2
libxl: error: libxl.c:1534:domain_destroy_callback: unable to destroy guest with domid 2
libxl: error: libxl.c:1463:domain_destroy_cb: destruction of domain 2 failed

The error log contained:

Traceback (most recent call last):
    File "/usr/lib/xen-4.8/bin/pygrub", line 882, in
        raise RuntimeError, "Unable to find partition containing kernel"
RuntimeError: Unable to find partition containing kernel

The Troubleshooting

Having just run the DomU I knew it had a partition containing a kernel! Just to be sure I mounted the root LV and made sure. Sure enough, there was a vmlinuz and an initrd.img present. So what gives? Search results for the error were pretty unhelpful.

Following prompting from vlt in #xen on Freenode, I cehcekd to see if there was a /boot/grub containing configuration in the form of menu.lst or grub.cfg. And there wasn’t. What gave? Well…

I think what had happened was that when I recovered the configuration of hestia when I accidentally dd’d my Dom0 root partition, I recreated it using pygrub as a bootloader when it didn’t have that before*.

The Fix

To solve the issue, I created by hand a minimal menu.lst at the suggestion of vlt:

default 0
timeout 5
title Debian
    root (hd0,1)
    kernel /vmlinuz root=/dev/xvda
    initrd /initrd.img

This allowed the DomU to boot, and I could install the grub2 package and let it create its own proper, fully up-to-date grub.cfg.

It’s quite a niche set of circumstances to get into; losing a configuration and recreating it with the incorrect bootloader*, but if you find yourself in that situation, you this might at least get you back on track.

*: What you should really do is restore the config from a backup. But suppose you hadn’t backed up the server guest VM configuration files…

1 thought on “Solving “Unable to find partition containing kernel””

  1. Pingback: Recovering the Config of a Running Xen DomU – Rob's Blog

Tell us what's on your mind

Discover more from Rob's Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading