Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Mar 2003 15:51:06 -0800
From:      Sean Chittenden <seanc@FreeBSD.org>
To:        Robert Watson <rwatson@FreeBSD.org>
Cc:        current@FreeBSD.org
Subject:   Re: init not loading?  why?
Message-ID:  <20030328235106.GA10799@perrin.int.nxad.com>
In-Reply-To: <Pine.NEB.3.96L.1030328174335.10348D-100000@fledge.watson.org>
References:  <20030328215316.GA8340@perrin.int.nxad.com> <Pine.NEB.3.96L.1030328174335.10348D-100000@fledge.watson.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Qxx1br4bt0+wmkIi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

> > Ah!  Figured it out after reading through init's src: /dev didn't
> > exist therefore the machine wouldn't start.  No good.  I may find
> > a place to stick this got'cha in the docs or add an mkdir() call
> > to init.
> 
> mkdir(2) on / is not going to work if / is readonly.  The kernel
> actually tries to do a vop_mkdir() already, I think.  The eventual
> solution is probably a rootfs (blaim mux).

Well, I haven't tested this, but I think you're right that it's
nmount() that's failing and the lack of a check on it's return value.
I haven't tested this beyond compiling it, but I suspect it'll work
and fix this corner case.  -sc

-- 
Sean Chittenden

--Qxx1br4bt0+wmkIi
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch

Index: init.c
===================================================================
RCS file: /home/ncvs/src/sbin/init/init.c,v
retrieving revision 1.55
diff -u -r1.55 init.c
--- init.c	17 Dec 2002 21:23:36 -0000	1.55
+++ init.c	28 Mar 2003 23:48:07 -0000
@@ -304,7 +304,10 @@
 			iov[3].iov_base = _PATH_DEV;
 			iov[3].iov_len = sizeof(_PATH_DEV);
 		}
-		nmount(iov, 4, 0);
+		if (nmount(iov, 4, 0) < 0) {
+			perror("nmount failed (" _PATH_DEV ")");
+			_exit(1);
+		}
 		if (s != NULL)
 			free(s);
 	}

--Qxx1br4bt0+wmkIi--



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