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



## lionoceros (Feb 8, 2014)

The  is for [SOLVED]

There are a few steps in the boot process of my FreeBSD 10.0-RELEASE installation that take what seems to be an excessive amount of time. Namely, these are:


```
Setting hostname: hostname.local
...
Starting sendmail_submit
Starting sendmail_msp_queue
```

I don't even remember the sendmail lines from previous versions of FreeBSD. Are they necessary? Is there a way to speed them up?

This is on a VirtualBox guest install of FreeBSD 10.0-RELEASE amd64.


----------



## wblock@ (Feb 9, 2014)

*Re: Why do some steps at boot take so long?*

#1: The Interrupted Unix FAQ.

If you see things that take twenty or thirty seconds instead of being nearly instant, think DNS.  Does that machine's hostname resolve to an address?


----------



## lionoceros (Feb 9, 2014)

*Re: Why do some steps at boot take so long?*

Since I don't own any domains, I just set the hostname to vbsd.local. Is that incorrect form, i.e., should I have called it vbsd.example.org or something similar?

I just checked /etc/resolv.conf and it has the correct information (same as what OS X displays):

```
# Generated by resolvconf
search gateway.2wire.net
nameserver 192.168.1.254
```

(I have a 2WIRE router provided by my ISP.)

During installation, I chose to use DHCP and the network connection seemed to work fine afterwards. VirtualBox is using NAT for my FreeBSD VM.


----------



## Uniballer (Feb 9, 2014)

*Re: Why do some steps at boot take so long?*

So how long does it take to do an `nslookup vbsd.local` on that machine?


----------



## lionoceros (Feb 9, 2014)

*Re: Why do some steps at boot take so long?*


```
nslookup: Command not found
```

I believe nslookup was removed from the base system in FreeBSD 10. Is there an alternative?


----------



## worldi (Feb 9, 2014)

*Re: Why do some steps at boot take so long?*

Yes, try drill() or host().

Edit: try `host` first, `drill`'s output is hard to read.


----------



## lionoceros (Feb 9, 2014)

*Re: Why do some steps at boot take so long?*

Drill took about a second to produce the following output:

`# drill vbsd.local`

```
;; ->>HEADER<<- opcode: QUERY, rcode: NXDOMAIN, id: 16280
;; flags: qr rd ra ; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;; vbsd.local.  IN     A

;; ANSWER SECTION:

;; AUTHORITY SETION:
	3092	IN		SOA		a.root-servers.net. nstld.verisign-grs.com. 2014020801 1800 900 604800 86400

;; ADDITIONAL SECTION:

;; Query time: 1034 msec
;; SERVER: 192.168.1.254
;; WHEN: Sat Feb  8 18:27:23 2014
;; MSG SIZE  rcvd: 103
```

Host took a few seconds and did not find anything:

`# host vbsd.local`

```
Host vbsd.local not found: 3(NXDOMAIN)
```


----------



## wblock@ (Feb 9, 2014)

*Re: Why do some steps at boot take so long?*

Any hostname you set will not be found in the ISP's DNS.  For dynamic machines, people often add the hostname to /etc/hosts.


----------



## lionoceros (Feb 9, 2014)

*Re: Why do some steps at boot take so long?*

Does that mean I should add vbsd.local to my /etc/hosts? This is my current /etc/hosts. I believe it's just the default since I have never edited it manually:


```
# $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
#
# 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.)
#
```


----------



## worldi (Feb 9, 2014)

*Re: Why do some steps at boot take so long?*

Yes, just add another line:

```
127.0.0.1      vbsd.local
```


----------



## lionoceros (Feb 9, 2014)

*Re: Why do some steps at boot take so long?*

I just added that line to /etc/hosts and those three steps still take a long time. Specifically,


```
Setting hostname: vbsd.local (12 seconds)
Starting sendmail_submit (16 seconds)
Starting sendmail_msp_queue (16 seconds)
```

Everything else in the boot process is pretty much instant.


----------



## ralphbsz (Feb 9, 2014)

*Re: Why do some steps at boot take so long?*



			
				lionoceros said:
			
		

> I just added that line to /etc/hosts and those three steps still take a long time. Specifically,
> 
> 
> ```
> ...



Dumb question: What does the disk activity light do during this time?  If it is on continuously, or blinking madly, these commands for some reason are doing a lot of disk I/O.  Which makes little sense, but I've seen pigs fly, and it is easy to check.

I'm also betting that the problem is some timeout in name resolution, but don't know how to offer concrete help on fixing it.

The next step is going to be pretty ugly.  Go into /etc/rc* and /etc/rc.d/*, and find out exactly which scripts are executing these steps.  For example, the first one is done by /etc/rc.d/hostname, and the only interesting command in there is `/bin/hostname "${hostname}"`.  Then change that command to be `truss -d /bin/hostname "${hostname}" 2> /tmp/hostname.truss`.  This means: run the `hostname` command with tracing of all system calls, with the time of each trace, and save the output in a file in /tmp.  If you can't tell which command in the script takes a lot of time, then just add date statements between the commands, and see which one runs long.  Reboot your machine, and study the output, to see which system call took forever, or which system calls needed to be done so often that it took a long time.  Note: this is real work, and you probably have to do this several times in a row.


----------



## lionoceros (Feb 9, 2014)

*Re: Why do some steps at boot take so long?*

It looks like there's very little disk activity during those steps.

I changed the /bin/hostname command as you instructed. This is the output of /tmp/hostname.truss:


```
0.002034895 mmap(0x0,32768,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34366136320 (0x80061a000)
0.003084191 issetugid(0x800819f30,0x7fffffffefd2,0x40,0x0,0xffff80080081af5e,0x0) = 0 (0x0)
0.004334070 lstat("/etc",{ mode=drwxr-xr-x ,inode=2568192,size=2048,blksize=32768 }) = 0 (0x0)
0.005242286 lstat("/etc/libmap.conf",{ mode=-rw-r--r-- ,inode=2568273,size=112,blksize=32768 }) = 0 (0x0)
0.006214756 open("/etc/libmap.conf",O_CLOEXEC,01760) = 3 (0x3)
0.007134147 fstat(3,{ mode=-rw-r--r-- ,inode=2568273,size=112,blksize=32768 }) = 0 (0x0)
0.007887874 mmap(0x0,112,PROT_READ,MAP_PRIVATE,3,0x0) = 34366169088 (0x800622000)
0.008750833 close(3)				 = 0 (0x0)
0.009816052 lstat("/usr",{ mode=drwxr-xr-x ,inode=1203840,size=512,blksize=32768 }) = 0 (0x0)
0.010780141 lstat("/usr/local",{ mode=drwxr-xr-x ,inode=1203851,size=512,blksize=32768 }) = 0 (0x0)
0.011653436 lstat("/usr/local/etc",{ mode=drwxr-xr-x ,inode=1306825,size=1024,blksize=32768 }) = 0 (0x0)
0.012721729 lstat("/usr/local/etc/libmap.d",0x7fffffffb918) ERR#2 'No such file or directory'
0.021211076 munmap(0x800622000,112)		 = 0 (0x0)
0.021694377 open("/var/run/ld-elf.so.hints",O_CLOEXEC,00) ERR#2 'No such file or directory'
0.022308981 access("/lib/libc.so.7",0)		 = 0 (0x0)
0.022800942 open("/lib/libc.so.7",O_CLOEXEC,030363770) = 3 (0x3)
0.023230048 fstat(3,{ mode=-r--r--r-- ,inode=2166925,size=1567216,blksize=32768 }) = 0 (0x0)
0.023614454 mmap(0x0,4096,PROT_READ,MAP_PRIVATE|MAP_PREFAULT_READ,3,0x0) = 34366169088 (0x800622000)
0.024063114 mmap(0x0,3772416,PROT_NONE,MAP_PRIVATE|MAP_ANON|MAP_NOCORE,-1,0x0) = 34368237568 (0x80081b000)
0.024529375 mmap(0x80081b000,1458176,PROT_READ|PROT_EXEC,MAP_PRIVATE|MAP_FIXED|MAP_NOCORE|MAP_PREFAULT_READ,3,0x0) = 34368237568 (0x80081b000)
0.025023851 mmap(0x800b7f000,49152,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_PREFAULT_READ,3,0x164000) = 34371792896 (0x800b7f000)
0.025541235 mmap(0x800b8b000,167936,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_FIXED|MAP_ANON,-1,0x0) = 34371842048 (0x800b8b000)
0.026044372 munmap(0x800622000,4096)		 = 0 (0x0)
0.026562594 close(3)				 = 0 (0x0)
0.027126353 mmap(0x0,102400,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34366169088 (0x800622000)
0.027735369 sysarch(0x81,0x7fffffffd308,0x4,0x0,0xffffffffffaa2080,0xf0000000) = 0 (0x0)
0.028202746 sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0)
0.028633807 sigprocmask(SIG_SETMASK,0x0,0x0)	 = 0 (0x0)
0.029028270 readlink("/etc/malloc.conf",0x7fffffffca30,1024) ERR#2 'No such file or directory'
0.029351496 issetugid(0x80095693e,0x7fffffffca30,0xffffffffffffffff,0x0,0x3a,0xffffffff0fffffff) = 0 (0x0)
0.029713832 mmap(0x0,4194304,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34372009984 (0x800bb4000)
0.030059686 munmap(0x800bb4000,4194304)		 = 0 (0x0)
0.030444093 mmap(0x0,8384512,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34372009984 (0x800bb4000)
0.030865375 munmap(0x800bb4000,311296)		 = 0 (0x0)
0.031177147 munmap(0x801000000,3878912)		 = 0 (0x0)
0.032266671 sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0)
0.032860880 sigprocmask(SIG_SETMASK,0x0,0x0)	 = 0 (0x0)
0.033513198 sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0)
0.033903471 sigprocmask(SIG_SETMASK,0x0,0x0)	 = 0 (0x0)
0.034252957 __sysctl(0x7fffffffdbc8,0x2,0x0,0x0,0x7fffffffdf2e,0xa) = 0 (0x0)
0.034643509 sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0)
0.034972881 sigprocmask(SIG_SETMASK,0x0,0x0)	 = 0 (0x0)
0.035336614 sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0)
0.035671573 sigprocmask(SIG_SETMASK,0x0,0x0)	 = 0 (0x0)
0.036039497 sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x0) = 0 (0x0)
0.036382836 sigprocmask(SIG_SETMASK,0x0,0x0)	 = 0 (0x0)
0.036382836 process exit, rval = 0
```

I'm not sure what information this gives me or if it provides any clues as to what could be delaying the hostname and sendmail commands.


----------



## wblock@ (Feb 9, 2014)

*Re: Why do some steps at boot take so long?*

Look at /var/log/maillog.  Sendmail looks for an FQDN, so just the hostname is probably not enough.  Based on the resolv.conf, it might be looking for vbsd.local.gateway.2wire.net or vbsd.local.2wire.net.


----------



## lionoceros (Feb 9, 2014)

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

Looks like gethostbyaddr keeps failing:


```
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
```


----------



## ralphbsz (Feb 9, 2014)

*Re: Why do some steps at boot take so long?*



			
				lionoceros said:
			
		

> Looks like there's very little disk activity during those steps.
> 
> I changed the /bin/hostname command as you instructed. This is the output of /tmp/hostname.truss:
> ...
> I'm not sure what information this gives me or if it provides any clues as to what could be delaying the hostname and sendmail commands.



Unfortunately, it gives you negative information: Running the `hostname` command takes 0.03 seconds.  Meaning it can not explain why that whole step takes 12 seconds.  Meaning the problem is elsewhere.

My suggestion for how to proceed: Go to the beginning and end of /etc/rc.d/hostname, and add a `date` command there, for example as follows: 

```
echo -n Start of /etc/rc.d/hostname ""
date
...
echo -n End of /etc/rc.d/hostname ""
date
```
That will show you how long the whole script took.  Now, this might be very frustrating, since it might take a small fraction of a second.  In that case, the problem is not that script itself, but the one that runs before or after.  So figure out which script runs before and after `hostname`, and start instrumenting it too.

By the way, I apologize for having sent you down the wrong path with putting `truss` into the `hostname` script.  It looked like a good candidate, because that script seems to take 12 seconds, yet it is very simple.

Now completely changing gears: It's likely that gethostbyaddr and its friends are the root cause of the problem.  Most likely, there is something broken in host name resolution, and that code tends to be full of retries and timeouts.  Personally, my solution to all these problems is "simply" (conceptually simple and a lot of work): I always run a full BIND name server at home, which is authorative for all host names and IP addresses used in my domain and on my network, and which goes back to the normal DNS infrastructure (starting at the root servers) for the rest of the world.  Setting this up takes an expert half hour, and a beginner would probably not even survive it, because it can be so frustrating that they will commit ritual suicide by swallowing a whole PCI board after 17 hours of debugging.

Here is where I would start: Make a list of all host names and IP addresses that are in use.  Then add entries for all of them in /etc/hosts.  As @wblock said: Write both the short version and the fully qualified version.  Use the host and dig commands to verify that all your host names work correctly and quickly.  Warning: When querying for IP addresses with dig, you have to manually convert them to names, so 192.168.0.1 turns into 1.0.168.192.in-addr.arpa, and your 10.0.2.15 would be 15.2.0.10.in-addr.arpa.

In the long run, you have to figure out what to do in the long run (<- bad pun).  Even if you get your system to work with /etc/hosts, that may not be a good solution: if you have more than one machine at home, then /etc/hosts on *every* machine has to be correct and include *all* machines, meaning that it turns management into an order O(n^2) task.  On the other hand, doing the "right" thing (meaning: set up a real server, which does DHCP serving, DNS serving, and is perfectly correctly organized) has high initial startup cost, to learn to do it.  And debugging this stuff isn't easy, as you have found.  Concrete advice for how to manage your network depends heavily on how many machines you have, and what their usage pattern will be.


----------



## lionoceros (Feb 9, 2014)

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

@ralphbsz, I appreciate your extensive help. I'll look into /etc/hosts and see what I can do there. My question now is why has this become more complicated all of a sudden? I have a relatively simple setup: just a FreeBSD virtual machine using VirtualBox's NAT networking. All host names and IP addresses, I would imagine, would just be vbsd.local, 127.0.0.1, and maybe 10.0.2.15 (which VirtualBox assigns to the guest). 

Is there something that changed with FreeBSD 10 regarding sendmail? In 9.2 I don't believe the last two messages even appeared at boot.


----------



## worldi (Feb 9, 2014)

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

Note that sendmail is not the problem, DNS is. And yes, there have been changes with DNS in 10.0-RELEASE: BIND was replaced by Unbound and LDNS. However, these changes should not affect your system in this case.

What happens if you comment out the "search" line in your resolv.conf?


----------



## lionoceros (Feb 9, 2014)

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

That didn't change the boot time. However, I learned a bit more:

/etc/resolv.conf is regenerated back to its original form (below) after a reboot

```
# Generated by resolvconf
search gateway.2wire.net
nameserver 192.168.1.254
```

Also these two links suggest that I should probably use 10.0.2.3 instead of 192.168.1.254 for my name server:
http://iftekhar.blogspot.com/2012/05/vi ... erver.html
https://forums.virtualbox.org/viewtopic ... 10&start=0

Is there a way I could change resolv.conf permanently using resolvconf? This is the output of `# resolvconf -v`

```
DOMAINS='gateway.2wire.net:192.168.1.254'
SEARCH='gateway.2wire.net'
NAMESERVERS='192.168.1.254'
LOCALNAMESERVERS=''
```


----------



## lionoceros (Feb 9, 2014)

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

Alternatively, is there a way to run the network configuration program in bsdinstall and choose to configure my network manually rather than using DHCP? (If that would help.)


----------



## wblock@ (Feb 9, 2014)

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

I'm still waiting to see /var/log/maillog.  It's best to look right after `# cd /etc/mail && make restart`.


----------



## worldi (Feb 9, 2014)

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

Fascinating. I hadn't heard of resolvconf yet. Its man page mentions resolvconf.conf() [0].

Here's an example of how to use it. des@ has a blog post about the new DNS stuff that might help you.

[0] OT: Somehow this reminds me of Buckminster Fuller's "inspectors of inspectors" quote.


----------



## ralphbsz (Feb 9, 2014)

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

I have no experience with FreeBSD 10.  Still running 9.X.  Nor with VirtualBox.

If someone is changing /etc/resolv.conf, it's probably the DHCP client.  You probably have your system configured to set the IP address by DHCP.  There are ways to make it so the DHCP client doesn't change /etc/resolv.conf, they have been discussed here.  Since my FreeBSD machine is not a DHCP client, I don't remember which ones work well.

If you want to stop using DHCP (and take the risk that the IP address you need to use suddenly changes!), the way I turn it off is: edit /etc/rc.conf, and replace
	
	



```
ifconfig_em0=DHCP
```
 with
	
	



```
ifconfig_em0=" inet 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255 description 'House server external'"
```
(obviously replacing your IP addresses and description).

This process is risky.  It would probably be a better idea to figure out how resolveconf works, but I haven't needed that yet, so I can't help.

Still, putting everything into /etc/hosts is a good idea to debug the problem, and make it go away (either temporarily or permanently).


----------



## lionoceros (Feb 9, 2014)

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

@wblock@ I posted /var/log/maillog earlier, but here it is again:


```
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
```

I just created the file /etc/resolvconf.conf and added the following:

```
search_domains="10.0.2.2"
name_server="10.0.2.3"
```
Then updated with `# resolvconf -u` using information from http://pivotallabs.com/using-resolvconf-conf-to-tweak-resolv-conf/ and http://iftekhar.blogspot.com/2012/05/virtualbox-dhcp-nameserver.html. 

Didn't work.


----------



## wblock@ (Feb 10, 2014)

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

IFrom the log, Sendmail is looking for 10.0.2.15 to resolve.  Why not just enter that in /etc/hosts?  If it does not resolve to the right name, the log should show what name it expects.


----------



## lionoceros (Feb 10, 2014)

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

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

/etc/hosts

```
# $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

```
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).


----------



## nanotek (Feb 10, 2014)

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

In /etc/hosts change:

```
10.0.2.15
```
to:

```
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).


----------



## wblock@ (Feb 10, 2014)

*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.


----------



## lionoceros (Feb 10, 2014)

*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.*
> ...



I changed the line in /etc/hosts to:


```
10.0.2.15		vbsd.local vbsd
```

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


```
search_domains="10.0.2.2"
name_servers="10.0.2.3"
```

Which changes /etc/resolv.conf to:


```
# 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.


----------



## lionoceros (Feb 10, 2014)

*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`

```
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:

```
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.

```
local
vbsd.local
```
It didn't speed up the sendmail steps at boot.


----------



## lionoceros (Feb 13, 2014)

*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:

```
# $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:

```
::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:

```
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:

```
#ifconfig_em0_ipv6="inet6 accept_rtadv"
```


To summarize, add this line to /etc/hosts

```
::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


----------



## wblock@ (Feb 13, 2014)

*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`.


----------



## lionoceros (Feb 13, 2014)

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

@wblock@ Here is the output of `rcorder /etc/rc.d/* | less`

```
/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.


----------



## wblock@ (Feb 13, 2014)

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

If you're not using IPv6, why not disable it entirely?  See https://forums.freebsd.org/viewtopic.php?&t=29042.


----------



## ralphbsz (Feb 13, 2014)

*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.


----------



## lionoceros (Feb 13, 2014)

*Re:  Why do hostname and sendmail steps at boot take so l*

@ralphbsz Hey no worries! Thanks for all your help!

@wblock@ Good idea. Thanks for the link!


----------

