Date: Mon, 15 Oct 2001 17:02:22 -0700 (PDT) From: David Wolfskill <david@catwhisker.org> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/31306: sysinstall fails to create non-root partitions Message-ID: <200110160002.f9G02M500983@freebeast.catwhisker.org>
next in thread | raw e-mail | index | archive | help
>Number: 31306
>Category: bin
>Synopsis: sysinstall fails to create non-root partitions
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Oct 15 17:10:01 PDT 2001
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110160002.f9G02M500983>
