From owner-freebsd-hackers Thu Mar 19 07:54:54 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA09958 for freebsd-hackers-outgoing; Thu, 19 Mar 1998 07:54:54 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from ns1.yes.no (ns1.yes.no [195.119.24.10]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA09904 for ; Thu, 19 Mar 1998 07:54:47 -0800 (PST) (envelope-from eivind@bitbox.follo.net) Received: from bitbox.follo.net (bitbox.follo.net [194.198.43.36]) by ns1.yes.no (8.8.7/8.8.7) with ESMTP id PAA29895; Thu, 19 Mar 1998 15:54:41 GMT Received: (from eivind@localhost) by bitbox.follo.net (8.8.6/8.8.6) id QAA07490; Thu, 19 Mar 1998 16:54:40 +0100 (MET) Message-ID: <19980319165439.56949@follo.net> Date: Thu, 19 Mar 1998 16:54:39 +0100 From: Eivind Eklund To: "Jordan K. Hubbard" Cc: hackers@FreeBSD.ORG Subject: Re: cvs commit: src/release/sysinstall disks.c References: <19980319163042.52677@follo.net> <13801.890321824@time.cdrom.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89.1i In-Reply-To: <13801.890321824@time.cdrom.com>; from Jordan K. Hubbard on Thu, Mar 19, 1998 at 07:37:04AM -0800 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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