this FreeBSD rc.d issue with ntpd/svcj is actually pretty interesting and affects more than ntpd -- i think it's broken nfsd too, although i didn't test that. and it's not clear how to fix it.

the basic problem is that with svcj enabled, ${svc}_precmd is run in a different shell than ${svc}_start, which means environment changes from precmd aren't visible in the start function. since ntpd sets $command_args in precmd, this means it starts without any command-line args.

overriding ${svc}_start is not desirable because then you miss all the magic that rc.subr does in its default start method, including the svcj stuff.

running precmd in the svcj before start doesn't work either, because ntpd needs to load a kernel module in its precmd.

i think the only fix here is to split precmd into two things, perhaps one called 'setup’ that does what precmd does now, and ‘precmd' that runs before start in the svcj. then ntpd's 'setup' could load the kernel modules etc., and its 'precmd' could set the command line args.

unless anyone has a better idea?

0

If you have a fediverse account, you can quote this note from your own instance. Search https://mastodon.bsd.cafe/users/lw/statuses/114199550895053455 on your instance and quote it. (Note that quoting is not supported in Mastodon.)