[Libguestfs] Notes on libguestfs with Ubuntu 12.04 (Precise)

Richard W.M. Jones rjones at redhat.com
Sun Apr 15 20:05:49 UTC 2012

On Sat, Apr 14, 2012 at 09:49:03PM +0100, Richard W.M. Jones wrote:
> > There is another problem which you may hit, if you add a completely
> > blank disk to libguestfs (this also affects libguestfs-test-tool):
> > 
> >   https://bugs.launchpad.net/ubuntu/+source/linux/+bug/931371
> >   https://bugzilla.kernel.org/show_bug.cgi?id=42778

I've now identified the bug, and provided a fix.  The bug in fact is
in SeaBIOS (not the kernel as originally thought):


To recompile SeaBIOS with this fix on Ubuntu 12.04, do:

  apt-get source seabios
  cd seabios-0.6.2/debian/patches

  # Download the patch attached to this email into this directory.

  echo 0001-Fix-alignment-bug-in-pci_bios_init_root_regions.patch >> series
  cd ../..
  debuild -i -uc -us -b

  cd ..
  sudo dpkg -i seabios_0.6.2-0ubuntu2_all.deb

After this, libguestfs should work normally.  (Note you may also need
to do the febootstrap update from the previous email and rebuild the


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
-------------- next part --------------
>From 3c5fcec00ce1317cda56d549259550fcc018c834 Mon Sep 17 00:00:00 2001
From: Kevin O'Connor <kevin at koconnor.net>
Date: Sat, 1 Oct 2011 12:35:32 -0400
Subject: [PATCH] Fix alignment bug in pci_bios_init_root_regions().

If there are no memory allocations for a given type then the "max" bar
size is zero.  However, ALIGN_DOWN does not handle an alignment of
zero properly.  Catch and handle the zero case.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
 src/pciinit.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pciinit.c b/src/pciinit.c
index a857da0..0d8758e 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -536,7 +536,7 @@ static void pci_bios_init_bus_bases(struct pci_bus *bus)
-#define ROOT_BASE(top, sum, align) ALIGN_DOWN((top)-(sum),(align))
+#define ROOT_BASE(top, sum, max) ALIGN_DOWN((top)-(sum),(max) ?: 1)
 static int pci_bios_init_root_regions(u32 start, u32 end)

More information about the Libguestfs mailing list