From nobody@FreeBSD.org  Sat Oct 15 09:23:42 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 61DE41065673
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 15 Oct 2011 09:23:42 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 51EB08FC18
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 15 Oct 2011 09:23:42 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p9F9NgXg051309
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 15 Oct 2011 09:23:42 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p9F9NfkW051305;
	Sat, 15 Oct 2011 09:23:41 GMT
	(envelope-from nobody)
Message-Id: <201110150923.p9F9NfkW051305@red.freebsd.org>
Date: Sat, 15 Oct 2011 09:23:41 GMT
From: Alexander Yerenkow <yerenkow@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Probably bug in gptboot
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         161677
>Category:       bin
>Synopsis:       gpart(8) Probably bug in gptboot
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-geom
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 15 09:30:05 UTC 2011
>Closed-Date:    
>Last-Modified:  Mon Oct 17 08:30:09 UTC 2011
>Originator:     Alexander Yerenkow
>Release:        FreeBSD-9-r226337
>Organization:
>Environment:
>Description:
When working with disk images, I have problems with boot them.
Booting went fine until screen with boot choices, and with FreeBSD logo, after choicing any, finished with message:
Can't work out which disk we are booting from.
Guessed BIOS device 0xffffffff not found by probes, defaulting to disk0:

panic: free: guard1 fail @ 0x3f2880b8 from sys/boot/i386/loader/../../common/module.c:1004

If I trying to boot in VirtualBox, then all the same, except that there's no last message, about panic, VirtBox just hangs.
>How-To-Repeat:
This is my way to make it:

touch $imagefile
truncate -s 4G $imagefile
mdconfig -af $imagefile -u $u
gpart create -s gpt /dev/md$u
gpart add -s 64k -t freebsd-boot -i 1 md$u
gpart add -t freebsd-ufs -s 2G -i 2 md$u
gpart add -t freebsd-swap -i 3 md$u
newfs -Uj /dev/md${u}p2
mount -o rw,noatime /dev/md${u}p2 $mountdir
.
make installworld DESTDIR=$mountdir
make distribution DESTDIR=$mountdir
make installkernel DESTDIR=$mountdir
gpart bootcode -b $mountdir/boot/pmbr md$u
gpart bootcode -p $mountdir/boot/gptboot -i 1 md$u


That's it, we created image;
Now any one to test:
1. VBoxManage convertfromraw $imagefile $imagevdi --format VDI -- and test in VirtualBox;
2. dd if=/$imagefile of=/dev/da* bs=1M  -- write to some USB disk, and boot from it.
>Fix:
Use mbr probably? :)


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-geom 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Sun Oct 16 22:50:18 UTC 2011 
Responsible-Changed-Why:  
over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=161677 

From: Andriy Gapon <avg@FreeBSD.org>
To: bug-followup@FreeBSD.org, yerenkow@gmail.com
Cc:  
Subject: Re: bin/161677: gpart(8) Probably bug in gptboot
Date: Mon, 17 Oct 2011 10:53:45 +0300

 This looks like an issue with BIOS emulation in Virtualbox, actually.
 I think I've already seen some commits that hack our boot code to play better
 with Virtualbox.  Try to build the boot blocks that you use for those images
 with -DVIRTUALBOX option.
 
 -- 
 Andriy Gapon

From: Alexander Yerenkow <yerenkow@gmail.com>
To: Andriy Gapon <avg@freebsd.org>
Cc: bug-followup@freebsd.org
Subject: Re: bin/161677: gpart(8) Probably bug in gptboot
Date: Mon, 17 Oct 2011 10:59:58 +0300

 --001485f62a063e525e04af79fe02
 Content-Type: text/plain; charset=ISO-8859-1
 
 2011/10/17 Andriy Gapon <avg@freebsd.org>
 
 >
 > This looks like an issue with BIOS emulation in Virtualbox, actually.
 > I think I've already seen some commits that hack our boot code to play
 > better
 > with Virtualbox.  Try to build the boot blocks that you use for those
 > images
 > with -DVIRTUALBOX option.
 >
 
 Don't think so;
 I got same error if I dd it to USB flash and try to boot on two different
 laptops.
 The only workaround I've found yet - is not use amd64 :)
 
 
 >
 > --
 > Andriy Gapon
 >
 
 
 
 -- 
 Regards,
 Alexander Yerenkow
 
 --001485f62a063e525e04af79fe02
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 <br><br><div class=3D"gmail_quote">2011/10/17 Andriy Gapon <span dir=3D"ltr=
 ">&lt;<a href=3D"mailto:avg@freebsd.org">avg@freebsd.org</a>&gt;</span><br>=
 <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
 x #ccc solid;padding-left:1ex;">
 <br>
 This looks like an issue with BIOS emulation in Virtualbox, actually.<br>
 I think I&#39;ve already seen some commits that hack our boot code to play =
 better<br>
 with Virtualbox. =A0Try to build the boot blocks that you use for those ima=
 ges<br>
 with -DVIRTUALBOX option.<br></blockquote><div><br></div><div>Don&#39;t thi=
 nk so;</div><div>I got same error if I dd it to USB flash and try to boot o=
 n two different laptops.</div><div>The only workaround I&#39;ve found yet -=
  is not use amd64 :)</div>
 <div>=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;=
 border-left:1px #ccc solid;padding-left:1ex;">
 <font color=3D"#888888"><br>
 --<br>
 Andriy Gapon<br>
 </font></blockquote></div><br><br clear=3D"all"><br>-- <br>Regards,<br>Alex=
 ander Yerenkow<br>
 
 --001485f62a063e525e04af79fe02--
>Unformatted:
