NetBSD Problem Report #38841

From martin@duskware.de  Tue Jun  3 07:38:01 2008
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 1D63863BA89
	for <gnats-bugs@gnats.netbsd.org>; Tue,  3 Jun 2008 07:38:01 +0000 (UTC)
Message-Id: <20080603033213.9414863BC20@narn.NetBSD.org>
Date: Tue,  3 Jun 2008 03:32:13 +0000 (UTC)
From: matsunaw@ja2.so-net.ne.jp
Reply-To: matsunaw@ja2.so-net.ne.jp
To: netbsd-bugs-owner@NetBSD.org
Subject: installer blow up FreeBSD's disklabel on other DOS partitions
X-Send-Pr-Version: www-1.0

>Number:         38841
>Category:       install
>Synopsis:       installer blow up FreeBSD's disklabel on other DOS partitions
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    install-manager
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 03 07:40:00 +0000 2008
>Closed-Date:    Fri Oct 15 03:41:20 +0000 2010
>Last-Modified:  Tue Mar 08 17:10:03 +0000 2011
>Originator:     Hitoshi Matsunawa
>Release:        NetBSD 4.0
>Organization:
none
>Environment:
n/a
>Description:
Suppose I have 4 ``DOS'' partition where linux and freebsd-7.0
{i386|amd64} are installed already, then i tried to install NetBSD-4.0
{i386|amd64} in a free ``DOS'' partition using ISO images
(i386cd-4.0.iso and amd64cd-4.0.iso). After installer completed,
existed freebsd-7.0's disklabels, on different ``DOS'' partition from i
installed NetBSD-4.0, were blowed up (from my point of view).

>How-To-Repeat:
see description
>Fix:
I don't know it's a bug or feature. I think it shoud not re-write
other ``DOS'' partition's data without user's permission, or
documented loudly (sorry if i missed that part in ``install.txt'').

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: install/38841: installer blow up FreeBSD's disklabel on other DOS partitions
Date: Tue, 3 Jun 2008 09:47:39 +0200

 Could you (or anyone else following) please provide a vnd image of a
 disk with a similar setup as you describe, with freebsd partition?

 That would make it pretty easy to debug.

 Thanks,

 Martin

From: matsunaw@ja2.so-net.ne.jp
To: gnats-bugs@NetBSD.org
Cc: install-manager@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: install/38841: installer blow up FreeBSD's disklabel on other DOS partitions
Date: Tue, 03 Jun 2008 19:32:11 +0900

 >  Could you (or anyone else following) please provide a vnd image of a
 >  disk with a similar setup as you describe, with freebsd partition?

 sorry, i can't.

 I describe more in detail, hope this might help.


 DOS (primary) partition #2 is where i tried to install NetBSD-4.0. DOS
 (primary) partition #3/#4 have "FreeBSD 7.0-STABLE i386"/"FreeBSD 7.0-STABLE
 amd64" installed respectively. Boot manager is Grub came with linux
 system.

 After NetBSD-4.0 installed, linux said::

 -- linux's /var/log/messages --
 Jun  1 12:40:16 myname kernel:  sda: sda1 < sda5 sda6 sda7 sda8 > sda2 sda3 sda4
 Jun  1 12:40:16 myname kernel:  sda2: <netbsd: sda9 sda10 >
 Jun  1 12:40:16 myname kernel:  sda3: <bsd:bad subpartition - ignored
 Jun  1 12:40:16 myname kernel: bad subpartition - ignored
 Jun  1 12:40:16 myname kernel:  >
 Jun  1 12:40:16 myname kernel:  sda4: <bsd:bad subpartition - ignored
 Jun  1 12:40:16 myname kernel: bad subpartition - ignored
 Jun  1 12:40:16 myname kernel:  >
 -- --

 At this point, Grub cannot boot from neither DOS partition #3/#4.

 If I remember correctly, the corrupted disklabel had 'c' and 'd'
 elements were existed correctly (in means of NetBSD), other 'a', 'b',
 'e' and 'f' elements were erased (not 100% sure, sorry).

 After recovered label (by hands)::

 -- linux's /var/log/messages --
 Jun  2 21:12:13 myname kernel: Linux version 2.6.22.5-76.fc7 (kojibuilder@xenbuilder4.fedora.phx.redhat.com) (gcc version 4.1.2 20070502 (Red Hat 4.1.2-12)) #1 SMP Thu Aug 30 13:47:21 EDT 2007
 Jun  2 21:12:14 myname kernel:  sda: sda1 < sda5 sda6 sda7 sda8 > sda2 sda3 sda4
 Jun  2 21:12:14 myname kernel:  sda2: <openbsd: sda9 >
 Jun  2 21:12:14 myname kernel:  sda3: <bsd: sda10 sda11 >
 Jun  2 21:12:14 myname kernel:  sda4: <bsd: sda12 sda13 sda14 >
 -- --

 And disklabels of freebsd on DOS partition #3 (it might be same as
 originally installed because of hand repair)::

 ---
 % uname -srm
 FreeBSD 7.0-STABLE i386
 % disklabel -r /dev/ad4s3
 # /dev/ad4s3:
 8 partitions:
 #        size   offset    fstype   [fsize bsize bps/cpg]
   a: 16777216        0    4.2BSD        0     0     0 
   c: 97675200        0    unused        0     0         # "raw" part, don't edit
   e:  8388608 16777216    4.2BSD        0     0     0 
 % df -h
 Filesystem     Size    Used   Avail Capacity  Mounted on
 /dev/ad4s3a    7.7G    1.3G    5.8G    18%    /
 devfs          1.0K    1.0K      0B   100%    /dev
 /dev/ad4s3e    3.9G     57M    3.5G     2%    /var/data
 /dev/ad4s4e     19G    1.8G     16G    10%    /usr/users
 /dev/ad4s4f     62G     17G     41G    29%    /usr/local/src
 ---

 swap is from /dev/ad4s3b..., but i forgot to recover.


 regards,
 matsunaw

From: David Holland <dholland-bugs@netbsd.org>
To: matsunaw@ja2.so-net.ne.jp
Cc: gnats-bugs@NetBSD.org, install-manager@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: install/38841: installer blow up FreeBSD's disklabel on other
	DOS partitions
Date: Wed, 11 Jun 2008 18:54:25 +0000

 On Tue, Jun 03, 2008 at 07:32:11PM +0900, matsunaw@ja2.so-net.ne.jp wrote:
  > And disklabels of freebsd on DOS partition #3 (it might be same as
  > originally installed because of hand repair)::
  > 
  > ---
  > % uname -srm
  > FreeBSD 7.0-STABLE i386
  > % disklabel -r /dev/ad4s3
  > # /dev/ad4s3:
  > 8 partitions:
  > #        size   offset    fstype   [fsize bsize bps/cpg]
  >   a: 16777216        0    4.2BSD        0     0     0 
  >   c: 97675200        0    unused        0     0         # "raw" part, don't edit
  >   e:  8388608 16777216    4.2BSD        0     0     0 

 The chief cause of problems like this is accidentally mistyping
 partition sizes or offsets. Then you get overlapping partitions and
 things get overwritten.

 Can you post the fdisk table and the other disklabels?

 -- 
 David A. Holland
 dholland@netbsd.org

From: matsunaw@ja2.so-net.ne.jp
To: gnats-bugs@NetBSD.org
Cc: install-manager@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: install/38841: installer blow up FreeBSD's disklabel on other	DOS partitions
Date: Thu, 12 Jun 2008 09:39:43 +0900

 >  On Tue, Jun 03, 2008 at 07:32:11PM +0900, matsunaw@ja2.so-net.ne.jp wrote:
 >   > And disklabels of freebsd on DOS partition #3 (it might be same as
                                                              ^NOT
 # sorry for type.

 >  The chief cause of problems like this is accidentally mistyping
 >  partition sizes or offsets. Then you get overlapping partitions and
 >  things get overwritten.
 >  
 >  Can you post the fdisk table and the other disklabels?

 fdisk-partition id I'm using is::
 ----
 a5  FreeBSD
 a6  OpenBSD
 a9  NetBSD
 ---

 BTW, as you know, freebsd has ``slice'' to represents DOS partitions,
 'd' BSD partitions has no special meaning like netbsd.
 ----
 % uname -srm
 FreeBSD 7.0-STABLE i386
 % fdisk-linux -l /dev/ad4

 Disk /dev/ad4: 250.0 GB, 250059350016 bytes
 255 heads, 63 sectors/track, 30401 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes

     Device Boot    Start       End    Blocks   Id  System
 /dev/ad4s1             1      6080  48837568+   5  Extended
 /dev/ad4s2          6081     12160  48837600   a6  OpenBSD
 /dev/ad4s3   *     12161     18240  48837600   a5  FreeBSD
 /dev/ad4s4         18241     30401  97683232+  a5  FreeBSD
 /dev/ad4s5             1        33    265009+  83  Linux
 /dev/ad4s6            34      3925  31262458+  83  Linux
 /dev/ad4s7          3926      6014  16779861   83  Linux
 /dev/ad4s8          6015      6080    530113+  82  Linux swap
 % disklabel -r /dev/ad4s4
 # /dev/ad4s4:
 8 partitions:
 #        size   offset    fstype   [fsize bsize bps/cpg]
   a: 16777216        0    4.2BSD        0     0     0 
   b:  2097152 16777216      swap                    
   c: 195366465        0    unused        0     0         # "raw" part, don't edit
   e: 41943040 18874368    4.2BSD        0     0     0 
   f: 134549057 60817408    4.2BSD        0     0     0 
 % disklabel -rA /dev/ad4s4
 # /dev/ad4s4:
 type: unknown
 disk: amnesiac
 label: 
 flags:
 bytes/sector: 512
 sectors/track: 63
 tracks/cylinder: 16
 sectors/cylinder: 1008
 cylinders: 193815
 sectors/unit: 195366465
 rpm: 3600
 interleave: 1
 trackskew: 0
 cylinderskew: 0
 headswitch: 0           # milliseconds
 track-to-track seek: 0  # milliseconds
 drivedata: 0 

 8 partitions:
 #        size   offset    fstype   [fsize bsize bps/cpg]
   a: 16777216        0    4.2BSD        0     0     0 
   b:  2097152 16777216      swap                    
   c: 195366465        0    unused        0     0         # "raw" part, don't edit
   e: 41943040 18874368    4.2BSD        0     0     0 
   f: 134549057 60817408    4.2BSD        0     0     0 
 % disklabel -r /dev/ad4s2
 # /dev/ad4s2:
 8 partitions:
 #        size   offset    fstype   [fsize bsize bps/cpg]
   a: 16778160 97675200    4.2BSD        0     0     1 
   b:  2097270 114453360      swap                    
   c: 488397168        0    unused        0     0         # "raw" part, don't edit
   e: 16778160 116550630    4.2BSD        0     0     1 
 partition a: partition extends past end of unit
 partition b: offset past end of unit
 partition b: partition extends past end of unit
 partition c: partition extends past end of unit
 disklabel: partition c doesn't cover the whole unit!
 disklabel: An incorrect partition c may cause problems for standard system utilities
 partition e: offset past end of unit
 partition e: partition extends past end of unit
 % disklabel -rA /dev/ad4s2
 # /dev/ad4s2:
 type: DOC2K
 disk: amnesiac
 label: 
 flags:
 bytes/sector: 512
 sectors/track: 63
 tracks/cylinder: 16
 sectors/cylinder: 1008
 cylinders: 96900
 sectors/unit: 488397168
 rpm: 3600
 interleave: 1
 trackskew: 0
 cylinderskew: 0
 headswitch: 0           # milliseconds
 track-to-track seek: 0  # milliseconds
 drivedata: 0 

 8 partitions:
 #        size   offset    fstype   [fsize bsize bps/cpg]
   a: 16778160 97675200    4.2BSD        0     0     1 
   b:  2097270 114453360      swap                    
   c: 488397168        0    unused        0     0         # "raw" part, don't edit
   e: 16778160 116550630    4.2BSD        0     0     1 
 ----

 regards,
 matsunaw

From: David Holland <dholland-bugs@netbsd.org>
To: matsunaw@ja2.so-net.ne.jp
Cc: gnats-bugs@NetBSD.org, install-manager@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: install/38841: installer blow up FreeBSD's disklabel on other
	DOS partitions
Date: Sun, 22 Jun 2008 22:27:08 +0000

 On Thu, Jun 12, 2008 at 09:39:43AM +0900, matsunaw@ja2.so-net.ne.jp wrote:
  > >  The chief cause of problems like this is accidentally mistyping
  > >  partition sizes or offsets. Then you get overlapping partitions and
  > >  things get overwritten.
  > >  
  > >  Can you post the fdisk table and the other disklabels?
  > 
  > [...]

  > Disk /dev/ad4: 250.0 GB, 250059350016 bytes
  > 255 heads, 63 sectors/track, 30401 cylinders
  > Units = cylinders of 16065 * 512 = 8225280 bytes
  > 
  >     Device Boot    Start       End    Blocks   Id  System
  > /dev/ad4s1             1      6080  48837568+   5  Extended
  > /dev/ad4s2          6081     12160  48837600   a6  OpenBSD
  > /dev/ad4s3   *     12161     18240  48837600   a5  FreeBSD
  > /dev/ad4s4         18241     30401  97683232+  a5  FreeBSD
  > /dev/ad4s5             1        33    265009+  83  Linux
  > /dev/ad4s6            34      3925  31262458+  83  Linux
  > /dev/ad4s7          3926      6014  16779861   83  Linux
  > /dev/ad4s8          6015      6080    530113+  82  Linux swap

 Unless you tell this to print in sectors it's impossible to tell if
 the partition boundaries are correct. (And since the partition tables
 aren't the same as they were when things failed, looking at them now
 won't necessarily prove anything anyway.)

 Also, I don't think you've explained why ad4s2 has been changed to
 OpenBSD.

  > % disklabel -r /dev/ad4s2
  > # /dev/ad4s2:
  > 8 partitions:
  > #        size   offset    fstype   [fsize bsize bps/cpg]
  >   a: 16778160 97675200    4.2BSD        0     0     1 
  >   b:  2097270 114453360      swap                    
  >   c: 488397168        0    unused        0     0         # "raw" part, don't edit
  >   e: 16778160 116550630    4.2BSD        0     0     1 
  > partition a: partition extends past end of unit
  > partition b: offset past end of unit
  > partition b: partition extends past end of unit
  > partition c: partition extends past end of unit
  > disklabel: partition c doesn't cover the whole unit!
  > disklabel: An incorrect partition c may cause problems for standard system utilities
  > partition e: offset past end of unit
  > partition e: partition extends past end of unit

 If this is really a NetBSD disklabel, printing it with NetBSD's
 disklabel utility will be much more likely to produce useful results.

 -- 
 David A. Holland
 dholland@netbsd.org

From: matsunaw@ja2.so-net.ne.jp
To: gnats-bugs@NetBSD.org
Cc: install-manager@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: install/38841: installer blow up FreeBSD's disklabel on other	DOS partitions
Date: Tue, 24 Jun 2008 09:43:43 +0900

 >  If this is really a NetBSD disklabel, printing it with NetBSD's
 >  disklabel utility will be much more likely to produce useful results.

 No. if you need netbsd binary's output, i cannot help.

 BTW, I noted ">Environment:" as "n/a" in a original report.

 regards,
 matsunaw

From: David Holland <dholland-bugs@netbsd.org>
To: matsunaw@ja2.so-net.ne.jp
Cc: gnats-bugs@NetBSD.org, install-manager@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: install/38841: installer blow up FreeBSD's disklabel on other
	DOS partitions
Date: Sun, 29 Jun 2008 20:43:47 +0000

 On Tue, Jun 24, 2008 at 09:43:43AM +0900, matsunaw@ja2.so-net.ne.jp wrote:
  > >  If this is really a NetBSD disklabel, printing it with NetBSD's
  > >  disklabel utility will be much more likely to produce useful results.
  > 
  > No. if you need netbsd binary's output, i cannot help.

 Not necessarily... but we do need more to go on than you've given us
 so far.

 You say you can't provide a vnd image with the same partitioning. You
 also haven't told us what that partitioning is in enough detail to
 duplicate it exactly. There are also other circumstances you haven't
 explained, like when or why the NetBSD partition turned into an
 OpenBSD partition.

 Without this information it is unlikely that we can figure out what
 happened.

 -- 
 David A. Holland
 dholland@netbsd.org

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 09 Nov 2009 10:35:14 +0000
State-Changed-Why:
More information was requested, more than a year ago.


State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 15 Oct 2010 03:41:20 +0000
State-Changed-Why:
Feedback timeout and PR contains insufficient information to diagnose or
reproduce.


From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/38841 CVS commit: src/sbin/disklabel
Date: Sat, 12 Feb 2011 22:23:02 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Sat Feb 12 22:23:02 UTC 2011

 Modified Files:
 	src/sbin/disklabel: Makefile

 Log Message:
 Disable COMPAT_386BSD_MBRPART. The code is still here if anyone needs it
 for some reason. (But I have no idea why that would be -- if you have one
 of these really ancient partitions and you're about to run disklabel, you
 can easily run fdisk first and change the partition type to NetBSD.)

 As it stands, the code will munch FreeBSD installs under some
 circumstances, which is really not acceptable behavior.

 The code, along with the kernel support that's been disabled by
 default for several years, and some related but less dangerous code in
 sysinst, should prboably be removed entirely after -6 is branched.

 Discussed on tech-kern and tech-userlevel; closes PR 44496.

 This is also almost certainly the cause of PR 42521 and PR 38841.


 To generate a diff of this commit:
 cvs rdiff -u -r1.66 -r1.67 src/sbin/disklabel/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/38841 CVS commit: [netbsd-5] src/sbin/disklabel
Date: Tue, 8 Mar 2011 17:05:32 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Tue Mar  8 17:05:32 UTC 2011

 Modified Files:
 	src/sbin/disklabel [netbsd-5]: Makefile

 Log Message:
 Pull up following revision(s) (requested by dholland in ticket #1561):
 	sbin/disklabel/Makefile: revision 1.67
 Disable COMPAT_386BSD_MBRPART. The code is still here if anyone needs it
 for some reason. (But I have no idea why that would be -- if you have one
 of these really ancient partitions and you're about to run disklabel, you
 can easily run fdisk first and change the partition type to NetBSD.)
 As it stands, the code will munch FreeBSD installs under some
 circumstances, which is really not acceptable behavior.
 The code, along with the kernel support that's been disabled by
 default for several years, and some related but less dangerous code in
 sysinst, should prboably be removed entirely after -6 is branched.
 Discussed on tech-kern and tech-userlevel; closes PR 44496.
 This is also almost certainly the cause of PR 42521 and PR 38841.


 To generate a diff of this commit:
 cvs rdiff -u -r1.61 -r1.61.6.1 src/sbin/disklabel/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.