Bug#695500: d-i-n-i: #695500 is apparently a grub-mkimage (or debian-installer) bug

Colin Watson cjwatson at debian.org
Fri Dec 6 13:41:12 UTC 2013


On Sun, Oct 13, 2013 at 10:27:27PM +0200, Didier 'OdyX' Raboud wrote:
> I spent some more time debugging this RC bug by setting up my server and 
> testing the PXE boot of kfreebsd-i386 on two different laptops; the 
> results are:
> 
> * the "error: prefix is not set" error always appears when using the 
> wheezy grub2pxe; it also happens with the current sid grub2pxe [0];
> * the resistance to this error apparently depends on the PXE 
> implementation:
>   - my "acer Aspire One" displays the error and then proceeds to
>     displaying grub, then allowing the boot of the kfreebsd-i386
>     installer;
>   - my "ThinkPad X220" displays the error and stops;
>   - kvm launched locally with [1] proceeds to grub;
> 
> [0] http://http.debian.net/debian/dists/sid/main/installer-kfreebsd-i386/20130430/images/netboot/grub2pxe
> [1] kvm -m 256 -net nic -net -
> user,bootfile=/grub2pxe,tftp=/usr/lib/debian-installer/images/7.0/kfreebsd-amd64/gtk/
> 
> As debian-installer-netboot-images is only copying these files from the 
> mirrors, I don't think it is the correct source package to track this 
> bug. The above tests now make me think that this is either a problem of 
> debian-installer calling grub-mkimage wrongly in 
> build/config/kfreebsd.cfg or a bug in grub-mkimage not incorporating the 
> prefix correctly when creating a PXE image.

I was staring at this bug for the nth time, and noticed something.
debian-installer is calling grub-mkimage with the "i386-pc" image type
when building netboot images, the same way as it does when building CD
images.  This is very probably wrong; it should be using "i386-pc-pxe"
instead.  The difference between these image types is that i386-pc
prefixes the image with diskboot.img, while i386-pc-pxe prefixes the
image with pxeboot.img.  The former tries to read core.img off the local
hard disk, while the latter assumes that it's already been read into
memory and just jumps to it.  It is absolutely wrong to use i386-pc for
an image that isn't installed to a local disk.

I suspect that the reason everyone is terribly confused about
reproducing this is that it will depend on what you happen to have
installed on your local disk, as well as what KVM's PXE environment
happens to provide as the drive reference.

Could you try this patch and see if it helps?  I'm betting that it will
at least be much closer to functional.

diff --git a/build/config/hurd.cfg b/build/config/hurd.cfg
index 21091fc..a40a977 100644
--- a/build/config/hurd.cfg
+++ b/build/config/hurd.cfg
@@ -114,7 +114,7 @@ arch_netboot_dir:
 	fi
 
 	# Generate grub2pxe
-	grub-mkimage -O i386-pc --prefix="(pxe)/$(NETBOOT_PATH)" \
+	grub-mkimage -O i386-pc-pxe --prefix="(pxe)/$(NETBOOT_PATH)" \
 		-o $(TEMP_NETBOOT_DIR)/core.img \
 		$(GRUB_MODULES) $(GRUB_MODULES_PXE)
 	# workaround a gPXE bug
diff --git a/build/config/kfreebsd.cfg b/build/config/kfreebsd.cfg
index 080111a..1b05133 100644
--- a/build/config/kfreebsd.cfg
+++ b/build/config/kfreebsd.cfg
@@ -137,7 +137,7 @@ arch_netboot_dir:
 	fi
 
 	# Generate grub2pxe
-	grub-mkimage -O i386-pc --prefix="(pxe)/$(NETBOOT_PATH)" \
+	grub-mkimage -O i386-pc-pxe --prefix="(pxe)/$(NETBOOT_PATH)" \
 		-o $(TEMP_NETBOOT_DIR)/core.img \
 		$(GRUB_MODULES) $(GRUB_MODULES_PXE)
 	# workaround a gPXE bug

Thanks,

-- 
Colin Watson                                       [cjwatson at debian.org]



More information about the Pkg-grub-devel mailing list