[S] Why do hostname and sendmail steps at boot take so long?

Re: Why do hostname and sendmail steps at boot take so long?

It still didn't work. Here are the relevant files:

/etc/hosts
Code:
# $FreeBSD: release/10.0.0/etc/hosts 109997 2003-01-28 21:29:23Z dbaker $
#
# Host Database
#
# This file should contain the addresses and aliases for local hosts that
# share this file.  Replace 'my.domain' below with the domainname of your
# machine.
#
# In the presence of the domain name service or NIS, this file may
# not be consulted at all; see /etc/nsswitch.conf for the resolution order.
#
#
::1			localhost localhost.my.domain
127.0.0.1		localhost localhost.my.domain
10.0.2.15
#
# Imaginary network.
#10.0.0.2		myname.my.domain myname
#10.0.0.3		myfriend.my.domain myfriend
#
# According to RFC 1918, you can use the following IP networks for
# private nets which will never be connected to the Internet:
#
#	10.0.0.0	-   10.255.255.255
#	172.16.0.0	-   172.31.255.255
#	192.168.0.0	-   192.168.255.255
#
# In case you want to be able to connect to the Internet, you need
# real official assigned numbers.  Do not try to invent your own network
# numbers but instead get one from your network provider (if any) or
# from your regional registry (ARIN, APNIC, LACNIC, RIPE NCC, or AfriNIC.)
#

/var/log/maillog
Code:
Feb  7 18:44:19 vbsd newsyslog[651]: logfile first created
Feb  7 18:45:16 vbsd sm-mta[816]: gethostbyaddr(10.0.2.15) failed: 1
Feb  7 18:45:16 vbsd sm-mta[817]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  7 18:45:16 vbsd sm-mta[817]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  7 18:46:03 vbsd sm-msp-queue[820]: starting daemon (8.14.7): queueing@00:30:00
Feb  7 19:10:11 vbsd sm-mta[792]: gethostbyaddr(10.0.2.15) failed: 1
Feb  7 19:10:11 vbsd sm-mta[793]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  7 19:10:11 vbsd sm-mta[793]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  7 19:11:00 vbsd sm-msp-queue[796]: starting daemon (8.14.7): queueing@00:30:00
Feb  7 19:56:18 vbsd sm-mta[806]: gethostbyaddr(10.0.2.15) failed: 1
Feb  7 19:56:18 vbsd sm-mta[807]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  7 19:56:18 vbsd sm-mta[807]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  7 19:57:08 vbsd sm-msp-queue[810]: starting daemon (8.14.7): queueing@00:30:00
Feb  7 20:40:09 vbsd sm-mta[804]: gethostbyaddr(10.0.2.15) failed: 1
Feb  7 20:40:09 vbsd sm-mta[805]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  7 20:40:09 vbsd sm-mta[805]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  7 20:40:59 vbsd sm-msp-queue[808]: starting daemon (8.14.7): queueing@00:30:00
Feb  7 23:33:30 vbsd sm-mta[810]: gethostbyaddr(10.0.2.15) failed: 1
Feb  7 23:33:30 vbsd sm-mta[811]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  7 23:33:30 vbsd sm-mta[811]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  7 23:34:19 vbsd sm-msp-queue[814]: starting daemon (8.14.7): queueing@00:30:00
Feb  7 23:37:21 vbsd sm-mta[801]: gethostbyaddr(10.0.2.15) failed: 1
Feb  7 23:37:21 vbsd sm-mta[802]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  7 23:37:21 vbsd sm-mta[802]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  7 23:38:10 vbsd sm-msp-queue[805]: starting daemon (8.14.7): queueing@00:30:00
Feb  8 16:19:48 vbsd sm-mta[858]: gethostbyaddr(10.0.2.15) failed: 1
Feb  8 16:19:48 vbsd sm-mta[1098]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  8 16:19:48 vbsd sm-mta[1098]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  8 16:20:37 vbsd sm-msp-queue[1188]: starting daemon (8.14.7): queueing@00:30:00
Feb  8 16:33:34 vbsd sm-mta[852]: gethostbyaddr(10.0.2.15) failed: 1
Feb  8 16:33:34 vbsd sm-mta[1088]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  8 16:33:34 vbsd sm-mta[1088]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  8 16:34:23 vbsd sm-msp-queue[1181]: starting daemon (8.14.7): queueing@00:30:00
Feb  8 16:40:52 vbsd sm-mta[850]: gethostbyaddr(10.0.2.15) failed: 1
Feb  8 16:40:52 vbsd sm-mta[1086]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  8 16:40:52 vbsd sm-mta[1086]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  8 16:41:41 vbsd sm-msp-queue[1180]: starting daemon (8.14.7): queueing@00:30:00
Feb  8 17:03:41 vbsd sm-mta[856]: gethostbyaddr(10.0.2.15) failed: 1
Feb  8 17:03:41 vbsd sm-mta[1092]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  8 17:03:41 vbsd sm-mta[1092]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  8 17:04:30 vbsd sm-msp-queue[1185]: starting daemon (8.14.7): queueing@00:30:00
Feb  8 18:43:38 vbsd sm-mta[856]: gethostbyaddr(10.0.2.15) failed: 1
Feb  8 18:43:38 vbsd sm-mta[937]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  8 18:43:38 vbsd sm-mta[937]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  8 18:43:55 vbsd sm-msp-queue[1020]: starting daemon (8.14.7): queueing@00:30:00
Feb  8 18:51:10 vbsd sm-mta[852]: gethostbyaddr(10.0.2.15) failed: 1
Feb  8 18:51:10 vbsd sm-mta[938]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  8 18:51:10 vbsd sm-mta[938]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  8 18:51:27 vbsd sm-msp-queue[1016]: starting daemon (8.14.7): queueing@00:30:00
Feb  9 09:44:46 vbsd sm-mta[857]: gethostbyaddr(10.0.2.15) failed: 1
Feb  9 09:44:46 vbsd sm-mta[1103]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  9 09:44:46 vbsd sm-mta[1103]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  9 09:45:36 vbsd sm-msp-queue[1186]: starting daemon (8.14.7): queueing@00:30:00
Feb  9 09:51:37 vbsd sm-mta[850]: gethostbyaddr(10.0.2.15) failed: 1
Feb  9 09:51:37 vbsd sm-mta[1086]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  9 09:51:37 vbsd sm-mta[1086]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  9 09:52:26 vbsd sm-msp-queue[1179]: starting daemon (8.14.7): queueing@00:30:00
Feb  9 13:05:06 vbsd sm-mta[860]: gethostbyaddr(10.0.2.15) failed: 1
Feb  9 13:05:06 vbsd sm-mta[1094]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  9 13:05:07 vbsd sm-mta[1094]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  9 13:05:56 vbsd sm-msp-queue[1189]: starting daemon (8.14.7): queueing@00:30:00
Feb  9 13:07:58 vbsd sm-mta[863]: gethostbyaddr(10.0.2.15) failed: 1
Feb  9 13:07:58 vbsd sm-mta[1099]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  9 13:07:58 vbsd sm-mta[1099]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  9 13:08:47 vbsd sm-msp-queue[1192]: starting daemon (8.14.7): queueing@00:30:00
Feb  9 13:11:16 vbsd sm-mta[863]: gethostbyaddr(10.0.2.15) failed: 1
Feb  9 13:11:16 vbsd sm-mta[1099]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  9 13:11:16 vbsd sm-mta[1099]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  9 13:12:05 vbsd sm-msp-queue[1192]: starting daemon (8.14.7): queueing@00:30:00
Feb  9 17:20:08 vbsd sm-mta[1099]: restarting /usr/sbin/sendmail due to signal
Feb  9 17:20:08 vbsd sm-msp-queue[1192]: restarting /usr/sbin/sendmail due to signal
Feb  9 17:22:13 vbsd sm-mta[851]: gethostbyaddr(10.0.2.15) failed: 1
Feb  9 17:22:13 vbsd sm-mta[1107]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  9 17:22:13 vbsd sm-mta[1107]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  9 17:23:02 vbsd sm-msp-queue[1180]: starting daemon (8.14.7): queueing@00:30:00
Feb  9 17:29:05 vbsd sm-mta[850]: gethostbyaddr(10.0.2.15) failed: 1
Feb  9 17:29:05 vbsd sm-mta[1176]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  9 17:29:05 vbsd sm-mta[1176]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  9 20:44:40 vbsd sm-mta[850]: gethostbyaddr(10.0.2.15) failed: 1
Feb  9 20:44:40 vbsd sm-mta[1086]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb  9 20:44:40 vbsd sm-mta[1086]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb  9 20:45:30 vbsd sm-msp-queue[1179]: starting daemon (8.14.7): queueing@00:30:00

Looks like it's still failing to resolve 10.0.2.15 (which VirtualBox sets as the guest OS IP address; the host is 10.0.2.2).
 
Re: Why do hostname and sendmail steps at boot take so long?

In /etc/hosts change:
Code:
10.0.2.15
to:
Code:
10.0.2.15 domain.tld
using the FQDN you assigned during setup (or the hostname of the system whose IP is 10.0.2.15).
 
Re: Why do hostname and sendmail steps at boot take so long?

To resolve to a name, there must be a name entered in hosts.
 
Re: Why do hostname and sendmail steps at boot take so long?

Well, no luck yet, but we're making progress. I just found out some interesting information from the VirtualBox website (http://www.virtualbox.org/manual/ch09.html):

9.11. Fine-tuning the VirtualBox NAT engine
9.11.1. Configuring the address of a NAT network interface

In NAT mode, the guest network interface is assigned to the IPv4 range 10.0.x.0/24 by default where x corresponds to the instance of the NAT interface +2. So x is 2 when there is only one NAT instance active. In that case the guest is assigned to the address 10.0.2.15, the gateway is set to 10.0.2.2 and the name server can be found at 10.0.2.3.

If, for any reason, the NAT network needs to be changed, this can be achieved with the following command:

VBoxManage modifyvm "VM name" --natnet1 "192.168/16"
This command would reserve the network addresses from 192.168.0.0 to 192.168.254.254 for the first NAT network instance of "VM name". The guest IP would be assigned to 192.168.0.15 and the default gateway could be found at 192.168.0.2.

I changed the line in /etc/hosts to:

Code:
10.0.2.15		vbsd.local vbsd

And I created /etc/resolvconf.conf and entered the following:

Code:
search_domains="10.0.2.2"
name_servers="10.0.2.3"

Which changes /etc/resolv.conf to:

Code:
# Generated by resolvconf
search 10.0.2.2 gateway.2wire.net
nameserver 10.0.2.3
nameserver 192.168.1.254

Correction: 10.0.2.2 is the VirtualBox host, 10.0.2.15 is the guest. My mistake.

Like I said, this still didn't work, but at least we have more information about how it doesn't work.
 
Re: Why do hostname and sendmail steps at boot take so long?

Well, I got rid of the errors in /var/log/maillog (notice the entries around 4:00 pm):
# tail /var/log/maillog
Code:
Feb 10 15:19:10 vbsd sm-mta[1107]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb 10 15:20:01 vbsd sm-msp-queue[1195]: starting daemon (8.14.7): queueing@00:30:00
Feb 10 15:25:13 vbsd sm-mta[927]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb 10 15:25:13 vbsd sm-mta[927]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb 10 15:25:30 vbsd sm-msp-queue[1010]: starting daemon (8.14.7): queueing@00:30:00
Feb 10 15:29:04 vbsd sm-mta[928]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb 10 15:29:04 vbsd sm-mta[928]: STARTTLS=server: file /etc/mail/certs/dh.param unsafe: No such file or directory
Feb 10 15:29:20 vbsd sm-msp-queue[1006]: starting daemon (8.14.7): queueing@00:30:00
Feb 10 16:11:47 vbsd sm-mta[934]: starting daemon (8.14.7): SMTP+queueing@00:30:00
Feb 10 16:12:04 vbsd sm-msp-queue[1017]: starting daemon (8.14.7): queueing@00:30:00

I had to add this line to /etc/hosts:
Code:
10.0.2.15        vbsd vbsd.local

And I found from the link below that I had to run the following command
https://groups.google.com/forum/#!topic ... B-r0_0FUEY

# cd /etc/mail/certs
# openssl dhparam -out dh.param 4096

That took a while. No more errors in /var/log/maillog, but still quite slow at boot. :(

UPDATE: As described in the handbook (here http://www.freebsd.org/doc/en_US.ISO885 ... dmail.html), I created the file /etc/mail/local-host-names and added the following lines.
Code:
local
vbsd.local
It didn't speed up the sendmail steps at boot.
 
Re: Why do hostname and sendmail steps at boot take so long?

I got the sendmail steps to speed up! Now they're instant!

All it took was adding the IPv6 localhost to /etc/hosts as well!

/etc/hosts:
Code:
# $FreeBSD: release/10.0.0/etc/hosts 109997 2003-01-28 21:29:23Z dbaker $
#
# Host Database
#
# This file should contain the addresses and aliases for local hosts that
# share this file.  Replace 'my.domain' below with the domainname of your
# machine.
#
# In the presence of the domain name service or NIS, this file may
# not be consulted at all; see /etc/nsswitch.conf for the resolution order.
#
#
::1			localhost localhost.my.domain
127.0.0.1		localhost localhost.my.domain
10.0.2.15		vbsd vbsd.local
::1			vbsd vbsd.local
#
# Imaginary network.
#10.0.0.2		myname.my.domain myname
#10.0.0.3		myfriend.my.domain myfriend
#
# According to RFC 1918, you can use the following IP networks for
# private nets which will never be connected to the Internet:
#
#	10.0.0.0	-   10.255.255.255
#	172.16.0.0	-   172.31.255.255
#	192.168.0.0	-   192.168.255.255
#
# In case you want to be able to connect to the Internet, you need
# real official assigned numbers.  Do not try to invent your own network
# numbers but instead get one from your network provider (if any) or
# from your regional registry (ARIN, APNIC, LACNIC, RIPE NCC, or AfriNIC.)
#

The key line was this:
Code:
::1			vbsd vbsd.local
Got the idea from here http://forums.fedoraforum.org/showthread.php?t=276194

Thanks everyone!



I'm not sure if I need to add this line too or if it will do anything helpful—it didn't speed up the boot process as far as I could tell:
Code:
127.0.0.1		vbsd vbsd.local



Still, the step
Setting hostname: vbsd.local. takes 12 seconds. Is that normal, or is there a way to speed it up? Is there a log file I can look at for errors?


EDIT: Fixed it! I just had to disable IPv6 in /etc/rc.conf since that seems to add time to the Setting hostname: vbsd.local step. Here is the line I commented out:
Code:
#ifconfig_em0_ipv6="inet6 accept_rtadv"


To summarize, add this line to /etc/hosts
Code:
::1         vbsd vbsd.local

And comment out any IPv6 lines in /etc/rc.conf


Not sure why sendmail still needs the IPv6 line in /etc/hosts if it's not used in /etc/rc.conf, so hopefully this doesn't cause other problems down the line. For now, though, problem solved. :e
 
Re: Why do hostname and sendmail steps at boot take so long?

It many not be that command, but one of the ones after it. Look at rcorder /etc/rc.d/* | less.
 
Re: Why do hostname and sendmail steps at boot take so long?

@wblock@ Here is the output of rcorder /etc/rc.d/* | less
Code:
/etc/rc.d/sysctl
/etc/rc.d/hostid
/etc/rc.d/zvol
/etc/rc.d/dumpon
/etc/rc.d/ddb
/etc/rc.d/initrandom
/etc/rc.d/geli
/etc/rc.d/gbde
/etc/rc.d/ccd
/etc/rc.d/swap
/etc/rc.d/fsck
/etc/rc.d/root
/etc/rc.d/mdconfig
/etc/rc.d/hostid_save
/etc/rc.d/mountcritlocal
/etc/rc.d/zfs
/etc/rc.d/var
/etc/rc.d/cleanvar
/etc/rc.d/FILESYSTEMS
/etc/rc.d/kldxref
/etc/rc.d/kld
/etc/rc.d/addswap
/etc/rc.d/random
/etc/rc.d/postrandom
/etc/rc.d/adjkerntz
/etc/rc.d/atm1
/etc/rc.d/hostname
/etc/rc.d/ip6addrctl
/etc/rc.d/netoptions
/etc/rc.d/sppp
/etc/rc.d/ipfilter
/etc/rc.d/ipnat
/etc/rc.d/ipfs
/etc/rc.d/serial
/etc/rc.d/netif
/etc/rc.d/devd
/etc/rc.d/ipsec
/etc/rc.d/atm2
/etc/rc.d/pfsync
/etc/rc.d/pflog
/etc/rc.d/pf
/etc/rc.d/stf
/etc/rc.d/ppp
/etc/rc.d/faith
/etc/rc.d/routing
/etc/rc.d/mroute6d
/etc/rc.d/nsswitch
/etc/rc.d/rtsold
/etc/rc.d/resolv
/etc/rc.d/local_unbound
/etc/rc.d/static_ndp
/etc/rc.d/static_arp
/etc/rc.d/bridge
/etc/rc.d/route6d
/etc/rc.d/mrouted
/etc/rc.d/routed
/etc/rc.d/defaultroute
/etc/rc.d/ipfw
/etc/rc.d/NETWORKING
/etc/rc.d/netwait
/etc/rc.d/mountcritremote
/etc/rc.d/newsyslog
/etc/rc.d/syslogd
/etc/rc.d/ntpdate
/etc/rc.d/rpcbind
/etc/rc.d/devfs
/etc/rc.d/ipmon
/etc/rc.d/mdconfig2
/etc/rc.d/watchdogd
/etc/rc.d/savecore
/etc/rc.d/ldconfig
/etc/rc.d/archdep
/etc/rc.d/abi
/etc/rc.d/SERVERS
/etc/rc.d/nisdomain
/etc/rc.d/ypserv
/etc/rc.d/ypxfrd
/etc/rc.d/ypupdated
/etc/rc.d/ypbind
/etc/rc.d/ypset
/etc/rc.d/yppasswdd
/etc/rc.d/wpa_supplicant
/etc/rc.d/virecover
/etc/rc.d/accounting
/etc/rc.d/nfsclient
/etc/rc.d/amd
/etc/rc.d/atm3
/etc/rc.d/auditd
/etc/rc.d/auditdistd
/etc/rc.d/tmp
/etc/rc.d/cleartmp
/etc/rc.d/ctld
/etc/rc.d/dmesg
/etc/rc.d/hastd
/etc/rc.d/ipxrouted
/etc/rc.d/iscsid
/etc/rc.d/iscsictl
/etc/rc.d/kerberos
/etc/rc.d/kadmind
/etc/rc.d/keyserv
/etc/rc.d/kpasswdd
/etc/rc.d/nfsuserd
/etc/rc.d/gssd
/etc/rc.d/quota
/etc/rc.d/mountd
/etc/rc.d/nfsd
/etc/rc.d/statd
/etc/rc.d/lockd
/etc/rc.d/pppoed
/etc/rc.d/pwcheck
/etc/rc.d/DAEMON
/etc/rc.d/utx
/etc/rc.d/ugidfw
/etc/rc.d/ubthidhci
/etc/rc.d/timed
/etc/rc.d/apm
/etc/rc.d/apmd
/etc/rc.d/bootparams
/etc/rc.d/hcsecd
/etc/rc.d/bthidd
/etc/rc.d/local
/etc/rc.d/lpd
/etc/rc.d/motd
/etc/rc.d/mountlate
/etc/rc.d/nscd
/etc/rc.d/ntpd
/etc/rc.d/powerd
/etc/rc.d/rarpd
/etc/rc.d/rctl
/etc/rc.d/sdpd
/etc/rc.d/rfcomm_pppd_server
/etc/rc.d/rtadvd
/etc/rc.d/rwho
/etc/rc.d/LOGIN
/etc/rc.d/syscons
/etc/rc.d/swaplate
/etc/rc.d/sshd
/etc/rc.d/sendmail
/etc/rc.d/cron
/etc/rc.d/jail
/etc/rc.d/localpkg
/etc/rc.d/securelevel
/etc/rc.d/power_profile
/etc/rc.d/othermta
/etc/rc.d/nfscbd
/etc/rc.d/natd
/etc/rc.d/msgs
/etc/rc.d/moused
/etc/rc.d/mixer
/etc/rc.d/kfd
/etc/rc.d/inetd
/etc/rc.d/hostapd
/etc/rc.d/gptboot
/etc/rc.d/geli2
/etc/rc.d/ftpd
/etc/rc.d/ftp-proxy
/etc/rc.d/dhclient
/etc/rc.d/bsnmpd
/etc/rc.d/bluetooth
/etc/rc.d/bgfsck

It was probably /etc/rc.d/ip6addrctl if I'm understanding this correctly.
 
Last edited by a moderator:
Re: Why do hostname and sendmail steps at boot take so l

Drats. Should have thought of that. On my home FreeBSD machine, I have IPv6 completely disabled (since I won't need it in the foreseeable future), which is why I forgot to even think about it. If someone had mentioned it earlier, it could have saved you a lot of effort. Well, sorry.
 
Back
Top