From nobody@FreeBSD.org  Thu Jan 14 17:58:25 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 43811106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 14 Jan 2010 17:58:25 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 18B598FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 14 Jan 2010 17:58:25 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o0EHwOmk029477
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 14 Jan 2010 17:58:24 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o0EHwO2R029476;
	Thu, 14 Jan 2010 17:58:24 GMT
	(envelope-from nobody)
Message-Id: <201001141758.o0EHwO2R029476@www.freebsd.org>
Date: Thu, 14 Jan 2010 17:58:24 GMT
From: Scot Hetzel <swhetzel@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] emulators/linux_base-* packages fails to install when linux.ko is not installed
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         142837
>Category:       ports
>Synopsis:       [patch] emulators/linux_base-* packages fails to install when linux.ko is not installed
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-emulation
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 14 18:00:04 UTC 2010
>Closed-Date:    
>Last-Modified:  Fri Jan 22 00:10:05 UTC 2010
>Originator:     Scot Hetzel
>Release:        8.0-Stable
>Organization:
>Environment:
FreeBSD dv8t01 8.0-STABLE FreeBSD 8.0-STABLE #10 r201599M: Tue Jan  5 14:29:56 CST 2010     swhetzel@dv8t01:/usr/obj/usr/src/8-stable/sys/GENERIC  amd64

>Description:
When the linux_base* ports are installed as a package, they attempt to check the compat.linux.osrelease sysctl variable to make sure that is is 2.6.16 or greater, but when the linux.ko module is not loaded this variable doesn't exist.

This causes the package to fail to install, with the error 'linuxulator is not (kld)loaded, exiting'.

The pkg-install PRE-INSTALL target does have the ability to kldload the linux.ko module, but it occurs after the check for the sysctl variable compat.linux.osrelease.
>How-To-Repeat:
#pkg_add linux_base-f10-10_2
sysctl: unknown oid 'compat.linux.osrelease'
linuxulator is not (kld)loaded, exiting
pkg_add: install script returned error status

>Fix:
The attached patch applies to the linux_base-f7, 8, 9 and 10 ports and the linux_base-fc6 ports.

Note: linux_base-fc4 is not affected.

Patch attached with submission follows:

Index: pkg-install
===================================================================
RCS file: /home/ncvs/ports/emulators/linux_base-f10/pkg-install,v
retrieving revision 1.13
diff -u -r1.13 pkg-install
--- pkg-install	12 May 2009 14:53:58 -0000	1.13
+++ pkg-install	14 Jan 2010 17:38:37 -0000
@@ -3,14 +3,6 @@
 
 case "$2" in
 PRE-INSTALL)
-	if [ "`/sbin/sysctl -n compat.linux.osrelease`"x = "x" ]; then
-		echo 'linuxulator is not (kld)loaded, exiting'
-		exit 1
-	fi
-	if [ "`/sbin/sysctl -n compat.linux.osrelease`" = "2.4.2" ]; then
-		echo 'compat.linux.osrelease: 2.4.2 is not supported, exiting'
-		exit 1
-	fi
 	if [ -z "`kldstat -v | grep -E 'linux(aout|elf)'`" ]; then
 		echo 'Linux mode is not enabled.'
 		echo 'Loading linux kernel module now...'
@@ -20,6 +12,14 @@
 			exit 1
 		fi
 	fi
+	if [ "`/sbin/sysctl -n compat.linux.osrelease`"x = "x" ]; then
+		echo 'linuxulator is not (kld)loaded, exiting'
+		exit 1
+	fi
+	if [ "`/sbin/sysctl -n compat.linux.osrelease`" = "2.4.2" ]; then
+		echo 'compat.linux.osrelease: 2.4.2 is not supported, exiting'
+		exit 1
+	fi
 	;;
 POST-INSTALL)
 	if [ -z "`grep ^linproc /etc/fstab`" ]; then


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->freebsd-emulation 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Thu Jan 21 20:52:54 UTC 2010 
Responsible-Changed-Why:  
See if the people here know a good way around this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=142837 

From: Boris Samorodov <bsam@ipt.ru>
To: bug-followup@FreeBSD.org,swhetzel@gmail.com
Cc:  
Subject: Re: ports/142837: [patch] emulators/linux_base-* packages fails to install when linux.ko is not installed
Date: Fri, 22 Jan 2010 01:54:12 +0300

 Scot, thanks for the patch. Really there is no consystency. ;-)
 However, I'm not sure if the proposed behavior is desirable.
 I.e. if a port loads kernel module but the system is not configured
 to do it at next reboot, then a user may got very surprised. Esp.
 if previous uptime was several months...
 
 -- 
 WBR, Boris Samorodov (bsam)
 Research Engineer, http://www.ipt.ru Telephone & Internet SP
 FreeBSD Committer, http://www.FreeBSD.org The Power To Serve

From: Scot Hetzel <swhetzel@gmail.com>
To: Boris Samorodov <bsam@ipt.ru>
Cc: bug-followup@freebsd.org
Subject: Re: ports/142837: [patch] emulators/linux_base-* packages fails to 
	install when linux.ko is not installed
Date: Thu, 21 Jan 2010 18:08:44 -0600

 On Thu, Jan 21, 2010 at 4:54 PM, Boris Samorodov <bsam@ipt.ru> wrote:
 > Scot, thanks for the patch. Really there is no consystency. ;-)
 > However, I'm not sure if the proposed behavior is desirable.
 > I.e. if a port loads kernel module but the system is not configured
 > to do it at next reboot, then a user may got very surprised. Esp.
 > if previous uptime was several months...
 >
 The pkg-message informs the user to add linux_enable to rc.conf to
 enable Linux mode permanetly.  If they don't pay attention to the
 pkg-message it is their fault for not enabling it. ;-)
 
 Scot
>Unformatted:
