# Restarting:/etc/rc.sendmail: restart-mta: /var/run/sendmail.pid not found  sendmail-c



## c00kie (Apr 28, 2013)

Hi.

I'm here again but hopefully Unix gets easier. 

I'm trying to reinstall/restart my MTA afresh; getting back to base settings really so I can at least try to send/accept mail from internal users/external hosts (i.e. Yahoo, Gmail etc) to my FreeBSD server.

`# cd /etc/mail`
`# mv hostname.mc hostname.mc.bak`
`# make`

Pause for a second; I am correct in thinking that *my* hostname.mc file is actually: my.fullyqualifieddomain.com.mc or the result of `# hostname`?

Advice: (Add only the bare minimum required to run to hostname.mc, like smart hosting. It may not need anything.)

Stood in /etc/mail.

`# make all install restart`
and
`# service sendmail status`

```
sendmail is not running.
sendmail_clientmqueue is running as pid 51326.
```
`# make restart`

```
Restarting:/etc/rc.sendmail: restart-mta: /var/run/sendmail.pid not found
 sendmail-clientmqueue.
```

OK, so where do I find/copy/generate/obtain a copy of /var/run/sendmail.pid?


----------



## wblock@ (Apr 28, 2013)

After moving the existing _hostname_.mc, run `make`.  It will show the name of the .mc file it creates.

/var/run/sendmail.pid is automatically created when sendmail is started.


----------



## c00kie (Apr 29, 2013)

wblock@ said:
			
		

> After moving the existing _hostname_.mc, run `make`.



I'm a little behind here. I don't have/see a _hostname_.mc file?

`pwd`
/etc/mail

`ls`

```
Makefile			freebsd.submit.cf		submit.cf
README				freebsd.submit.mc		virtusertable
access				helpfile			virtusertable.db
access.db			local-host-names		virtusertable.sample
access.sample			mailer.conf			me.mydomain.org.cf
aliases				mailertable.sample		me.mydomain.org.mc
aliases.db			relay-domains			me.mydomain.org.mc.bak
freebsd.cf			sendmail.cf			me.mydomain.org.submit.cf
freebsd.mc			statistics			me.mydomain.org.submit.mc
```


Are we talking about me.mydomain.org.mc?


----------



## c00kie (Apr 29, 2013)

OK, I'm satisfied its  me.mydomain.org.mc

Stood in /etc/mail I build my .mc file.

`make`

```
cp freebsd.mc me.mydomain.org.mc
/usr/bin/m4 -D_CF_DIR_=/usr/share/sendmail/cf/   /usr/share/sendmail/cf/m4/cf.m4 me.mydomain.org.mc > me.mydomain.org.cf
```

Try and start Sendmail:

`make start`

```
Starting: sendmail554 5.3.5 /etc/mail/sendmail.cf: line 279: Unknown address family inet6 in Family=option
 sendmail-clientmqueue.
```

I dont want to have to edit /etc/mail/sendmail.cf directly. Can you advise how to remove 
	
	



```
line 279: Unknown address family inet6
```
 this issue?


----------



## kpa (Apr 29, 2013)

What kind of system is this? All recent and supported versions of FreeBSD come with inet6(4) support built in.


----------



## wblock@ (Apr 29, 2013)

Edit me.mydomain.org.mc.  Change


```
DAEMON_OPTIONS(`Name=IPv6, Family=inet6, Modifiers=O')
```

to


```
[color="Red"]dnl[/color] DAEMON_OPTIONS(`Name=IPv6, Family=inet6, Modifiers=O')
```

Rebuild, install, and restart:

`# make all install restart`


----------



## c00kie (Apr 29, 2013)

I've followed that to the letter. It still is being a b*&%$ though.

`make all install restart`

```
/usr/bin/m4 -D_CF_DIR_=/usr/share/sendmail/cf/   /usr/share/sendmail/cf/m4/cf.m4 my.domain.org.mc > my.domain.org.cf
install -m 444 my.domain.org.cf /etc/mail/sendmail.cf
install -m 444 my.domain.org.submit.cf /etc/mail/submit.cf
Restarting:/etc/rc.sendmail: restart-mta: /var/run/sendmail.pid not found
 sendmail-clientmqueue.
```

/var/run/sendmail.pid should be automatically created when sendmail is started?


----------



## wblock@ (Apr 29, 2013)

Yes.  The message will be seen if sendmail was not already running.  Now that you have it built and installed, try restarting it again:
`# make restart`


----------



## c00kie (Apr 29, 2013)

wblock@ said:
			
		

> Yes.  The message will be seen if sendmail was not already running.  Now that you have it built and installed, try restarting it again:
> `# make restart`



`pwd`

```
/etc/mail
```
`make restart`

```
Restarting:/etc/rc.sendmail: restart-mta: /var/run/sendmail.pid not found
 sendmail-clientmqueue.
```

`make restart`

```
Restarting:/etc/rc.sendmail: restart-mta: /var/run/sendmail.pid not found
 sendmail-clientmqueue.
```

`make restart`

```
Restarting:/etc/rc.sendmail: restart-mta: /var/run/sendmail.pid not found
 sendmail-clientmqueue.
```


----------



## c00kie (Apr 29, 2013)

kpa said:
			
		

> What kind of system is this?



FreeBSD 9.0


----------



## kpa (Apr 29, 2013)

Actually you want to use just `make start` or `service sendmail start` if there's no process already running. `make restart` is a shortcut for `make stop; make start` and if there's no running process there won't be a pid file either.


----------



## wblock@ (Apr 30, 2013)

Is it still not running?  Wait... is Sendmail enabled in /etc/rc.conf?


```
sendmail_enable="YES"
```

What does /var/log/maillog show?


----------



## c00kie (Apr 30, 2013)

wblock@ said:
			
		

> Is it still not running?  Wait... is Sendmail enabled in /etc/rc.conf?
> 
> 
> ```
> ...



`service sendmail status`

```
sendmail is not running.
sendmail_clientmqueue is running as pid 54990.
```

/etc/rc.conf

```
sendmail_enable="YES"
```

`cat /var/log/maillog | less` reveals a huge amount of messages of this nature:

```
Apr 30 00:04:22 web sm-msp-queue[55711]: r3TJCSRQ054573: to=root, delay=08:51:54, xdelay=00:00:00, mailer=relay, pri=16146366, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
Apr 30 00:06:06 web sm-msp-queue[55716]: r3S7U6v1048411: to=1cookie, ctladdr=admin (1004/1004), delay=1+20:36:00, xdelay=00:00:00, mailer=relay, pri=74820038, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
Apr 30 00:31:34 web sm-msp-queue[55758]: r3S7IYfI048384: to=myaccount@yahoo.com, ctladdr=admin (1004/1004), delay=1+21:13:00, xdelay=00:00:00, mailer=relay, pri=75720070, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
Apr 30 01:31:34 web sm-msp-queue[55893]: r3SCRuwi050158: to=1cookie, delay=1+17:03:38, xdelay=00:00:00, mailer=relay, pri=69241431, relay=[127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
```

It looks like the problem lies with 
	
	



```
Connection refused by [127.0.0.1]
```
 It's not a firewall issue as my VPS providers opened the ports that Sendmail is listening on.


----------



## c00kie (Apr 30, 2013)

kpa said:
			
		

> Actually you want to use just `make start` or `service sendmail start` if there's no process already running. `make restart` is a shortcut for `make stop; make start` and if there's no running process there won't be a pid file either.



Hang on!

`make start`

```
Starting: sendmail sendmail-clientmqueue.
```
`service sendmail status`

```
sendmail is running as pid 55984.
sendmail_clientmqueue is running as pid 54990.
```

I *think* this means it's started successfully


----------



## kpa (Apr 30, 2013)

Verify with sockstat(1) that sendmail(8) is indeed listening for connections on correct addresses.


----------



## c00kie (Apr 30, 2013)

kpa said:
			
		

> Verify with sockstat(1) that sendmail(8) is indeed listening for connections on correct addresses.



`# sockstat`

```
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS 
smmsp    sendmail   55987 3  dgram  -> /var/run/log
root     sendmail   55984 3  tcp4   *:***                 *:*
root     sendmail   55984 4  dgram  -> /var/run/logpriv
root     sendmail   55984 5  tcp4   *:***                *:*
smmsp    sendmail   54990 3  dgram  -> /var/run/log
smmsp    sendmail   54492 3  dgram  -> /var/run/log
smmsp    sendmail   48495 3  dgram  -> /var/run/log
smmsp    sendmail   48465 3  dgram  -> /var/run/log
smmsp    sendmail   48460 3  dgram  -> /var/run/log
```

All would appear well. Thanks.


----------

