From owner-freebsd-bugs@FreeBSD.ORG Fri Feb 8 22:30:01 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B214F16A46B for ; Fri, 8 Feb 2008 22:30:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8CB4E13C457 for ; Fri, 8 Feb 2008 22:30:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m18MU1oi027494 for ; Fri, 8 Feb 2008 22:30:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m18MU1cE027491; Fri, 8 Feb 2008 22:30:01 GMT (envelope-from gnats) Resent-Date: Fri, 8 Feb 2008 22:30:01 GMT Resent-Message-Id: <200802082230.m18MU1cE027491@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Fabian Thorns Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 368EB16A418 for ; Fri, 8 Feb 2008 22:23:01 +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 20EAD13C45E for ; Fri, 8 Feb 2008 22:23:01 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m18MKqg1022175 for ; Fri, 8 Feb 2008 22:20:52 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m18MKqsH022174; Fri, 8 Feb 2008 22:20:52 GMT (envelope-from nobody) Message-Id: <200802082220.m18MKqsH022174@www.freebsd.org> Date: Fri, 8 Feb 2008 22:20:52 GMT From: Fabian Thorns To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: conf/120431: devfs.rules are not initialized under certain (default) circumstances X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Feb 2008 22:30:01 -0000 >Number: 120431 >Category: conf >Synopsis: devfs.rules are not initialized under certain (default) circumstances >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Feb 08 22:30:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Fabian Thorns >Release: 6.2, 6.3 and 7.0-RC1 >Organization: >Environment: FreeBSD jailhost 7.0-RC1 FreeBSD 7.0-RC1 #0: Mon Dec 24 12:18:24 UTC 2007 root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: Hi there, i just tried to set up some jails under FreeBSD 6.3 and 7.0-RC1 and was unable to assign a devfs-ruleset to a manually mounted devfs: # mount -t devfs devfs /jails/jail01/dev # devfs -m /jails/jail01/dev rule -s 4 applyset devfs rule: ioctl DEVFSIO_SAPPLY: No such process This is caused by the problem that rulesets from neither /etc/defaults/devfs.rules nor /etc/devfs.rules are available by default: # grep rules_jail /etc/defaults/devfs.rules [devfsrules_jail=4] # devfs rule showsets # However, the rules are available after launching jails through /etc/rc.d/jail. After looking around in the rc.d-scripts i found that the rulesets listed in devfs.rules-files in rc.conf are initialized by the rc.subr method devfs_init_rulesets which is run by /etc/rc.d/jail. I would expect this function being lunched from /etc/rc.d/devfs at the system startup too, but this only happens when either devfs_system_ruleset or devfs_set_rulesets is set in rc.conf. This is not the default-case and is likely to be left unchanged when not using devfs-rules at startup-time. This might be common for the hostsystem, but in a jailed environment these rules are definitely needed and should be useably right away, especially for setting up and testing jails before starting them with rc.d/jail. >How-To-Repeat: see above. >Fix: To make the rules available i modified /etc/rc.d/dev changing line 19 from if [ -n "$devfs_system_ruleset" -o -n "$devfs_set_rulesets" ]; then to if [ -n "$devfs_system_ruleset" -o -n "$devfs_set_rulesets" -o -n "$devfs_rulesets" ]; then . Afterwards all rules are initialized as soon as a ruleset is specified using devfs_rulesets in rc.conf which is the default for dev.rules in both /etc/ and /etc/default. The appliance of the rules is conditioned later in /etc/rc.d/devfs and is therefore not affected by this change. After launching /etc/rc.d/devfs restart all rules are available and applicable at any time. Regards, Fabian Patch attached with submission follows: --- /etc/rc.d/devfs.org Fri Feb 8 23:06:13 2008 +++ /etc/rc.d/devfs Fri Feb 8 23:06:31 2008 @@ -16,7 +16,7 @@ devfs_start() { - if [ -n "$devfs_system_ruleset" -o -n "$devfs_set_rulesets" ]; then + if [ -n "$devfs_system_ruleset" -o -n "$devfs_set_rulesets" -o -n "$devfs_rulesets" ]; then devfs_init_rulesets if [ -n "$devfs_system_ruleset" ]; then devfs_set_ruleset $devfs_system_ruleset /dev >Release-Note: >Audit-Trail: >Unformatted: