Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Feb 2003 23:36:37 +0100 (CET)
From:      Per Hedeland <per@hedeland.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        per@hedeland.org
Subject:   ports/48608: [PATCH] vmnet problem with emulators/vmware2 port
Message-ID:  <200302232236.h1NMabWV018466@pluto.hedeland.org>

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

>Number:         48608
>Category:       ports
>Synopsis:       [PATCH] vmnet problem with emulators/vmware2 port
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 23 14:40:03 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Per Hedeland
>Release:        FreeBSD 5.0-RELEASE i386
>Organization:
None
>Environment:
System: FreeBSD pluto.hedeland.org 5.0-RELEASE FreeBSD 5.0-RELEASE #6: Sun Feb 9 19:32:16 CET 2003 per@pluto.hedeland.org:/usr/src/sys/i386/compile/PLUTO i386

emulators/vmware2 port version 2.0.4.1142 as of 2003-02-23

>Description:
	The /usr/local/etc/rc.d/vmware.sh script aborts with:

        /usr/local/etc/rc.d/vmware.sh: cannot create /compat/linux/dev/vmnet1: Device not configured

	Subsequent attempt to start the vmware emulator fails with:

	Could not open /dev/vmnet1: No such device or address
	Failed to configure ethernet0

>How-To-Repeat:
	Install current vmware2-2.0.4.1142 on FreeBSD 5.0 installed
	before branching for RELENG_5_0_0. Try to start and run it.

>Fix:

	When originally looking into this problem, before the port
	updates on Feb 11-12, I arrived at the same "fix" that is in one
	of those updates: Make /compat/linux/dev/vmnet1 a symlink to
	/dev/vmnet1 - but didn't think this was the "right" fix to make,
	see below. The symlinking that is done in the Makefile in the
	current port still doesn't fix the problem on my FreeBSD
	5.0-RELEASE, installed off the CDs - it has OSVERSION 500043,
	while the symlink only happens for OSVERSION >= 500100.

	However... There are really two different problems here:

        1) The minor number for vmnet1 has changed 0x00010001 ->
	   0x00800001 - this happened before OSVERSION 500023.

	2) With devfs, it is necessary to open /dev/vmnet1 for the
           cloning.

	Now, I expect that it will be unusual to run FreeBSD 5.0 or
	later without devfs, but I assume it should be possible, so it
	doesn't seem appropriate to link the fix for 2) to a specific
	OSVERSION. Also it would be "nice" to not have to re-install the
	port on changing to/from usage of devfs, which suggests that 2)
	is best handled in the rc script. And of course, having the port
	first create /compat/linux/dev/vmnet1 with an incorrect minor
	number and then remove it again might be seen as "inelegant".:-)

	So, with the patch below /compat/linux/dev/vmnet1 will be
	created with the proper minor number, and if opening it in the
	rc script fails (which it will with devfs if the cloning hasn't
	been done already), the script will open /dev/vmnet1. (The
	previous code in the rc script will also work if the minor
	number is right, but will create a regular file in /dev when not
	using devfs - with the wrong minor number, the script aborts on
	the open of /compat/linux/dev/vmnet1.)

	If this patch isn't accepted, I'd suggest that at least the
	symlinking in the Makefile be done also for OSVERSION well
	before 500100 (unclear which though), and that the rc script
	changes are reverted since there is no need for the "double
	open" when /compat/linux/dev/vmnet1 is a symlink.

	By the way, I assume the PORTVERSION should be / should have
	been updated...


--- Makefile.ORIG	Sat Feb 22 03:07:02 2003
+++ ./Makefile	Sun Feb 23 22:35:09 2003
@@ -67,11 +67,18 @@
 .include "${WRKDIRPREFIX}${.CURDIR}/work/Makefile.inc.net"
 .endif
 
+.if ${OSVERSION} < 500023
+VMNET1_MINOR=	0x00010001
+.else
+VMNET1_MINOR=	0x00800001
+.endif
+
 SCRIPTS_ENV+=	LINUXBASE="${LINUXBASE}" \
 		VMNET_HOST_IP="${VMNET_HOST_IP}" \
-		VMNET_NETMASK="${VMNET_NETMASK}"
+		VMNET_NETMASK="${VMNET_NETMASK}" \
+		VMNET1_MINOR="${VMNET1_MINOR}"
 MAKE_ARGS=	KMODDIR="${VMDIR}/lib/modules"
-PLIST_SUB=	LINUXBASE="${LINUXBASE}"
+PLIST_SUB=	LINUXBASE="${LINUXBASE}" VMNET1_MINOR="${VMNET1_MINOR}"
 
 post-extract:
 .for m in ${MODULES}
@@ -175,10 +182,6 @@
 
 post-install:
 	${LN} -sf ${PREFIX}/etc/vmware /etc/
-.if ${OSVERSION} >= 500100
-	${RM} -f ${LINUXBASE}/dev/vmnet1
-	${LN} -sf /dev/vmnet1 ${LINUXBASE}/dev/vmnet1
-.endif
 	@${CAT} ${PKGMESSAGE}
 
 .include <bsd.port.post.mk>
--- files/vmware.sh.ORIG	Thu Feb 13 03:06:49 2003
+++ files/vmware.sh	Sun Feb 23 22:31:03 2003
@@ -53,8 +53,8 @@
 		echo "Your VMware installation seems broken.  Please reinstall VMware port." >&2
 		exit 255
 	fi
-    	echo -n > /dev/vmnet1 2>&1 || true
-	echo -n > $dev_vmnet1 2>&1
+    	(echo -n > $dev_vmnet1) 2>/dev/null || \
+	    echo -n > /dev/vmnet1 2>&1
 	ifconfig vmnet1 $host_ip netmask $netmask
 	if [ X$bridged = XYES ]; then
 	    kldstat -v | grep netgraph >/dev/null || kldload netgraph.ko
--- pkg-plist.ORIG	Thu Feb 22 22:10:34 2001
+++ ./pkg-plist	Sun Feb 23 22:08:02 2003
@@ -121,7 +121,7 @@
 @exec mknod %%LINUXBASE%%/dev/hdb b 0 0x0001000a
 @exec ln -sf %D/etc/vmware /etc/
 @exec mknod %%LINUXBASE%%/dev/vmmon c 200 0
-@exec mknod %%LINUXBASE%%/dev/vmnet1 c 149 65537
+@exec mknod %%LINUXBASE%%/dev/vmnet1 c 149 %%VMNET1_MINOR%%
 @unexec rm -f /etc/vmware %%LINUXBASE%%/dev/vmmon %%LINUXBASE%%/dev/vmnet1 %%LINUXBASE%%/bin/df %%LINUXBASE%%/dev/tty[0-9]* %%LINUXBASE%%/dev/hd? %%LINUXBASE%%/dev/null
 @dirrm etc/vmware
 @dirrm lib/vmware/bin
--- scripts/pre-install.ORIG	Fri Sep 22 19:22:24 2000
+++ scripts/pre-install	Sun Feb 23 22:01:40 2003
@@ -18,7 +18,7 @@
 mknod ${linux_dev}/null c 2 2
 chmod 666 ${linux_dev}/null
 echo Creating vmnet1 node
-mknod /compat/linux/dev/vmnet1 c 149 65537
+mknod /compat/linux/dev/vmnet1 c 149 ${VMNET1_MINOR}
 echo Creating $linux_dev/hd\?
 mknod ${linux_dev}/hda b 0 0x00010002
 mknod ${linux_dev}/hdb b 0 0x0001000a
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports-bugs" in the body of the message




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