On Thu, Feb 16, 2017 at 10:43:43AM +0100, Antoine Jacoutot wrote: > On Thu, Feb 16, 2017 at 08:46:45AM +0100, Raimo Niskanen wrote: > > Hello Misc@ > > > > I tried to activate ypbind via rcctl: > > rcctl enable ypbind > > and it did not write "ypbind_flags=" into /etc/rc.conf.local. > > > Can't reproduce here. > # rcctl enable ypbind ; grep yp /etc/rc.conf.local > > ypbind_flags= > > > I had run ypbind so it should start according to the documentation since > > there is a domain file in /var/yp/binding/ but when booting the machine > > ypbind did not start and there was no printout from /etc/rc about starting > > it. "rcdctl ls failed" did print ypbind. > > If 'rcctl ls failed' outputs ypbind, then it means ypbind_flags *is* in > rc.conf.local or something is really bogus...
It is... See below. > > > > > I tried to debug rcctl with little success. Looking at the script it seems > > to me that it checks /etc/rc.conf and /etc/rc.conf.local and should write a > > line "ypbind_flags=" into /etc/rc.conf.local since the default in > > /etc/rc.conf is "ypbind_flags=NO". But ktrace:ing it indicates that it > > also checks domainname and /var/yp/binding so it is smarter than it looks. > > Wait what? rcctl certainly does not check for these. It certainly does. I have found it now! Well, rcctl does not check for these, but it relies on . /etc/rc.d/rc.subr _rc_parse_conf And in /etc/rc.d/rc.subr the function _rc_parse_conf calls _rc_quirks which checks `domainname` and /var/yp/binding and if they are set ypbind_flags becomes ''. So does /etc/rc, but misses; read on! Since I hade run 'domainname XXXX' and ypbind by hand it had set /var/yp/binding and therefore 'rcctl enable ypbind' concludes that there is no need for an entry in /etc/rc.conf.local because the quirked default value is already ''. I am pretty certain that the reason that ypbind did not get started from /etc/rc when /etc/defaultdomain contained a domain name and /var/yp/binding was set is that /etc/rc sources /etc/rc.d/rc.subr and runs _rc_parse_conf before /var is mounted so /etc/rc thinks ypbind_flags=NO. After /var has been mounted ypbind_flags= and therefore 'rcctl ls failed' lists ypbind, which surely enoug is not started when it should have been. Nasty glitch... I do not know how it should be fixed, but if I had enabled ypbind through rcctl from the start I would have gotten an entry in /etc/rc.conf.local and everything would have just worked. However, the quirked value for ypbind gets wrong for /etc/rc which I think is kind of a bug... > > > Unfortunately /etc/rc starts ypbind like any other daemon so ypbind_flags > > has to be != NO and therefore it is not started. > > > > So there seems to be some misunderstanding between /etc/rc and rcctl about > > exactly when ypbind is enabled or not. > > > > The workaround is easy enough (manually editing /etc/rc.conf.local so no > > big issue. > > > > Also, I tried to set nfsd flags: > > rcctl enable nfsd > > rcctl set nfsd flags -tun 4 > > or > > rcctl set nfsd flags "-tun 4" > > but it did not work (nfsd_flags=) > > rcctl set nfsd flags -tu > > did work, though. > > > > Known problems? > > It's not a problem, "-tun 4" are the default flags. > Check the output of 'rcctl get nfsd flags'. Ok. That figures! I had read /etc/rc.conf and concluded that the default value for nfsd_flags was NO. rc.subr(8) explains that rc.subr global defaults are overridden by /etc/rc.d/ script defaults that are overrriden by /etc/rc.conf.local values. But /etc/rc.conf defaults are not mentioned here. I feel a bit confused... But 'rcctl get <service>' will tell me the truth (except for ypbind_flags in /etc/rc ;-). Thank you for enlightening me! > > -- > Antoine -- / Raimo Niskanen, Erlang/OTP, Ericsson AB