Subject: install/8745: nfs install fails when distribution directory is not remote export point.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <bsh@grotto.iijnet.or.jp>
List: netbsd-bugs
Date: 11/04/1999 08:24:58
>Number:         8745
>Category:       install
>Synopsis:       nfs install fails when distribution directory is not remote export point.
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    install-manager (NetBSD system installation bug manager)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Nov  4 08:24:01 1999
>Last-Modified:
>Originator:     Hiro Bessho
>Organization:
Not organized
>Release:        NetBSD 1.4K i386
>Environment:
NetBSD kamasu.grotto.iijnet.or.jp 1.4K NetBSD 1.4K (KAMASU) #3: Mon Oct 11 02:55:27 JST 1999     bsh@kamasu.grotto.iijnet.or.jp:/usr/src/netbsd/sys/arch/i386/compile/KAMASU i386


>Description:
In installation via nfs, sysinst asks user remote hostname and directory
where distribution tar balls live, then mounts host:directory.  This is ok
if either the directory is exact remote exported point, or the directory
is exported with -alldirs option.  Sysinst fails to mount when the 
distribution directory is some levels down under exported directory.

>How-To-Repeat:
Make a directory on nfs server, say /usr/distrib/foo/bar, and copy
distribution sets into it.  Export /usr/distrib from the server without
-alldirs option.  Then try to install from this directory via nfs.
>Fix:
Here is a patch to add a new item to nfs menu for user to enter
remote file system on nfs server.

An alternative fix is to let sysinst find a valid mount point by try and error.

cvs diff: Diffing .
Index: defs.h
===================================================================
RCS file: /usr/cvs/netbsd/distrib/utils/sysinst/defs.h,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 defs.h
--- 1.1.1.3	1999/08/27 03:36:14
+++ defs.h	1999/11/04 15:19:41
@@ -184,6 +184,7 @@
 
 EXTERN char nfs_host[STRSIZE] INIT("");
 EXTERN char nfs_dir[STRSIZE] INIT("");
+EXTERN char nfs_remote_fs[STRSIZE] INIT("");
 
 EXTERN char cdrom_dev[SSTRSIZE] INIT("cd0");
 EXTERN char cdrom_dir[STRSIZE] INIT("/");
Index: menus.mi.en
===================================================================
RCS file: /usr/cvs/netbsd/distrib/utils/sysinst/menus.mi.en,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 menus.mi.en
--- 1.1.1.1	1999/08/26 16:11:13
+++ menus.mi.en	1999/11/04 15:20:46
@@ -243,9 +243,11 @@
 
 menu nfssource, title "Change";
 	display action
-		{ msg_display (MSG_nfssource, nfs_host, nfs_dir); };
+		{ msg_display (MSG_nfssource, nfs_host, nfs_remote_fs, nfs_dir); };
 	option "Host", action
 		{ msg_prompt (MSG_host, NULL, nfs_host, 255); };
+	option "Remote file system", action
+		{ msg_prompt (MSG_remotefs, NULL, nfs_remote_fs, 255); };
 	option "Directory", action
 		{ msg_prompt (MSG_dir, NULL, nfs_dir, 255); };
 	option "Continue", exit;
Index: msg.mi.en
===================================================================
RCS file: /usr/cvs/netbsd/distrib/utils/sysinst/msg.mi.en,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 msg.mi.en
--- 1.1.1.2	1999/08/27 03:36:16
+++ msg.mi.en	1999/11/04 14:52:11
@@ -381,6 +381,9 @@
 message dir
 {directory}
 
+message remotefs
+{remote file system}
+
 message user
 {user}
 
@@ -393,12 +396,18 @@
 message dev
 {device}
 
+/* Note that a space after %s is important in the next message.
+   a space followed by \n causes line break.
+ */
+
 message nfssource
-{Enter the nfs host and server directory where the distribution is
-located.  Remember, the directory should contain the .tgz files and
-must be nfs mountable.
 
-host:		%s
+{Enter the nfs host, remote file system and relative path to server
+directory where the distribution is located.  Remember, the directory
+should contain the .tgz files and must be nfs mountable.
+
+host:		%s 
+remote fs:	%s 
 directory:	%s
 }
 
Index: net.c
===================================================================
RCS file: /usr/cvs/netbsd/distrib/utils/sysinst/net.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 net.c
--- 1.1.1.3	1999/09/07 17:56:45
+++ net.c	1999/11/04 15:21:07
@@ -562,8 +562,8 @@
 	/* Mount it */
 	if (run_prog(0, 0, NULL, 
 	    "/sbin/mount -r -o -i,-r=1024 -t nfs %s:%s /mnt2",
-	    nfs_host, nfs_dir)) {
-		msg_display(MSG_nfsbadmount, nfs_host, nfs_dir);
+	    nfs_host, nfs_remote_fs)) {
+		msg_display(MSG_nfsbadmount, nfs_host, nfs_remote_fs);
 		process_menu(MENU_nfsbadmount);
 		if (!yesno)
 			return (0);
@@ -571,10 +571,18 @@
 			goto again;
 	}
 
+	if( nfs_dir[0] )
+		snprintf(ext_dir, sizeof ext_dir, "/mnt2/%s", nfs_dir );
+	else 
+		strcpy(ext_dir, "/mnt2");
+
 	/* Verify distribution files exist.  */
-	if (distribution_sets_exist_p("/mnt2") == 0) {
-		msg_display(MSG_badsetdir, "/mnt2");
+	if (distribution_sets_exist_p(ext_dir) == 0) {
+		msg_display(MSG_badsetdir, ext_dir);
 		process_menu (MENU_nfsbadmount);
+
+		ext_dir[0] = '\0';
+
 		if (!yesno)
 			return (0);
 		if (!ignorerror)
@@ -582,7 +590,6 @@
 	}
 
 	/* return location, don't clean... */
-	strcpy(ext_dir, "/mnt2");
 	clean_dist_dir = 0;
 	mnt2_mounted = 1;
 	return 1;


>Audit-Trail:
>Unformatted: