[comp.sys.ibm.pc] MKS and PC-NFS:the final chapter

keithe@tekgvs.GVS.TEK.COM (Keith Ericson) (10/05/88)

[notice that the Subject is MKS _and_ PC-NFS instead of
 MKS vs. PC-NFS as it has been in the past.]

With some help from Gerry Wheeler at Mortice Kern Systems (MKS) I've
been able to get MKS and PC-NFS to work very nicely. But it wasn't
easy...

But first, you may need to know that I'm running MKS on an Intel 386AT
(known in some circles as a "301" motherboard) with a CDC WREN IV disk
drive (SCSI, 280 Megabytes), 4+ megabytes RAM, high-density 5-1/4" and
a 3-1/2", 720kbyte diskette drives. I have a Micom-Interlan NI5010
connecting me to a "regular" (not "thin") Ethernet system. I don't
know if that makes any difference as to how all this stuff works; I
doubt it. The remote machine is a VAX-11/785 running BSD 4.3 UNIX.

The software is MKS Toolkit Version 2.3b and PC-NFS Version 3.00.
With this version of the Toolkit your CONFIG.SYS file (see example,
below) sets SHELL=\etc\init.exe which initializes everything (hence the
catchy name, right? :-) via a /etc/inittab file, performing installation
of TSRs and (repeated) invocation of a login process. Login then starts
the command processor, a very capable KSH work-alike. Upon user logout
the login process is respawned (vi /etc/inittab).

PC-NFS requires three files be included in CONFIG.SYS (again, see the
example, below); these, by the way, consume nearly 75kbytes (ouch!) of
memory. To allow printer redirection (through the Ethernet connection to
a remote printer) a TSR called "prt.exe" is required. Activating the
network facility itself requires several invocations of the "net"
command with various options. Where these functions are started in the
bootup procedure is critical. I've found only _one_ specific scheme that
works. (Naturally: once I finally got it working why would I jeopardize 
a running system with more experiments? :-)

There are several (OK, four) places in which "start-up" functions can
be invoked: /etc/inittab, /etc/rc.ksh, /etc/profile.ksh and in
$HOME/profile.ksh.

First of all, "nfs/prt \*" (the PC-NFS remote printer redirector TSR)
must go into inittab. Anywhere else (/etc/rc.ksh, /etc/profile.ksh,
$HOME/profile.ksh) and the result is that the next command in that
file will result in something like

	sh[10]: sh: insufficient memory

repeated on the screen ad infinitum: ResetButton time. (For as often
as I've seen that error message you'd think I'd have it memorized by
now :-)

Secondly, where to put the "nfs/net start rdr hostname \*" took me a
long time (and many, many reboots - thank goodness for the hardware
reset button!) to figure out. It seems reasonable to put the "net"
command in the inittab file, too, but if it is written, for example,
as

	nt1;2;wait;c:/nfs/net.exe start rdr hostname \*

the arguments don't get passed to "net" and the next "net" command, such
as "net name username \*" is answered with "Unknown host. `net start rdr
hostname *' must be issued." So the next attempt was with the env
command:

  nt2;2;wait;c:/bin/env - TZ=PST8PDT c:/nfs/net.exe start rdr hostname *

but this doesn't work either. As it turns out, installing a "net
start..." command at this point (/etc/inittab) in the boot-up process
won't work anyway because later on, when the user does his personal
network initialization ("net name..." and "net use...") the PCNFS
software will end up with a stack overflow error. The error message
comes from somewhere within the PC-NFS software, and it is a "hung-
system" (CTL-ALT-DEL or ResetButton) situation. (I did get the "net
start..." to execute from inittab by calling it via a shell script:

   nt3;2;wait;c:/bin/env - TZ=PST8PDT c:/bin/sh.exe c:/etc/net_start

but for the reason above - stack overflow errors - this isn't the way
to do it.)

Placing the "net start rdr hostname \*" line in /etc/rc.ksh fails for
the same stack overlow error mentioned above.

So the next attepmt is to merely place the "net start..." line in either
/etc/profile or in $HOME/profile. Either location has the same effect:
everything works fine - you can mount remonte drives and printers,
use telnet, etc, etc - until you log out and then back in again to the
MKS login/shell system, and whether or not you unmount the drives
prior to logout. Upon (re) logging in, the "net" commands invoked in
the profile(s) try to reinstall the networking software but result in
an error message something like "nfs error -- unable to get net info."
The only way out is a reboot (hard or soft - I don't remember which).

So, the "net start rdr hostname \*" command can't go in inittab, rc.ksh,
or any profile.ksh. What to do???

Trickery...

Instead of actually doing a "net start rdr..." in /etc/inittab, I
installed a "net blip on" command there. This appears to be a NO OP,
except that this first "net" command results in the PC-NFS INSTALLED
nessage to appear, meaning that the network software has been installed,
it just doesn't know the particulars about host name, remote machine
name, or anything else! That's left for rc.ksh, where the "net start
hostname \*" command is now placed! Then, $HOME/profile.ksh takes care
of performing, either directly or indirectly, the "net name..." and
"net use..." commands. No stack overflows, and no logout/login problems,
either. The "net blip on" command is called via an "env" command to
provide the TZ environment variable to it, else it complains, and
assumes a value. (It always selected the correct one, at least when
it happend to me, and I don't know how it knew...). 

So there it is - 2-1/2 days of fairly concentrated effort. But worth it
to have MKS and PC-NFS working together. Hopefully this will save you
the time and effort required to get MKS and PC-NFS working together.
And if someone replies with "well, on page XX of the manual you'll find
exactly that..." I'll shoot myself (my, aren't we being dramatic) since
I poured over those FM's and never did find the needed information.

For completeness, here are my MKS and PC-NFS system files - config.sys,
/etc/inittab, /etc/rc.ksh, /etc/profile.ksh, $HOME/profile.ksh and the
files called by $HOME/profile.ksh, disks.ksh and printers.ksh (edited
slightly for generality).

And again, thanks to Gerry Wheeler of MKS for getting me on the right
track.

CONFIG.SYS:
device=c:nansi.sys
files=30
buffers=25
break=on
device=c:\nfs\pcnfs.sys
device=c:\nfs\sockdrv.sys
device=c:\nfs\ni5010.sys /i5
lastdrive=V
device=ramdrive.sys 1536 256 128 /e
shell=c:\etc\init.exe

/ETC/INITTAB
lp;2;wait;c:/nfs/prt.exe \*
nt1;2;wait;c:/bin/env.exe - TZ=PST0PDT c:/nfs/net.exe blip on
rc;2;wait;c:/bin/sh.exe etc/rc
co;34;respawn;c:/bin/login.exe

/ETC/RC.KSH
echo '/ETC/RC...'
c:/dos/diskjoin d: c:\usr2	#
c:/dos/diskjoin e: c:\src	#  I use the dos "join" command
c:/dos/diskjoin f: c:\games	#  renamed as "diskjoin" so as not
c:/dos/diskjoin g: c:\wp50	#  to collide with the MKS "join"
c:/dos/diskjoin h: c:\lang 	#  command. With 8 full sized
c:/dos/diskjoin i: c:\graphics	#  (32+Megabyte) partitions it's
c:/dos/diskjoin j: c:\temp	#  the only way I can keep track
c:/dos/diskjoin k: c:\scratch	#  of them all.
c:/dos/diskjoin w: c:\tmp		#
export TZ=PST8PDT			#  ...and here's where PC-NFS
c:/nfs/net start rdr <local-name> \* 	#  is actually started

/ETC/PROFILE.KSH
echo '/ETC/PROFILE...'
c:/bin/switch -
export COMSPEC=c:/command.com
export GLOB=c:/etc/glob.exe
export HOSTS=c:/ni5010 export
PROCOMM=c:/term_emu/procomm/
export PS1="<local-name>> "
export TMPDIR=c:/tmp

$HOME/PROFILE.KSH
echo '$HOME/PROFILE...'
export PATH='c:/bin;c:/usr/bin/;c:/dos;c:/nfs;.'
export EDITOR=c:/bin/vi
export FCEDIT=c:/bin/vi
export VISUAL=c:/bin/vi
trap 'c:/usr/bin/netkill; exit' EXIT
netstart
disks
printers

$HOME/NETSTART.KSH
read password?"Password: [8m" ; print [0m
echo '$HOME/NETSTART...'
echo '  starting network...'
net pcnfsd <authentication-server>
echo "  logging in to <hostname> as $LOGNAME..."
c:/nfs/net name $LOGNAME ${password}
unset password
echo '  establishing gateway...'
net route <gateway-machine>

$HOME/DISKS.KSH

echo '$HOME/DISKS...'
echo '  Connecting <file-server>:<filesystem1> as l:
net use l: \\\\<file-server>\\<filesystem1>
echo '  Connecting <file-server>:<filesystem2> as m:
net use m: \\\\<file-server>\\<filesystem2>

$HOME/PRINTERS.KSH

echo '$HOME/PRINTERS...'
echo '  Connecting <print-server>:<printer-name> as lpt3:
net use lpt3: \\\\<print-server>\\<printer-name>


keith

Keith Ericson  at TekLabs (resident factious factotum)
Tektronix, PO 500, MS 58-383   Beaverton OR 97077    (503)627-6042
UUCP:	[uunet|ucbvax|decvax|hplabs]!tektronix!tekgvs!keithe
ARPA:	keithe%tekgvs.TEK.COM@RELAY.CS.NET
CSNet:	keithe@tekgvs.TEK.COM

tneff@dasys1.UUCP (Tom Neff) (10/10/88)

I'm sorry Keith Erickson had to go through so much hassle getting his
NFS system up and running under MKS.  I didn't respond to the original
inquiry because I assumed his problems had to do with some arcane
interaction between the networked environment and MKS.  Now it looks as
though it was just the usual mixup about where you put your TSR's and
how you get the parameters passed in one piece.

As Keith has already discovered, and as the manual makes clear, you
don't launch TSRs from the Korn shell, it just messes up MKS's memory
management.  You need to launch them from something else first, then
invoke KSH.  There are two choices: INIT.EXE and COMMAND.COM.  The MKS
guide lists four basic "configurations," with the fourth and most
powerful one setting SHELL=\etc\init.exe in CONFIG.SYS, then using
/etc/inittab to launch TSRs and so forth before invoking /etc/login.
I used to do it this way but two problems arose: (a) some TSRs balk
at being spawned by something other than COMMAND.COM (usually these
are "enhancers" that don't draw fine distinctions between COMMAND.COM and
the other DOS modules), and some need parameters set up for them that
/etc/inittab made difficult.

I came up with a very simple workaround.  I set SHELL=COMMAND.COM in
CONFIG.SYS, and create an AUTOEXEC.BAT which loads my TSRs (all of them,
for simplicity's sake, rather than just the balky ones), then finishes
up by launching \ETC\INIT.EXE which takes over and does the other
stuff.  My /etc/inittab just has the minimum needed to respawn /etc/login.

The net cost to this approach is a few K for the permanent resident
copy of COMMAND.COM (although as I say, some TSRs really seem to want
it there, so it's a very bearable cost).  Actually the way I do it
right now, I am probably wasting a handle keeping that AUTOEXEC.BAT open
forever, but I could save the handle by using STACKEY "\etc\init" CR
as the last line if I cared deeply.

The net benefit is that all of the nitty gritty details of setting up
things like NFS can now be done just as it says in the product installation
guide, rather than having to be translated into MKS-ese by a wizard
first.  I'm not knocking MKS at all here, that's just a fact of life.

Here's hoping Gerry and the gang knock one out for OS/2, so I can stop
clenching my teeth at 80k+ for every copy of ksh!! :-)
-- 
Tom Neff			UUCP: ...!cmcl2!phri!dasys1!tneff
	"None of your toys	CIS: 76556,2536	       MCI: TNEFF
	 will function..."	GEnie: TOMNEFF	       BIX: t.neff (no kidding)