Date: Fri, 8 Feb 2008 22:20:52 GMT From: Fabian Thorns <fabian@thorns.it> To: freebsd-gnats-submit@FreeBSD.org Subject: conf/120431: devfs.rules are not initialized under certain (default) circumstances Message-ID: <200802082220.m18MKqsH022174@www.freebsd.org> Resent-Message-ID: <200802082230.m18MU1cE027491@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802082220.m18MKqsH022174>