Bug 97166

Summary: Bug in /etc/rc.d/jail startup script
Product: Base System Reporter: m m <needacoder>
Component: confAssignee: Florent Thoumie <flz>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description m m 2006-05-12 10:00:34 UTC
Using the jail_list feature in rc.conf no longer works for starting up multiple jails at boot time if fstab.<jail> files are used for jail fstab.

Problem appears to be at or near these lines:

  # "/etc/fstab.${_j}" will be used for {,u}mount(8) if none is specified.
  eval jail_fstab=\"\${jail_${_j}_fstab:-${jail_fstab}}\"

the first jail starts up correctly, info output:

May 12 00:51:29 host root: /etc/rc: INFO: hosting root: /usr/jails/hosting/slash
May 12 00:51:29 host root: /etc/rc: INFO: hosting devdir: /usr/jails/hosting/slash/dev
May 12 00:51:29 host root: /etc/rc: INFO: hosting fdescdir: /usr/jails/hosting/slash/dev/fd
May 12 00:51:29 host root: /etc/rc: INFO: hosting procdir: /usr/jails/hosting/slash/proc
May 12 00:51:29 host root: /etc/rc: INFO: hosting ruleset: devfsrules_jail
May 12 00:51:29 host root: /etc/rc: INFO: hosting fstab: /etc/fstab.hosting
..
May 12 00:51:29 host root: /etc/rc: INFO: Mounting fstab for jail hosting (/etc/fstab.hosting)
..
May 12 00:51:30 host root: /etc/rc: INFO: devfs_domount(): mount-point is (/usr/jails/hosting/slash/dev), ruleset is (devfsrules_jail)

subsequent jails fail to start up, info output:

May 12 00:51:37 host root: /etc/rc: INFO: mysql root: /usr/jails/mysql/slash
May 12 00:51:37 host root: /etc/rc: INFO: mysql devdir: /usr/jails/mysql/slash/dev
May 12 00:51:37 host root: /etc/rc: INFO: mysql fdescdir: /usr/jails/mysql/slash/dev/fd
May 12 00:51:37 host root: /etc/rc: INFO: mysql procdir: /usr/jails/mysql/slash/proc
May 12 00:51:37 host root: /etc/rc: INFO: mysql ruleset: devfsrules_jail
May 12 00:51:37 host root: /etc/rc: INFO: mysql fstab: /etc/fstab.hosting
.. 
May 12 00:51:37 host root: /etc/rc: INFO: Mounting fstab for jail mysql (/etc/fstab.hosting)
.. 
May 12 00:51:37 host root: /etc/rc: WARNING: devfs_domount(): Unable to mount devfs on /usr/jails/mysql/slash/dev

it looks like jail_fstab remains set from the first jail (/etc/fstab.hosting) so second jail never mounts fstab.mysql and dies on devfs_domount().

Fix: 

setting explicit jail_bla_fstab=/etc/fstab.bla will helps.
Comment 1 Maxim Konovalov 2006-05-12 10:10:54 UTC
Hi,

Could you please check a patch in kern/97079?

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

Please let us know if it helps you.

-- 
Maxim Konovalov
Comment 2 Maxim Konovalov 2006-05-12 10:25:50 UTC
Would be even better to help Florent to test his fix.

-- 
Maxim Konovalov

---------- Forwarded message ----------
Date: Fri, 12 May 2006 10:21:41 +0100
From: Florent Thoumie <flz@freebsd.org>
To: freebsd-current@freebsd.org
Cc: freebsd-stable@freebsd.org
Subject: Jail testers needed (rc.d/jail)

Hey lists,

Two or three days before the CVS tree has been tagged for FreeBSD
6.1-RELEASE, I've committed a broken version of the jail rc.d script.

The symptoms are:

- an ifconfig error message if you don't define a jail_interface and
have at least one jail configured, this one is harmless.
- a problem with one of the following variable: jail_exec,
jail_exec_start, jail_exec_stop, jail_flags and especially jail_fstab;
if you have at least two jails configured.

I committed yesterday a fix that should supposedly fix both of these
issues so I'd need all jail users running either FreeBSD 6.1-RELEASE or
6-STABLE (older than two days) to try the new script [1] and report the
result, either successful or not. Once I'll get enough successful
reports, I'll contact the Release Engineering team to make sure the
patch makes it to the RELENG_6_1 branch.

Sorry for the inconvenience.

Note: Keep me CC'ed as I'm not (yet) subscribed to these lists.

[1] http://cvsweb.freebsd.org/src/etc/rc.d/jail?rev=1.32

-- 
Florent Thoumie
flz@FreeBSD.org
FreeBSD Committer
Comment 3 m m 2006-05-12 18:50:05 UTC
> Hey lists,
>
> Two or three days before the CVS tree has been tagged for FreeBSD
> 6.1-RELEASE, I've committed a broken version of the jail rc.d script.
>
> The symptoms are:
>
> - an ifconfig error message if you don't define a jail_interface and
> have at least one jail configured, this one is harmless.
> - a problem with one of the following variable: jail_exec,
> jail_exec_start, jail_exec_stop, jail_flags and especially jail_fstab;
> if you have at least two jails configured.
>
> I committed yesterday a fix that should supposedly fix both of these
> issues so I'd need all jail users running either FreeBSD 6.1-RELEASE or
> 6-STABLE (older than two days) to try the new script [1] and report the
> result, either successful or not. Once I'll get enough successful
> reports, I'll contact the Release Engineering team to make sure the
> patch makes it to the RELENG_6_1 branch.
>
> Sorry for the inconvenience.
>
> Note: Keep me CC'ed as I'm not (yet) subscribed to these lists.
>
> [1] http://cvsweb.freebsd.org/src/etc/rc.d/jail?rev=3D1.32

Appears to be working fine on releng_6 from last night - Thank you very muc=
h!
Comment 4 Maxim Konovalov freebsd_committer freebsd_triage 2006-05-12 18:56:58 UTC
State Changed
From-To: open->patched

Fixed in HEAD. 


Comment 5 Maxim Konovalov freebsd_committer freebsd_triage 2006-05-12 18:56:58 UTC
Responsible Changed
From-To: freebsd-bugs->flz

Over to Florent.
Comment 6 Florent Thoumie freebsd_committer freebsd_triage 2006-07-10 12:13:06 UTC
State Changed
From-To: patched->closed

Errata has been published.