Subject: Re: The smallest multi-user system
To: <>
From: Brian Rose <lists@brianrose.net>
List: current-users
Date: 08/14/2003 23:26:52
Jeremy C. Reed wrote:
> In /usr/src/sbin/init/init.c:
>
> if ((session_db = dbopen(NULL, O_RDWR, 0, DB_HASH, NULL)) == 0) {
> emergency("session database open: %m");
> return (1);
> }
>
> (Then when that "start_session_db()" fails, init does the single_user
> instead of multi_user.)
Should I see the emergency() message on the console (i386)?
>
> Again, I don't know if dbopen(NULL, ...) uses memory or disk for the
> temporary database. But now, I think I am wrong, because looking at
> src/lib/libc/db/hash/hash.c doesn't indicate any opening of files with it
> is NULL.
The man page has this to say...
Dbopen opens file for reading and/or writing. Files never
intended to be preserved on disk may be created by setting
the file parameter to NULL.
Is it possible that init is failing elsewhere?
I just noticed the function mfs_dev() which is called if MFS_DEV_IF_NO_CONSOLE is defined, which it is.
/* Mount an mfs over /dev so we can create devices */
switch ((pid = fork())) {
case 0:
(void)execl("/sbin/mount_mfs", "mount_mfs", "-i", "192",
"-s", "768", "-b", "4096", "-f", "512", "swap", "/dev",
NULL);
_exit(1);
/*NOTREACHED*/
case -1:
return(-1);
default:
if (waitpid(pid, &status, 0) == -1)
return(-1);
if (status != 0)
return(-1);
break;
}
Please correct my line of thinking...
init() forks to mount the ramdrive. The child process would execute and then exit with a return code of 1. The parent process would get this on the waitpid line and return -1 and status would be set to 1, which would force the system into single user mode due to the following code...
if (mfs_dev() == -1)
requested_transition = single_user;
It looks like all systems with a ramdrive would always go to single user. Correct? Has anyone made a multiuser system that boots off of a ramdrive?
Any more ideas?
Aside...
While looking for the sources for mount_mfs (there are none in /usr/src/sbin) I found the source for the man page is in /usr/src/sbin/newfs. I also noticed that the mount_mfs file size is exactly the same size as newfs. The Makefile for newfs has the following line...
LINKS= ${BINDIR}/newfs ${BINDIR}/mount_mfs
It looks like newfs and mount_mfs are one in the same. Anyway, I added them to my system and I still fall into single-user mode.
Note: I can type exit at the prompt which brings me to the login prompt where I can login normally.
--
Brian