service jails and precmd make ntpd (and nfsd) sad

Lexi Winter <[email protected]>
Newsgroups gmane.os.freebsd.architechture
Message-ID <[email protected]>
hello,

while investigating how to support ntpd in a service jail[0], i ran into
a problem with rc(8) which i think is more architectural in nature.

the problem: several rc.d scripts, including ntpd and nfsd, assume that
you can set $command_args in ${svc}_start_precmd and this change will be
reflected in ${svc}_start when the service is started.  for non-svcj
services, this assumption is correct.  for svcj services, it is not,
because ${svc}_start_precmd is run outside the jail, then ${svc}_start is
run inside the jail in a separate shell process.

this cannot be fixed by simply running ${svc}_start_precmd in the svcj,
because ntpd's rc script needs to load a kernel module in its precmd.

i think the correct fix here is to split precmd into two things, one of
which is run outside the jail (to load kernel modules, etc.) and one of
which is run before ${svc}_start (or other actions) in the same shell
that the action will run in.

i would propose 'setup' as the thing which is run outside the jail, and
'precmd' as the thing which is run inside the jail.

am i on the right track here, or have i missed something?

[0] as a follow-up to https://github.com/freebsd/freebsd-src/pull/1619
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.