Subject: Re: The smallest multi-user system
To: NetBSD - current-users <current-users@netbsd.org>
From: Brian Rose <lists@brianrose.net>
List: current-users
Date: 08/15/2003 14:03:42
Allen Briggs wrote:

> Put the following in your kernel configuration file to change that:
> 
> options 	MEMORY_RBFLAGS=0        # don't force single-user
> 
> -allen
> 

I found the following code (listed below) that indicates memory disks always go to single user. It does not seem to check the MEMORY_RBFLAGS flag. My system is a 1.6.0 build. Do I need to update?

Anyway I put in some changes (preceded by >>'s) and the system is working - sort of.

The system exits and runs the /etc/rc script and then drops to a login prompt. The login prompt, however does not say "login:". The string seems to be corrupted because there is an 'l', 'o', then a t-like character, 'i', then a sigma (or rounded e character), followed by a colon and then an accented 'a'.

When I enter the username and press ENTER, it echoes the username, followed by an accented 'i'. The cariage return produces a linefeed only, so the "Password:" prompt (which displays normally otherwise) is below the accented 'i' after the username. After entering the password,  I am given the banner and then the login prompt.

This looks like the work of an ill-initialized terminal. I'm guessing that it is the 'ttyflags -a' call in /etc/rc.d/ttys file.

The last problem (for now) that I notice is that the filesystem is still read-only. This looks like it is taken care of with a 'mount -a' in the /etc/rc.d/mountall file.

The memory disk code
====================

in sys/dev/md.c

    #ifdef	MEMORY_DISK_HOOKS
	/* Call the open hook to allow loading the device. */
	md_open_hook(unit, &sc->sc_md);
    #endif


in sys/dev/md_root.c
    /*
     * This is called during open (i.e. mountroot)
     */
>>  #ifndef MEMORY_RBFLAGS
>>  #define MEMORY_RBFLAGS RB_SINGLE
>>  #endif
    void
    md_open_hook(int unit, struct md_conf *md)
    {
>>      //            ............................... added code
>>      if (unit == 0 && (MEMORY_RBFLAGS & RB_SINGLE) ) {
		/* The root ramdisk only works single-user. */
		boothowto |= RB_SINGLE;
	}
    }