From nobody@FreeBSD.org  Wed Jun 30 02:59:38 2010
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 51B221065673
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 30 Jun 2010 02:59:38 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 3FD438FC13
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 30 Jun 2010 02:59:38 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o5U2xbNe047451
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 30 Jun 2010 02:59:37 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o5U2xbKR047449;
	Wed, 30 Jun 2010 02:59:37 GMT
	(envelope-from nobody)
Message-Id: <201006300259.o5U2xbKR047449@www.freebsd.org>
Date: Wed, 30 Jun 2010 02:59:37 GMT
From: Brian R Jones <bjones@castlejones.net>
To: freebsd-gnats-submit@FreeBSD.org
Subject: sysinstall partition=<SIZE> creates invalid partition type
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         148253
>Category:       bin
>Synopsis:       [patch] sysinstall(8): sysinstall partition=<SIZE> creates invalid partition type
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    brucec
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 30 03:00:16 UTC 2010
>Closed-Date:    Sat Aug 07 15:29:43 UTC 2010
>Last-Modified:  Sat Aug 07 15:29:43 UTC 2010
>Originator:     Brian R Jones
>Release:        8.0-RELEASE-amd64
>Organization:
>Environment:
FreeBSD brj1-dbg.alacritech.com 8.0-RELEASE FreeBSD 8.0-RELEASE #0: Sat Nov 21 15:02:08 UTC 2009     root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  amd64

>Description:
when using sysinstall for automated install (using install.cfg), or from command line, the partition=<SIZE> option of diskPartitionEditor creates a partition of type 0x03 instead of 0xa5.

The command line problem is no big deal, as fdisk can be used, but for jumpstart,
It's an absolute PITA.
>How-To-Repeat:
easiest to demo from command line:

Start by erasing all of MBR

[brj1-sut]atkstat# dd if=/dev/zero of=/dev/ad8 bs=512 count=64

then use sysinstal to create partition

[brj1-sut]atkstat# sysinstall debug=YES nonInteractive=YES  disk=ad8 \
partition=100G bootManager=boot diskPartitionEditor diskPartitionWrite

and use fdisk to view result

[brj1-sut]atkstat# fdisk /dev/ad8
******* Working on device /dev/ad8 *******
parameters extracted from in-core disklabel are:
cylinders=969021 heads=16 sectors/track=63 (1008 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=969021 heads=16 sectors/track=63 (1008 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 3 (0x03),(XENIX /usr file system)
    start 63, size 209714337 (102399 Meg), flag 0
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 1023/ head 15/ sector 63
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>



>Fix:


>Release-Note:
>Audit-Trail:

From: =?ISO-8859-1?Q?Jo=EBl_FAEDI?= <joel.faedi@gmail.com>
To: bug-followup@FreeBSD.org, bjones@castlejones.net
Cc:  
Subject: Re: bin/148253: sysinstall(8): sysinstall partition=&lt;SIZE&gt; 
	creates invalid partition type
Date: Sat, 3 Jul 2010 23:12:37 +0200

 --0016e6dab38bbbdba8048a8229bb
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 Hello,
 
 I notice that other calls to 'Create_Chunk' in disks.c use SUBTYPE_FREEBSD
 constant for and problematic calls have a "3" hardcoded...
 So I think the following patch for "/usr/src/usr.sbin/sysinstall/disks.c"
 will solve this problem.
 
  --- disks.c.orig        2010-06-14 04:09:06.000000000 +0200
 +++ disks.c     2010-07-03 22:01:14.000000000 +0200
 @@ -959,7 +959,7 @@
                 /* If a chunk is at least 10MB in size, use it. */
                 if (chunk_info[i]->type =3D=3D unused && chunk_info[i]->siz=
 e >
 (10 * ONE_MEG)) {
                     Create_Chunk(d, chunk_info[i]->offset,
 chunk_info[i]->size,
 -                                freebsd, 3,
 +                                freebsd, SUBTYPE_FREEBSD,
                                  (chunk_info[i]->flags & CHUNK_ALIGN),
                                  "FreeBSD");
                     variable_set2(DISK_PARTITIONED, "yes", 0);
 @@ -992,7 +992,7 @@
             for (i =3D 0; chunk_info[i]; i++) {
                 /* If a chunk is at least sz MB, use it. */
                 if (chunk_info[i]->type =3D=3D unused && chunk_info[i]->siz=
 e >=3D
 sz) {
 -                   Create_Chunk(d, chunk_info[i]->offset, sz, freebsd, 3,
 +                   Create_Chunk(d, chunk_info[i]->offset, sz, freebsd,
 SUBTYPE_FREEBSD,
                                  (chunk_info[i]->flags & CHUNK_ALIGN),
                                  "FreeBSD");
                     variable_set2(DISK_PARTITIONED, "yes", 0);
 
 My version of FreeBSD:
 FreeBSD xxxx 8.1-RC1 FreeBSD 8.1-RC1 #0: Mon Jun 14 14:44:53 UTC 2010
 root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
 
 My tests:
 1 Modify sysinstall and compile it (without installing it for now)
 1.1 cd /usr/src/usr.sbin/sysinstall
 1.2. apply the patch
 1.3. make
 
 2 Make a test on an unused external USB disk with the shipped "sysinstall"
 2.1 dd if=3D/dev/zero of=3D/dev/da1 bs=3D512 count=3D64
 2.2 /usr/sbin/sysinstall debug=3DYES nonInteractive=3DYES disk=3Dda1 partit=
 ion=3D10G
 bootManager=3Dboot diskPartitionEditor diskPartitionWrite
 2.3 /usr/sbin/sysinstall debug=3DYES nonInteractive=3DYES disk=3Dda1 partit=
 ion=3D15G
 bootManager=3Dboot diskPartitionEditor diskPartitionWrite
 2.4 fdisk /dev/da1
 ******* Working on device /dev/da1 *******
 parameters extracted from in-core disklabel are:
 cylinders=3D3648 heads=3D255 sectors/track=3D63 (16065 blks/cyl)
 
 Figures below won't work with BIOS for partitions not in cyl 1
 parameters to be used for BIOS calculations are:
 cylinders=3D3648 heads=3D255 sectors/track=3D63 (16065 blks/cyl)
 
 Media sector size is 512
 Warning: BIOS sector numbering starts with sector 1
 Information from DOS bootblock is:
 The data for partition 1 is:
 sysid 3 (0x03),(XENIX /usr file system)
     start 63, size 20964762 (10236 Meg), flag 0
         beg: cyl 0/ head 1/ sector 1;
         end: cyl 1023/ head 254/ sector 63
 The data for partition 2 is:
 sysid 3 (0x03),(XENIX /usr file system)
     start 20964825, size 31455270 (15359 Meg), flag 0
         beg: cyl 1023/ head 255/ sector 63;
         end: cyl 1023/ head 254/ sector 63
 The data for partition 3 is:
 <UNUSED>
 The data for partition 4 is:
 <UNUSED>
 
 3 Make the same tests with the external USB disk but with the patched
 "sysinstall"
 3.1 dd if=3D/dev/zero of=3D/dev/da1 bs=3D512 count=3D64
 3.2 /usr/src/usr.sbin/sysinstall/sysinstall debug=3DYES nonInteractive=3DYE=
 S
 disk=3Dda1 partition=3D10G bootManager=3Dboot diskPartitionEditor
 diskPartitionWrite
 3.3 /usr/src/usr.sbin/sysinstall/sysinstall debug=3DYES nonInteractive=3DYE=
 S
 disk=3Dda1 partition=3D15G bootManager=3Dboot diskPartitionEditor
 diskPartitionWrite
 3.4 fdisk /dev/da1
 ******* Working on device /dev/da1 *******
 parameters extracted from in-core disklabel are:
 cylinders=3D3648 heads=3D255 sectors/track=3D63 (16065 blks/cyl)
 
 Figures below won't work with BIOS for partitions not in cyl 1
 parameters to be used for BIOS calculations are:
 cylinders=3D3648 heads=3D255 sectors/track=3D63 (16065 blks/cyl)
 
 Media sector size is 512
 Warning: BIOS sector numbering starts with sector 1
 Information from DOS bootblock is:
 The data for partition 1 is:
 sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
     start 63, size 20964762 (10236 Meg), flag 80 (active)
         beg: cyl 0/ head 1/ sector 1;
         end: cyl 1023/ head 254/ sector 63
 The data for partition 2 is:
 sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
     start 20964825, size 31455270 (15359 Meg), flag 80 (active)
         beg: cyl 1023/ head 255/ sector 63;
         end: cyl 1023/ head 254/ sector 63
 The data for partition 3 is:
 <UNUSED>
 The data for partition 4 is:
 <UNUSED>
 
 It work !
 
 Best regards,
 
 Jo=EBl FAEDI
 
 --0016e6dab38bbbdba8048a8229bb
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: quoted-printable
 
 Hello,<br><br>I notice that other calls to &#39;Create_Chunk&#39; in disks.=
 c use=20
 SUBTYPE_FREEBSD constant for and problematic calls have a &quot;3&quot; har=
 dcoded... <br>So I think the following patch for &quot;/usr/src/usr.sbin/sy=
 sinstall/disks.c&quot; will solve this problem. <br><br>=A0--- disks.c.orig=
 =A0=A0=A0=A0=A0=A0=A0 2010-06-14 04:09:06.000000000 +0200<br>
 +++ disks.c=A0=A0=A0=A0 2010-07-03 22:01:14.000000000 +0200<br>@@ -959,7 +9=
 59,7 @@<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 /* If a chunk is a=
 t least 10MB in size, use it. */<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0 if (chunk_info[i]-&gt;type =3D=3D unused &amp;&amp; chunk_info[i]-&g=
 t;size &gt; (10 * ONE_MEG)) {<br>
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Create_Chunk(d, c=
 hunk_info[i]-&gt;offset, chunk_info[i]-&gt;size,<br>-=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 fr=
 eebsd, 3,<br>+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 freebsd, SUBTYPE_FREEBSD,<br>=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0 (chunk_info[i]-&gt;flags &amp; CHUNK_ALIGN),<br>
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0 &quot;FreeBSD&quot;);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 variable_set2(DISK_PARTITIONED, &quot;yes&qu=
 ot;, 0);<br>@@ -992,7 +992,7 @@<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 for (i=
  =3D 0; chunk_info[i]; i++) {<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0 /* If a chunk is at least sz MB, use it. */<br>
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 if (chunk_info[i]-&gt;type =
 =3D=3D unused &amp;&amp; chunk_info[i]-&gt;size &gt;=3D sz) {<br>-=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Create_Chunk(d, chunk_info[i]=
 -&gt;offset, sz, freebsd, 3,<br>+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0 Create_Chunk(d, chunk_info[i]-&gt;offset, sz, freebsd, SUBTYPE=
 _FREEBSD,<br>
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0 (chunk_info[i]-&gt;flags &amp; CHUNK_ALIGN),<br>=A0=
 =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0 &quot;FreeBSD&quot;);<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
 =A0=A0=A0=A0=A0=A0=A0=A0=A0 variable_set2(DISK_PARTITIONED, &quot;yes&quot;=
 , 0);<br><br>My version of FreeBSD:<br>
 FreeBSD xxxx 8.1-RC1 FreeBSD 8.1-RC1 #0: Mon Jun 14 14:44:53 UTC 2010=A0=A0=
 =A0=A0 root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC=A0 i386<br=
 ><br>My tests:<br>1 Modify sysinstall and compile it (without installing it=
  for now)<br>
 1.1 cd /usr/src/usr.sbin/sysinstall<br>1.2. apply the patch<br>1.3. make<br=
 ><br>2 Make a test on an unused external USB disk with the shipped &quot;sy=
 sinstall&quot;<br>2.1 dd if=3D/dev/zero of=3D/dev/da1 bs=3D512 count=3D64<b=
 r>2.2 /usr/sbin/sysinstall debug=3DYES nonInteractive=3DYES disk=3Dda1 part=
 ition=3D10G bootManager=3Dboot diskPartitionEditor diskPartitionWrite<br>
 2.3 /usr/sbin/sysinstall debug=3DYES nonInteractive=3DYES disk=3Dda1=20
 partition=3D15G bootManager=3Dboot diskPartitionEditor diskPartitionWrite<b=
 r>2.4 fdisk /dev/da1<br>******* Working on device /dev/da1 *******<br>param=
 eters extracted from in-core disklabel are:<br>cylinders=3D3648 heads=3D255=
  sectors/track=3D63 (16065 blks/cyl)<br>
 <br>Figures below won&#39;t work with BIOS for partitions not in cyl 1<br>p=
 arameters to be used for BIOS calculations are:<br>cylinders=3D3648 heads=
 =3D255 sectors/track=3D63 (16065 blks/cyl)<br><br>Media sector size is 512<=
 br>Warning: BIOS sector numbering starts with sector 1<br>
 Information from DOS bootblock is:<br>The data for partition 1 is:<br>sysid=
  3 (0x03),(XENIX /usr file system)<br>=A0=A0=A0 start 63, size 20964762 (10=
 236 Meg), flag 0<br>=A0=A0=A0=A0=A0=A0=A0 beg: cyl 0/ head 1/ sector 1;<br>=
 =A0=A0=A0=A0=A0=A0=A0 end: cyl 1023/ head 254/ sector 63<br>
 The data for partition 2 is:<br>sysid 3 (0x03),(XENIX /usr file system)<br>=
 =A0=A0=A0 start 20964825, size 31455270 (15359 Meg), flag 0<br>=A0=A0=A0=A0=
 =A0=A0=A0 beg: cyl 1023/ head 255/ sector 63;<br>=A0=A0=A0=A0=A0=A0=A0 end:=
  cyl 1023/ head 254/ sector 63<br>
 The data for partition 3 is:<br>&lt;UNUSED&gt;<br>The data for partition 4 =
 is:<br>&lt;UNUSED&gt;<br><br>3 Make the same tests with the external USB di=
 sk but with the patched=20
 &quot;sysinstall&quot;<br>3.1 dd if=3D/dev/zero of=3D/dev/da1 bs=3D512 coun=
 t=3D64<br>3.2 /usr/src/usr.sbin/sysinstall/sysinstall debug=3DYES nonIntera=
 ctive=3DYES disk=3Dda1 partition=3D10G bootManager=3Dboot diskPartitionEdit=
 or diskPartitionWrite<br>
 3.3 /usr/src/usr.sbin/sysinstall/sysinstall debug=3DYES nonInteractive=3DYE=
 S=20
 disk=3Dda1 partition=3D15G bootManager=3Dboot diskPartitionEditor=20
 diskPartitionWrite<br>3.4 fdisk /dev/da1<br>******* Working on device /dev/=
 da1 *******<br>parameters extracted from in-core disklabel are:<br>cylinder=
 s=3D3648 heads=3D255 sectors/track=3D63 (16065 blks/cyl)<br><br>Figures bel=
 ow won&#39;t work with BIOS for partitions not in cyl 1<br>
 parameters to be used for BIOS calculations are:<br>cylinders=3D3648 heads=
 =3D255 sectors/track=3D63 (16065 blks/cyl)<br><br>Media sector size is 512<=
 br>Warning: BIOS sector numbering starts with sector 1<br>Information from =
 DOS bootblock is:<br>
 The data for partition 1 is:<br>sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)<br=
 >=A0=A0=A0 start 63, size 20964762 (10236 Meg), flag 80 (active)<br>=A0=A0=
 =A0=A0=A0=A0=A0 beg: cyl 0/ head 1/ sector 1;<br>=A0=A0=A0=A0=A0=A0=A0 end:=
  cyl 1023/ head 254/ sector 63<br>
 The data for partition 2 is:<br>sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)<br=
 >=A0=A0=A0 start 20964825, size 31455270 (15359 Meg), flag 80 (active)<br>=
 =A0=A0=A0=A0=A0=A0=A0 beg: cyl 1023/ head 255/ sector 63;<br>=A0=A0=A0=A0=
 =A0=A0=A0 end: cyl 1023/ head 254/ sector 63<br>
 The data for partition 3 is:<br>&lt;UNUSED&gt;<br>The data for partition 4 =
 is:<br>&lt;UNUSED&gt;<br><br>It work !<br><br>Best regards,<br><br>Jo=EBl F=
 AEDI<br><br><br>
 
 --0016e6dab38bbbdba8048a8229bb--
State-Changed-From-To: open->patched  
State-Changed-By: brucec 
State-Changed-When: Mon Jul 5 03:59:28 UTC 2010 
State-Changed-Why:  
Fixed in head. 


Responsible-Changed-From-To: freebsd-bugs->brucec  
Responsible-Changed-By: brucec 
Responsible-Changed-When: Mon Jul 5 03:59:28 UTC 2010 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=148253 
State-Changed-From-To: patched->closed  
State-Changed-By: brucec 
State-Changed-When: Sat Aug 7 15:29:21 UTC 2010 
State-Changed-Why:  
Fix has been merged to stable/7 and stable/8. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=148253 
>Unformatted:
