Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Mar 1998 16:54:39 +0100
From:      Eivind Eklund <eivind@yes.no>
To:        "Jordan K. Hubbard" <jkh@time.cdrom.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: cvs commit: src/release/sysinstall disks.c
Message-ID:  <19980319165439.56949@follo.net>
In-Reply-To: <13801.890321824@time.cdrom.com>; from Jordan K. Hubbard on Thu, Mar 19, 1998 at 07:37:04AM -0800
References:  <19980319163042.52677@follo.net> <13801.890321824@time.cdrom.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Mar 19, 1998 at 07:37:04AM -0800, Jordan K. Hubbard wrote:
> > You wouldn't happen to have a clue how to handle the 're-install on
> > dangerously dedicated' case correctly?  It routinely bite people.
> 
> I'd need a lot more information on how it's biting people.  I wasn't
> aware that there was any problem with this particular scenario

OK, let me give you a step-by-step description of how to reproduce
this:
1. Install a disk using dangerously dedicated mode.
2. Reboot.
3. Select custom install.
4. 'fdisk' the disk, doing nothing.
5. Watch sysinstall come up with a full-screen request with 3 choices
   - IIRC, "Install booteasy", "Install standard MBR", and "Do nothing
   to my bootblock".  The default choice is either a standard MBR or
   booteasy; I forget which.  If you don't change the default, your
   disk is toast on 'Commit'.

I've been caught by this myself, and I've seen quite a few people
being caught by it since.  You need to be alert and have a good
understanding of the FreeBSD disk-layout to not get caught.

> > This is the case where a disk has only a BSD-bootsector on it, and
> > sysinstall never-the-less write a standard DOS MBR over it (after
> > having put up a requester asking the user if he want to, of course).
> 
> Erm.  So you're saying that the user is asking to be blown away, or
> what exactly?

We're giving the user a default of blowing himself away, and a default
that it look logical not to change.

Sorry for not being clear; I thought it was a problem I'd described to
you earlier :-(

The below are my patches that attempt to fix the problem;
unfortunately, they have the slight disadvantage of not working (as
far as I can tell, they are no-ops).  Besides, they stylistically suck
- the functionality should probably be rolled into libdisk.

Index: disks.c
===================================================================
RCS file: /home/ncvs/src/release/sysinstall/disks.c,v
retrieving revision 1.95
diff -u -r1.95 disks.c
--- disks.c	1998/02/13 08:01:01	1.95
+++ disks.c	1998/02/18 19:59:51
@@ -445,7 +445,15 @@
 		 * disk (i.e., the disklabel starts at sector 0), even in cases where the user has requested
 		 * booteasy or a "standard" MBR -- both would be fatal in this case.
 		 */
-		if (!(d->chunks->part->flags & CHUNK_FORCE_ALL) && (mbrContents = getBootMgr(d->name)) != NULL)
+		if (!(d->chunks->part->flags & CHUNK_FORCE_ALL) &&
+		    !(d->chunks->next || (d->chunks->part &&
+					  !d->chunks->part->next &&
+					  ((d->chunks->part->type == whole &&
+					    d->chunks->part->part &&
+					    !d->chunks->part->part->next &&
+					    d->chunks->part->part->type == freebsd) ||
+					   d->chunks->part->type == freebsd))) &&
+		      (mbrContents = getBootMgr(d->name)) != NULL)
 		    Set_Boot_Mgr(d, mbrContents);
 		
 		if (DITEM_STATUS(diskPartitionWrite(NULL)) != DITEM_SUCCESS)
@@ -477,8 +485,15 @@
 	     * disk (i.e., the disklabel starts at sector 0), even in cases where the user has requested
 	     * booteasy or a "standard" MBR -- both would be fatal in this case.
 	     */
-	    if ((d->chunks->part->flags & CHUNK_FORCE_ALL) != CHUNK_FORCE_ALL
-		&& (mbrContents = getBootMgr(d->name)) != NULL)
+	    if ((d->chunks->part->flags & CHUNK_FORCE_ALL) != CHUNK_FORCE_ALL &&
+		!(d->chunks->next || (d->chunks->part &&
+				      !d->chunks->part->next &&
+				      ((d->chunks->part->type == whole &&
+					d->chunks->part->part &&
+					!d->chunks->part->part->next &&
+					d->chunks->part->part->type == freebsd) ||
+				       d->chunks->part->type == freebsd))) &&
+		(mbrContents = getBootMgr(d->name)) != NULL)
 		Set_Boot_Mgr(d, mbrContents);
 	    break;
 	    
Eivind.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980319165439.56949>