Subject: kern/3669: diskless boot bug
To: None <gnats-bugs@gnats.netbsd.org>
From: maximum entropy <entropy@tanstaafl.bernstein.com>
List: netbsd-bugs
Date: 05/25/1997 02:22:38
>Number:         3669
>Category:       kern
>Synopsis:       In a diskless environment the kernel will prompt for root device unnecessarily
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 24 23:35:00 1997
>Last-Modified:
>Originator:     maximum entropy
>Organization:
none
	
>Release:        <NetBSD-current source date> 19970523
>Environment:
i386 with 3c509
	
System: NetBSD tanstaafl.bernstein.com 1.2E NetBSD 1.2E (CA466NFS) #4: Fri May 23 07:11:40 EDT 1997 entropy@tardis.bernstein.com:/usr/src/sys/arch/i386/compile/CA466NFS i386


>Description:
	
In a "true" diskless boot environment (e.g. a diskless kernel loaded from the 
network as opposed to a diskless kernel loaded from floppy), the kernel
will pause during the boot and ask for the device for the root filesystem.
>How-To-Repeat:
	
Boot a diskless i386 system using "netboot.com" (libsa version).  I believe
this isn't an i386-specific problem but it's possible that other ports don't
see the symptoms for various reasons.  In any case, the kernel is clearly
performing these operations in the wrong order -- it decides that it needs
to prompt for a root device because rootspec is NULL, then determines an
appropriate rootspec, then prompts the user for a rootspec.

>Fix:
	

This patch delays setting RB_ASKNAME until the code that sets rootspec for a
network device has executed.

--- /sys/kern/kern_subr.c-CURRENT	Thu Mar 27 07:21:18 1997
+++ /sys/kern/kern_subr.c	Fri May 23 07:10:25 1997
@@ -399,13 +399,6 @@
 #endif
 
 	/*
-	 * If wildcarded root and we the boot device wasn't determined,
-	 * ask the user.
-	 */
-	if (rootspec == NULL && bootdv == NULL)
-		boothowto |= RB_ASKNAME;
-
-	/*
 	 * If NFS is specified as the file system, and we found
 	 * a DV_DISK boot device (or no boot device at all), then
 	 * find a reasonable network interface for "rootspec".
@@ -433,6 +426,13 @@
 			rootspec = (const char *)ifp->if_xname;
 		}
 	}
+
+	/*
+	 * If wildcarded root and the boot device wasn't determined,
+	 * ask the user.
+	 */
+	if (rootspec == NULL && bootdv == NULL)
+		boothowto |= RB_ASKNAME;
 
  top:
 	if (boothowto & RB_ASKNAME) {



>Audit-Trail:
>Unformatted: