Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Apr 2021 16:30:54 +0900 (JST)
From:      Yasuhiro Kimura <yasu@utahime.org>
To:        freebsd-ports@freebsd.org, freebsd-stable@freebsd.org
Subject:   How to make 'named' rc script invokded earlier at boot time
Message-ID:  <20210430.163054.429403798691966830.yasu@utahime.org>

next in thread | raw e-mail | index | archive | help
I installed dns/bind916 on my home server and configured it so it
worked as both authoritative and recursor. Then I added
'nameserver 127.0.0.1' to /etc/resolv.conf and everything worked fine.

But after updating OS from 12.2-RELEASE to 13.0-RELEASE I noticed
execution of some rc scripts fails at boot time because of DNS lookup
error. And I also found these scripts are executed earlier than
'named'.

Now let me use 'ntpdate' as an example.

If I run `rcorder /etc/rc.d/* /usr/local/etc/rc.d/*` on 12.2-RELEASE,
then I get following result.

----------------------------------------------------------------------
root@rolling-vm-freebsd3[474]# uname -a
FreeBSD rolling-vm-freebsd3.home.utahime.org 12.2-RELEASE-p6 FreeBSD 12.2-RELEASE-p6 GENERIC  amd64
root@rolling-vm-freebsd3[475]# rcorder /etc/rc.d/* /usr/local/etc/rc.d/*
/etc/rc.d/growfs
/etc/rc.d/sysctl
/etc/rc.d/hostid
/etc/rc.d/zvol
/etc/rc.d/dumpon
(snip)
/etc/rc.d/static_arp
/etc/rc.d/bridge
/etc/rc.d/route6d
/etc/rc.d/NETWORKING
/etc/rc.d/mountcritremote
/etc/rc.d/devfs
/etc/rc.d/ipmon
/etc/rc.d/kdc
/etc/rc.d/mdconfig2
/etc/rc.d/newsyslog
/etc/rc.d/syslogd
/usr/local/etc/rc.d/tcsd
/usr/local/etc/rc.d/named
/etc/rc.d/watchdogd
/etc/rc.d/savecore
/etc/rc.d/archdep
/etc/rc.d/linux
/etc/rc.d/sysvipc
/etc/rc.d/SERVERS
/usr/local/etc/rc.d/tpmd
/usr/local/etc/rc.d/stunnel
/etc/rc.d/accounting
/etc/rc.d/ntpdate
/etc/rc.d/rpcbind
/etc/rc.d/nfsclient
/etc/rc.d/nisdomain
(snip)
----------------------------------------------------------------------

As you can see, while 'named' is executed before SERVERS, 'ntpdate' is
done after it.

On the other hand I get following result on 13.0-RELEASE.

----------------------------------------------------------------------
root@rolling-vm-freebsd2[332]# uname -a
FreeBSD rolling-vm-freebsd2.home.utahime.org 13.0-RELEASE FreeBSD 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr  9 04:24:09 UTC 2021     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64
root@rolling-vm-freebsd2[333]# rcorder /etc/rc.d/* /usr/local/etc/rc.d/*
/etc/rc.d/dhclient
/etc/rc.d/dumpon
/etc/rc.d/growfs
/etc/rc.d/natd
(snip)
/etc/rc.d/netwait
/etc/rc.d/blacklistd
/etc/rc.d/local_unbound
/etc/rc.d/NETWORKING
/etc/rc.d/pppoed
/etc/rc.d/kdc
/etc/rc.d/kfd
/etc/rc.d/nfsuserd
/etc/rc.d/iscsid
/etc/rc.d/ipropd_slave
/etc/rc.d/nfscbd
/etc/rc.d/iscsictl
/etc/rc.d/ipropd_master
/etc/rc.d/kadmind
/etc/rc.d/kpasswdd
/etc/rc.d/mountcritremote
/etc/rc.d/wpa_supplicant
/etc/rc.d/motd
/etc/rc.d/accounting
/etc/rc.d/cleartmp
/etc/rc.d/dmesg
/etc/rc.d/archdep
/etc/rc.d/gptboot
/etc/rc.d/hostapd
/etc/rc.d/virecover
/etc/rc.d/mdconfig2
/etc/rc.d/devfs
/etc/rc.d/os-release
/etc/rc.d/newsyslog
/etc/rc.d/linux
/etc/rc.d/syslogd
/etc/rc.d/sysvipc
/etc/rc.d/watchdogd
/etc/rc.d/savecore
/etc/rc.d/ntpdate
/etc/rc.d/localpkg
/etc/rc.d/auditd
/etc/rc.d/bsnmpd
/etc/rc.d/pwcheck
/etc/rc.d/power_profile
/etc/rc.d/rpcbind
/etc/rc.d/auditdistd
/usr/local/etc/rc.d/named
/etc/rc.d/nfsclient
/etc/rc.d/hastd
/etc/rc.d/SERVERS
/etc/rc.d/nisdomain
/usr/local/etc/rc.d/stunnel
/usr/local/etc/rc.d/tpmd
/usr/local/etc/rc.d/tcsd
(snip)
----------------------------------------------------------------------

Now both 'named' and 'ntpdate' are executed before SERVERS. And
unfortunately the latter is earlier than the former. So it is natural
that execution of 'ntpdate' fails with DNS lookup failure.

I compared ntpdate rc script between releng/12.2 and releng/13.0 but
there is no difference.

----------------------------------------------------------------------
yasu@rolling-vm-freebsd2[1035]% pwd
/usr/src
yasu@rolling-vm-freebsd2[1036]% git diff origin/releng/12.2 origin/releng/13.0  -- libexec/rc/rc.d/ntpdate
yasu@rolling-vm-freebsd2[1037]%
----------------------------------------------------------------------

And of cource there is no difference with /usr/local/etc/rc.d/named
either. So it seems evaluation of rcorder(8) is changed between
12.2-RELASE and 13.0-RELEASE.

Then is there any way to make 'named' rc script invoked earlier at
boot time on 13.0-RELEASE?

Best Regards.

---
Yasuhiro Kimura



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210430.163054.429403798691966830.yasu>