From david@catwhisker.org  Mon Oct 15 17:02:25 2001
Return-Path: <david@catwhisker.org>
Received: from bunrab.catwhisker.org (adsl-63-193-123-122.dsl.snfc21.pacbell.net [63.193.123.122])
	by hub.freebsd.org (Postfix) with ESMTP id 3651437B40A
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 15 Oct 2001 17:02:25 -0700 (PDT)
Received: from freebeast.catwhisker.org (freebeast.catwhisker.org [172.16.8.10])
	by bunrab.catwhisker.org (8.11.6/8.11.6) with ESMTP id f9G02Mp31723
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 15 Oct 2001 17:02:22 -0700 (PDT)
	(envelope-from david@mailhost.catwhisker.org)
Received: (from david@localhost)
	by freebeast.catwhisker.org (8.11.6/8.11.6) id f9G02M500983;
	Mon, 15 Oct 2001 17:02:22 -0700 (PDT)
	(envelope-from david)
Message-Id: <200110160002.f9G02M500983@freebeast.catwhisker.org>
Date: Mon, 15 Oct 2001 17:02:22 -0700 (PDT)
From: David Wolfskill <david@catwhisker.org>
Reply-To: David Wolfskill <david@catwhisker.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: sysinstall fails to create non-root partitions
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         31306
>Category:       bin
>Synopsis:       sysinstall fails to create non-root partitions
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    qa
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 15 17:10:01 PDT 2001
>Closed-Date:    Tue Nov 12 10:57:31 PST 2002
>Last-Modified:  Tue Nov 12 10:57:31 PST 2002
>Originator:     David Wolfskill
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Wolfskill & Dowliing Residence
>Environment:
System: FreeBSD freebeast.catwhisker.org 5.0-CURRENT FreeBSD 5.0-CURRENT #9: Mon Oct 15 07:29:17 PDT 2001 root@freebeast.catwhisker.org:/common/S4/obj/usr/src/sys/FREEBEAST i386


	Tested on several machines, using recent -CURRENT snapshots
	from current.freebsd.org.

>Description:
	After using the Disk Label Editor to specify the characteristics
	of the fileesystems to be used and the partitions where they
	reside, sysinstall creates the device entries in /dev for the
	root and swap partitions, but none of the others.

	In cases where significant parts of the system are intended to be
	installed on a non-root filesystem, this tends to cause the install
	to fail.

>How-To-Repeat:
	Grab the kern.flp & msroot.flp images from a -CURRENT snapshot; copy
	them to appropriate media.  When you boot, it may be instructive to
	interrupt the boot sequence and specify "boot -v" (in order to get
	sysinstall debug information on vty2).

	Go through the install process.  At the Disk Label Editor, specify a
	modestly-sized root filesystem -- say, 160 MB or less.  Specify a
	reasonable (separate) filesystem for /usr, such as 2 GB.  You might
	specify a separate filesystem for /var, but the /usr one is the
	critical part, here.

	Select a distribution; for simplicity, I suggest "Developer" (not
	"X-Developer", as that requires a bit more interaction).  I declined
	the ports, as I was going to do that via CVSup anyhow.

	Affirm that you do, indeed, wish to Commit.  :-)

	A window is displayed, reading something on the order of

	Error mounting /mnt/dev/ad0s2f on /mnt/usr : No such file or directory

	Use Alt+F2 to see the debug messages.  Note that the first mention
	of ad0s2f we see is an attempt to do a "newfs".  See below for evidence
	that we should have seen that a mknod() call was issued; available
	evidence indicates that this was, in fact, not done.

>Fix:
	I haven't actually done this code (yet), but....  Looking at install.c,
	rev. 1.308, starting at line 953:


    /* Now buzz through the rest of the partitions and mount them too */
    devs = deviceFind(NULL, DEVICE_TYPE_DISK);
    for (i = 0; devs[i]; i++) {
	if (!devs[i]->enabled)
	    continue;

	disk = (Disk *)devs[i]->private;
	if (!disk->chunks) {
	    msgConfirm("No chunk list found for %s!", disk->name);
	    return DITEM_FAILURE | DITEM_RESTORE;
	}
	if (RunningAsInit && root && (root->newfs || upgrade)) {
	    Mkdir("/mnt/dev");
	    if (!Fake)
		MakeDevDisk(disk, "/mnt/dev");
	}
	else if (!RunningAsInit && !Fake)
	    MakeDevDisk(disk, "/dev");

	for (c1 = disk->chunks->part; c1; c1 = c1->next) {
	    if (c1->type == freebsd) {
		for (c2 = c1->part; c2; c2 = c2->next) {
		    if (c2->type == part && c2->subtype != FS_SWAP && c2->private_data) {
			PartInfo *tmp = (PartInfo *)c2->private_data;

			/* Already did root */
			if (c2 == rootdev)
			    continue;

			if (tmp->newfs && (!upgrade || !msgNoYes("You are upgrading - are you SURE you want to newfs /dev/%s?", c2->name)))
			    command_shell_add(tmp->mountpoint, "%s %s/dev/%s", tmp->newfs_cmd, RunningAsInit ? "/mnt" : "", c2->name);
			else
			    command_shell_add(tmp->mountpoint, "fsck -y %s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name);
			if (tmp->soft)
			    command_shell_add(tmp->mountpoint, "tunefs -n enable %s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name);
			command_func_add(tmp->mountpoint, Mount, c2->name);
		    }
		    else if (c2->type == part && c2->subtype == FS_SWAP) {
			char fname[80];
			int i;

			if (c2 == swapdev)
			    continue;
			sprintf(fname, "%s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name);
			i = (Fake || swapon(fname));
			if (!i) {
			    dialog_clear_norefresh();
			    msgNotify("Added %s as an additional swap device", fname);
			}
			else {
			    msgConfirm("Unable to add %s as a swap device: %s", fname, strerror(errno));
			}
		    }
		}
	    }
	    else if (c1->type == fat && c1->private_data && (root->newfs || upgrade)) {
		char name[FILENAME_MAX];

		sprintf(name, "%s/%s", RunningAsInit ? "/mnt" : "", ((PartInfo *)c1->private_data)->mountpoint);
		Mkdir(name);
	    }
	}
    }


	We see that there's a call to MakeDevDisk() for the root case, but
	not for the non-root case.  (Indeed:  there are a couple of them,
	for different situations.  And those 2 MakeDevDisk() calls are the
	only ones in /usr/src/usr.sbin/sysinstall/*.)  It's been quite a
	while since I actually programmed for a living, but that appears
	a tad suspect to me.  And note that the first things we try to do
	(in the non-root case) is a newfs command, which corresponds to
	the empirical evidence.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-qa 
Responsible-Changed-By: murray 
Responsible-Changed-When: Wed Mar 27 04:06:10 PST 2002 
Responsible-Changed-Why:  
This PR provides a thorough description of the problem.  Can anyone on 
the qa@ list provide (and test) a patch? 


http://www.freebsd.org/cgi/query-pr.cgi?pr=31306 
Responsible-Changed-From-To: freebsd-qa->qa 
Responsible-Changed-By: johan 
Responsible-Changed-When: Sat Aug 24 19:20:42 PDT 2002 
Responsible-Changed-Why:  
Use short names for mailing list to make searches    
using the web query form work with the shown responsible. 

This also makes open PRs show up in the summery mail. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=31306 
State-Changed-From-To: open->closed 
State-Changed-By: jhb 
State-Changed-When: Tue Nov 12 10:56:53 PST 2002 
State-Changed-Why:  
install's now work again on 5.0.  This was most likely an interaction between 
devfs, geom, and libdisk that has been fixed in the past few weeks. 

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