# Where is the /etc/mail from?



## goldenfire (Jan 28, 2010)

My /etc/mail/Makefile did not work well. After some effort to search for the reason, I decide to reinstall sendmail with ports.
I found the /etc/mail is still the older one.
So even after reinstall, I still face the same problem. /etc/mail/Makefile still does not work. 
Then I made a silly decision that I removed all the /etc/mail and reinstall sendmail again.
OK, this time I did not get the /etc/mail/Makefile at all.
Could someone tell me where is this Makefile from?


```
ns# pwd
/etc/mail
ns# make
"Makefile", line 80: warning: duplicate script for target "ns.goldenfire.com" ignored
make: don't know how to make ns.goldenfire. Stop
```

Makefile version
# $FreeBSD: src/etc/mail/Makefile,v 1.36.30.1.2.1 2009/10/25 01:10:29 kensmith Exp $


----------



## goldenfire (Jan 28, 2010)

```
ns# cat Makefile
#
# $FreeBSD: src/etc/mail/Makefile,v 1.36.30.1.2.1 2009/10/25 01:10:29 kensmith Exp $
#
# This Makefile provides an easy way to generate the configuration
# file and database maps for the sendmail(8) daemon.
#
# The user-driven targets are:
#
# all     - Build cf, maps and aliases
# cf      - Build the .cf file from .mc file
# maps    - Build the feature maps
# aliases - Build the sendmail aliases
# install - Install the .cf file as /etc/mail/sendmail.cf
#
# For acting on both the MTA daemon and MSP queue running daemon:
# start        - Start both the sendmail MTA daemon and MSP queue running
#                daemon with the flags defined in /etc/defaults/rc.conf or
#                /etc/rc.conf
# stop         - Stop both the sendmail MTA daemon and MSP queue running
#                daemon
# restart      - Restart both the sendmail MTA daemon and MSP queue running
#                daemon
#
# For acting on just the MTA daemon:
# start-mta    - Start the sendmail MTA daemon with the flags defined in
#                /etc/defaults/rc.conf or /etc/rc.conf
# stop-mta     - Stop the sendmail MTA daemon
# restart-mta  - Restart the sendmail MTA daemon
#
# For acting on just the MSP queue running daemon:
# start-mspq   - Start the sendmail MSP queue running daemon with the
#                flags defined in /etc/defaults/rc.conf or /etc/rc.conf
# stop-mspq    - Stop the sendmail MSP queue running daemon
# restart-mspq - Restart the sendmail MSP queue running daemon
#
# Calling `make' will generate the updated versions when either the
# aliases or one of the map files were changed.
#
# A `make install` is only necessary after modifying the .mc file. In
# this case one would normally also call `make restart' to allow the
# running sendmail to pick up the changes as well.
#
# ------------------------------------------------------------------------
# This Makefile uses `<HOSTNAME>.mc' as the default MTA .mc file.  This
# can be changed by defining SENDMAIL_MC in /etc/make.conf, e.g.:
#
#       SENDMAIL_MC=/etc/mail/myconfig.mc
#
# If '<HOSTNAME>.mc' does not exist, it is created using 'freebsd.mc'
# as a template.
#
# It also uses '<HOSTNAME>.submit.mc' as the default mail submission .mc
# file.  This can be changed by defining SENDMAIL_SUBMIT_MC in
# /etc/make.conf, e.g.:
#
#       SENDMAIL_SUBMIT_MC=/etc/mail/mysubmit.mc
#
# If '<HOSTNAME>.submit.mc' does not exist, it is created using
# 'freebsd.submit.mc' as a template.
# ------------------------------------------------------------------------
#
# The Makefile knows about the following maps:
# access, bitdomain, domaintable, genericstable, mailertable, userdb,
# uucpdomain, virtusertable
#

.ifndef SENDMAIL_MC
SENDMAIL_MC!=           hostname
SENDMAIL_MC:=           ${SENDMAIL_MC}.mc

${SENDMAIL_MC}:
        cp freebsd.mc ${SENDMAIL_MC}
.endif

.ifndef SENDMAIL_SUBMIT_MC
SENDMAIL_SUBMIT_MC!=    hostname
SENDMAIL_SUBMIT_MC:=    ${SENDMAIL_SUBMIT_MC}.submit.mc

${SENDMAIL_SUBMIT_MC}:
        cp freebsd.submit.mc ${SENDMAIL_SUBMIT_MC}
.endif

INSTALL_CF=             ${SENDMAIL_MC:R}.cf

.ifndef SENDMAIL_SET_USER_ID
INSTALL_SUBMIT_CF=      ${SENDMAIL_SUBMIT_MC:R}.cf
.endif

SENDMAIL_ALIASES?=      /etc/mail/aliases

#
# This is the directory where the sendmail configuration files are
# located.
#
.if exists(/usr/share/sendmail/cf)
SENDMAIL_CF_DIR?=       /usr/share/sendmail/cf
.elif exists(/usr/src/contrib/sendmail/cf)
SENDMAIL_CF_DIR?=       /usr/src/contrib/sendmail/cf
.endif

#
# The sendmail startup script
#
SENDMAIL_START_SCRIPT?= /etc/rc.sendmail

#
# Some useful programs we need.
#
SENDMAIL?=              /usr/sbin/sendmail
MAKEMAP?=               /usr/sbin/makemap
M4?=                    /usr/bin/m4

# Permissions for generated maps
SENDMAIL_MAP_PERMS?=    0640

# Set a reasonable default
.MAIN: all

#
# ------------------------------------------------------------------------
#
# The Makefile picks up the list of files from SENDMAIL_MAP_SRC and
# stores the matching .db filenames in SENDMAIL_MAP_OBJ if the file
# exists in the current directory.  SENDMAIL_MAP_TYPE is the database
# type to use when calling makemap.
#
SENDMAIL_MAP_SRC+=      mailertable domaintable bitdomain uucpdomain \
                        genericstable virtusertable access
SENDMAIL_MAP_OBJ=
SENDMAIL_MAP_TYPE?=     hash

.for _f in ${SENDMAIL_MAP_SRC} userdb
.if exists(${_f})
SENDMAIL_MAP_OBJ+=      ${_f}.db
.endif
.endfor

#
# The makemap command is used to generate a hashed map from the textfile.
#
.for _f in ${SENDMAIL_MAP_SRC}
.if (exists(${_f}.sample) && !exists(${_f}))
${_f}: ${_f}.sample
        sed -e 's/^/#/' < ${.OODATE} > ${.TARGET}
.endif

${_f}.db: ${_f}
        ${MAKEMAP} ${SENDMAIL_MAP_TYPE} ${.TARGET} < ${.OODATE}
        chmod ${SENDMAIL_MAP_PERMS} ${.TARGET}
.endfor

userdb.db: userdb
        ${MAKEMAP} btree ${.TARGET} < ${.OODATE}
        chmod ${SENDMAIL_MAP_PERMS} ${.TARGET}


#
# The .cf file needs to be recreated if the templates were modified.
#
M4FILES!=       find ${SENDMAIL_CF_DIR} -type f -name '*.m4' -print

#
# M4(1) is used to generate the .cf file from the .mc file.
#
.SUFFIXES: .cf .mc

.mc.cf: ${M4FILES}
        ${M4} -D_CF_DIR_=${SENDMAIL_CF_DIR}/ ${SENDMAIL_M4_FLAGS} \
            ${SENDMAIL_CF_DIR}/m4/cf.m4 ${@:R}.mc > ${.TARGET}

#
# Aliases are handled separately since they normally reside in /etc
# and can be rebuild without the help of makemap.
#
.for _f in ${SENDMAIL_ALIASES}
${_f}.db: ${_f}
        ${SENDMAIL} -bi -OAliasFile=${.ALLSRC}
        chmod ${SENDMAIL_MAP_PERMS} ${.TARGET}
.endfor

#
# ------------------------------------------------------------------------
#

all: cf maps aliases

clean:

depend:

cf: ${INSTALL_CF} ${INSTALL_SUBMIT_CF}

.ifdef SENDMAIL_SET_USER_ID
install: install-cf
.else
install: install-cf install-submit-cf
.endif

install-cf: ${INSTALL_CF}
.if ${INSTALL_CF} != /etc/mail/sendmail.cf
        ${INSTALL} -m ${SHAREMODE} ${INSTALL_CF} /etc/mail/sendmail.cf
.endif


install-submit-cf: ${INSTALL_SUBMIT_CF}
.ifdef SENDMAIL_SET_USER_ID
        @echo ">>> ERROR: You should not create a submit.cf file if you are using a"
        @echo "           set-user-ID sendmail binary (SENDMAIL_SET_USER_ID is set"
        @echo "           in make.conf)."
        @false
.else
.if ${INSTALL_SUBMIT_CF} != /etc/mail/submit.cf
        ${INSTALL} -m ${SHAREMODE} ${INSTALL_SUBMIT_CF} /etc/mail/submit.cf
.endif
.endif

aliases: ${SENDMAIL_ALIASES:%=%.db}

maps: ${SENDMAIL_MAP_OBJ}

start start-mta start-mspq:
        @if [ -r ${SENDMAIL_START_SCRIPT} ]; then \
                echo -n 'Starting:'; \
                sh ${SENDMAIL_START_SCRIPT} $@; \
                echo '.'; \
        fi

stop stop-mta stop-mspq:
        @if [ -r ${SENDMAIL_START_SCRIPT} ]; then \
                echo -n 'Stopping:'; \
                sh ${SENDMAIL_START_SCRIPT} $@; \
                echo '.'; \
        fi

restart restart-mta restart-mspq:
        @if [ -r ${SENDMAIL_START_SCRIPT} ]; then \
                echo -n 'Restarting:'; \
                sh ${SENDMAIL_START_SCRIPT} $@; \
                echo '.'; \
        fi

# User defined targets
.if exists(Makefile.local)
.include "Makefile.local"
.endif

# For the definition of $SHAREMODE
.include <bsd.own.mk>
ns#
```


----------



## inurneck (Jan 28, 2010)

```
[158]daemon[/usr/src/etc/mail]: ls
Makefile              aliases               virtusertable.sample
README                mailer.conf
access.sample         mailertable.sample
[159]daemon[/usr/src/etc/mail]:
```

Type make install in that directory. You have to have the sources installed and for _*your current *_version. Don't run to ports versions for stuff already on freebsd just because you can't get it to work you should fix the problem where it lies. Unless you have a real reason to. (I like the ports version of ssh2 better.)

Thats how you create more problems, your not learning by running and also end up with security and other related issues with out of date daemons not to mention one in the system not even being used and two sets of configuration files.

 Use the ones that are already in freebsd anyway and just keep freebsd up to date and your all good. 

Occasionally i'll even go into a src folder (within reason) and install a daemon (sendmail) instead of building world.

 For example if i dont have a lot of time but i know sendmail was just updated because of a vulnerability ill go right in its src folder (after updating my sources of course or this is useless and type make install and restart the service.

Make sure your in i386 only if your computer architecture is i386 and make sure your in that folder and not another one before you make install. you could break your install if you do something wrong here know what your doing. If you think your in mail but just in /usr/src/etc and type make install its going to overwrite everything in etc and probably render it unbootable.


----------



## goldenfire (Jan 28, 2010)

Thank you very much.
I tried it but it looks not well.


```
ns# pwd
/usr/src/etc/mail
ns# make install
"Makefile", line 80: warning: duplicate script for target "ns.goldenfire.com" ignored
make: don't know how to make ns.goldenfire. Stop
ns# hostname
ns.goldenfire.com
ns#
```





			
				inurneck said:
			
		

> [158]daemon[/usr/src/etc/mail]: ls
> Makefile              aliases               virtusertable.sample
> README                mailer.conf
> access.sample         mailertable.sample
> ...


----------



## inurneck (Jan 28, 2010)

I think you edited a configuration file and made a mistake yourself I dont think makefile is "bad" at all, the makefile is pulling it in and causing an error. Tell me or paste me ex: let me see the files you edited.


----------



## inurneck (Jan 28, 2010)

Try "make all" if that doesnt work put something instead of ns.goldenfire.com Put  just ns or or try goldenfire.com I dont think it wants the whole thing.


----------



## goldenfire (Jan 28, 2010)

```
ns# ll
total 22
-rw-r--r--  1 root  wheel  6818 Oct 25 10:10 Makefile
-rw-r--r--  1 root  wheel  2905 Oct 25 10:10 README
-rw-r--r--  1 root  wheel   634 Oct 25 10:10 access.sample
-rw-r--r--  1 root  wheel  1667 Oct 25 10:10 aliases
-rw-r--r--  1 root  wheel   409 Oct 25 10:10 mailer.conf
-rw-r--r--  1 root  wheel   253 Oct 25 10:10 mailertable.sample
-rw-r--r--  1 root  wheel   582 Oct 25 10:10 virtusertable.sample
```

All of the files under /usr/src/etc/mail have not been touched from the OS was installed.

I also download a Makefile from 
http://download.altstu.ru/FreeBSD/releases/i386/8.0-RELEASE/etc/mail/Makefile 
and compared with my Makefile by diff. They are same.


----------



## inurneck (Jan 28, 2010)

let me see your /etc/hosts file. You didn't edit *anything* to try and get this to work. Maybe installing sendmail from ports added a "duplicate" something which would explain the error go in the ports sendmail and type make deinstall && make clean


----------



## goldenfire (Jan 28, 2010)

Sorry.
I am not sure the meaning of "put something instead of ns.goldenfire.com"

That is my hostname.
Do you mean I need to change hostname?



			
				inurneck said:
			
		

> Try "make all" if that doesnt work put something instead of ns.goldenfire.com Put  just ns or or try goldenfire.com I dont think it wants the whole thing.


----------



## goldenfire (Jan 28, 2010)

```
ns# cat /etc/hosts
::1                     localhost localhost.goldenfire.com
127.0.0.1               localhost localhost.goldenfire.com
```


----------



## inurneck (Jan 28, 2010)

No, I just thought you edited something causing this but you said you didnt. The sendmail gods are sitting back laughing at me let me read everything you posted more fully and see what I come up with to help you figure this out.

Did you uninstall ports/sendmail yet make deinstall && make clean. If it does it with both its not the system ones fault so lets narrow this down by sticking to one so we know what we are dealing with better.


----------



## goldenfire (Jan 28, 2010)

```
ns# make ns.goldenfire.com
"Makefile", line 80: warning: duplicate script for target "ns.goldenfire.com" ignored
cp freebsd.mc ns.goldenfire.com     .mc
cp: .mc is not a directory
*** Error code 1

Stop in /usr/src/etc/mail.
```


----------



## inurneck (Jan 28, 2010)

go in /usr/src/etc/mail and type make install after you make deinstall && make distclean in the ports/sendmail


----------



## inurneck (Jan 28, 2010)

OK I see you already did that hold on a second.


----------



## goldenfire (Jan 28, 2010)

Thank you very much for you patient.
I have already deinstall sendmail.


```
ns# pkg_info | grep mail
ns#
```




			
				inurneck said:
			
		

> No, I just thought you edited something causing this but you said you didnt. The sendmail gods are sitting back laughing at me let me read everything you posted more fully and see what I come up with to help you figure this out.
> 
> Did you uninstall ports/sendmail yet make deinstall && make clean. If it does it with both its not the system ones fault so lets narrow this down by sticking to one so we know what we are dealing with better.


----------



## inurneck (Jan 28, 2010)

You dont have to type make blah.com just make and make install. But I understand it does it both ways and your just trying things.


----------



## goldenfire (Jan 28, 2010)

I think there is a backspace appending with my hostname
I have already modified it.


----------



## goldenfire (Jan 28, 2010)

```
ns# make
cp freebsd.mc ns.goldenfire.com.mc
cp: freebsd.mc: No such file or directory
*** Error code 1

Stop in /usr/src/etc/mail.
ns#
```
Aha we caught it.
Teach me where is the original mc file?
Do I need to copy them to /usr/src/etc/mail?


----------



## inurneck (Jan 28, 2010)

goldenfire said:
			
		

> ```
> ns# ll
> total 22
> -rw-r--r--  1 root  wheel  6818 Oct 25 10:10 Makefile
> ...




```
[136]daemon[/etc/mail]: ls
Makefile           daemon.cf          freebsd.mc         mailer.conf
README             daemon.mc          freebsd.submit.cf  sendmail.cf
access.sample      daemon.submit.cf   freebsd.submit.mc  submit.cf
aliases            daemon.submit.mc   helpfile
aliases.db         freebsd.cf         local-host-names
[137]daemon[/etc/mail]: make clean
[138]daemon[/etc/mail]: ls
Makefile           daemon.cf          freebsd.mc         mailer.conf
README             daemon.mc          freebsd.submit.cf  sendmail.cf
access.sample      daemon.submit.cf   freebsd.submit.mc  submit.cf
aliases            daemon.submit.mc   helpfile
aliases.db         freebsd.cf         local-host-names
[139]daemon[/etc/mail]: make
/usr/bin/m4 -D_CF_DIR_=/usr/share/sendmail/cf/   /usr/share/sendmail/cf/m4/cf.m4 daemon.mc > daemon.cf
/usr/bin/m4 -D_CF_DIR_=/usr/share/sendmail/cf/   /usr/share/sendmail/cf/m4/cf.m4 daemon.submit.mc > daemon.submit.cf
[140]daemon[/etc/mail]:
```


Thats whats in my /etc/mail If i type make clean im pretty sure the only thing that gets removed is the .db files leaving me with a lot more files than you. I think your missing files for some reason.


----------



## inurneck (Jan 28, 2010)

/usr/share/sendmail/cf) read the readme.


----------



## inurneck (Jan 28, 2010)

When you deleted /etc/mail you deleted files that make cant just recreate itself but needs them and sucks them in. (they aren't there.) You need to read the readme below and follow its instructions to recreate them. I never deleted /etc/mail and had to do this so im giving you the best information I can. Try that and see what you get.



> [187]daemon[/usr/share/sendmail/cf/cf]: more README
> 
> SENDMAIL CONFIGURATION FILES INSTALLATION
> 
> ...


----------



## goldenfire (Jan 28, 2010)

Yes. Because of my silly idea, I thought after reinstall of sendmail from port I could get a fresh /etc/mail dir, I removed all of the files inside /etc/mail.


----------



## inurneck (Jan 28, 2010)

Future reference move shit to /tmp/ you think you dont need. If /tmp deletes itself on your system make a folder "trash" somewhere and use it before you delete anything permanently. It sounds lame but this would not have happened and it has saved me countless times. It's your minds way at the shell for you to organize. As your plugging along commands your like ok I dont need this anymore let me get rid of it rm dontneedthis then later you realize you do. Adding a trash or using tmp is still organized its just a protection layer youll get used to it. then when your sure, you can finally get rid of it.


----------



## inurneck (Jan 28, 2010)

Run those commands, recreate them, verify they are there and type make in /etc/mail I want to know if this fixes your issue.


----------



## goldenfire (Jan 28, 2010)

I will try it carefully. Thank you very much.
You have already taught me how to get a fish.


----------



## inurneck (Jan 28, 2010)

Your welcome but wtf you on about a fish. What's a fish?


----------



## inurneck (Jan 28, 2010)

The suspense was making me sick
lol I googled it. If you give a man a fish he will eat for a day. If you teach a man to fish he will eat for a lifetime. That's nice of you thanks. Glad I could help.


----------



## goldenfire (Jan 28, 2010)

```
ns# cd /usr/share/sendmail/cf/cf
/usr/share/sendmail/cf/cf: No such file or directory.
```


```
ns# cd /etc/mail
ns# make
/usr/sbin/sendmail -bi -OAliasFile=/etc/mail/aliases
/usr/sbin/sendmail: not found
*** Error code 127

Stop in /etc/mail.
ns# pkg_info | grep sendmail
sendmail-8.14.3     Reliable, highly configurable mail transfer agent with util
```


----------



## inurneck (Jan 28, 2010)

make install-cf type that in /etc/mail


----------



## goldenfire (Jan 28, 2010)

inurneck said:
			
		

> Your welcome but wtf you on about a fish. What's a fish?


This is a Chinese proverbs that "Teaching people how to catch a fish is better than just giving him a fish".


----------



## inurneck (Jan 28, 2010)

Yea I know I googled it. thank you that was nice. I didn't know you were from tokyo that's cool. If you give a man a fish he will eat for a day. If you teach a man to fish he will eat for a lifetime.


----------



## inurneck (Jan 28, 2010)

Did you type make install-cf in /etc/mail


----------



## goldenfire (Jan 28, 2010)

inurneck said:
			
		

> The suspense was making me sick
> lol I googled it. If you give a man a fish he will eat for a day. If you teach a man to fish he will eat for a lifetime. That's nice of you thanks. Glad I could help.



I have to say "Google is great!"


----------



## goldenfire (Jan 28, 2010)

inurneck said:
			
		

> Did you type make install-cf in /etc/mail



Yes, it works well.


```
ns# make install-cf
install -m 444 ns.goldenfire.com.cf /etc/mail/sendmail.cf
ns# make
/usr/sbin/sendmail -bi -OAliasFile=/etc/mail/aliases
/usr/sbin/sendmail: not found
*** Error code 127

Stop in /etc/mail.
ns#
```

I have installed sendmail with ports. But why there is not /usr/sbin/sendmail?


----------



## inurneck (Jan 28, 2010)

No, you dont install it from ports. go make deinstall && make distclean again in ports/sendmail sendmail comes with the base operating system which is what we are focusing on getting to work.


----------



## goldenfire (Jan 28, 2010)

Now I believed that all of the problems came from that there is a backspace appending with my hostname.
Because of my silly operation, it got more complicated.


----------



## inurneck (Jan 28, 2010)

once you make deinstall && make distclean in the sendmail ports directory, go to /usr/src/usr.sbin/sendmail and type make install


----------



## goldenfire (Jan 28, 2010)

inurneck said:
			
		

> No, you dont install it from ports. go make deinstall && make distclean again in ports/sendmail sendmail comes with the base operating system which is what we are focusing on getting to work.




```
ns# make deinstall && make distclean
===>  Deinstalling for mail/sendmail
===>   Deinstalling sendmail-8.14.3
===>  Cleaning for sendmail-8.14.3
===>  Deleting distfiles for sendmail-8.14.3
ns# pkg_info | grep sendmail
ns#
```

Then what should I do to install sendmail again?


----------



## inurneck (Jan 28, 2010)

cd /usr/src/usr.sbin/sendmail make install


----------



## inurneck (Jan 28, 2010)

Im hoping you have the src code installed. If not we can do that too.


----------



## goldenfire (Jan 28, 2010)

```
ns# pwd
/usr/src/usr.sbin/sendmail
ns# make install
install -s -o root -g smmsp -m 2555   sendmail /usr/libexec/sendmail
install -o root -g wheel -m 444 mailq.1.gz  /usr/share/man/man1
install -o root -g wheel -m 444 newaliases.1.gz  /usr/share/man/man1
install -o root -g wheel -m 444 aliases.5.gz  /usr/share/man/man5
install -o root -g wheel -m 444 sendmail.8.gz  /usr/share/man/man8
/usr/share/man/man8/hoststat.8.gz -> /usr/share/man/man8/sendmail.8.gz
/usr/share/man/man8/purgestat.8.gz -> /usr/share/man/man8/sendmail.8.gz
ns# ll /usr/sbin/sendmail
ls: /usr/sbin/sendmail: No such file or directory
ns# pkg_info | grep sendmail
ns#
```


----------



## goldenfire (Jan 28, 2010)

inurneck said:
			
		

> Im hoping you have the src code installed. If not we can do that too.



Just as you expected, it looks like I do not have src code.
How to get it? Another silly question


----------



## inurneck (Jan 28, 2010)

no you have it or the directory /usr/src would not exist. pay attention to what you just pasted to me. You installed sendmail in /usr/libexec/


----------



## inurneck (Jan 28, 2010)

goldenfire said:
			
		

> ```
> ns# pwd
> /usr/src/usr.sbin/sendmail
> ns# make install
> ...



look at what it did when you typed make install

/usr/src is all the source code for freebsd. You have it installed or src wouldnt exist


----------



## inurneck (Jan 28, 2010)

it installed sendmail and the manpages now go in /etc/mail and type make


----------



## goldenfire (Jan 28, 2010)

But why pkg_info does not show me the installed info of sendmail?

Another question why we could not install sendmail from port?
If we can not, what is the meaning of this port?


----------



## goldenfire (Jan 28, 2010)

inurneck said:
			
		

> it installed sendmail and the manpages now go in /etc/mail and type make





```
ns# cd /etc/mail
ns# make
/usr/sbin/sendmail -bi -OAliasFile=/etc/mail/aliases
/usr/sbin/sendmail: not found
*** Error code 127

Stop in /etc/mail.
ns#
```


----------



## inurneck (Jan 28, 2010)

```
[133]daemon[/sbin]: pkg_info sendmail
pkg_info: can't find package 'sendmail' installed or in a file!
[134]daemon[/sbin]: ls /usr/libexec/sendmail
sendmail*
[135]daemon[/sbin]:
```

pkg_info is for "packages" you have installed or "ports".  Sendmail comes with the base operating system and is already included. The port exists in case for some reason you don't like the one that comes with the base system. Like the example I gave you with me and ssh I dont like the ssh freebsd comes with so I disable it and use the ports one in /usr/ports/security/ssh2 Do you understand.


----------



## goldenfire (Jan 28, 2010)

Good explanation!
But how to solve the 

```
ns# ll /usr/sbin/sendmail
ls: /usr/sbin/sendmail: No such file or directory
ns# ll /usr/rc.d/sendmail
ls: /usr/rc.d/sendmail: No such file or directory
ns#
```




			
				inurneck said:
			
		

> [133]daemon[/sbin]: pkg_info sendmail
> pkg_info: can't find package 'sendmail' installed or in a file!
> [134]daemon[/sbin]: ls /usr/libexec/sendmail
> sendmail*
> ...


----------



## inurneck (Jan 28, 2010)

That makefile you got from someone else listen to me its for another system. Go into the source directory  


```
[150]daemon[/usr/src/etc]: cd mail
[151]daemon[/usr/src/etc/mail]: ls
Makefile              aliases               virtusertable.sample
README                mailer.conf
access.sample         mailertable.sample
[152]daemon[/usr/src/etc/mail]:
```

copy that Makefile to /etc/mail/


----------



## inurneck (Jan 28, 2010)

wait a minute i need to figure this out myself mine points to sbin as well. give me a minute.


----------



## goldenfire (Jan 28, 2010)

```
ns# cp /usr/src/etc/mail/Makefile   /etc/mail/Makefile
ns# pwd
/usr/src/etc/mail
ns# ll
total 22
-rw-r--r--  1 root  wheel  6818 Oct 25 10:10 Makefile
-rw-r--r--  1 root  wheel  2905 Oct 25 10:10 README
-rw-r--r--  1 root  wheel   634 Oct 25 10:10 access.sample
-rw-r--r--  1 root  wheel  1667 Oct 25 10:10 aliases
-rw-r--r--  1 root  wheel   409 Oct 25 10:10 mailer.conf
-rw-r--r--  1 root  wheel   253 Oct 25 10:10 mailertable.sample
-rw-r--r--  1 root  wheel   582 Oct 25 10:10 virtusertable.sample
ns# cd /etc/mail
ns# make
/usr/sbin/sendmail -bi -OAliasFile=/etc/mail/aliases
/usr/sbin/sendmail: not found
*** Error code 127

Stop in /etc/mail.
ns#
```


----------



## inurneck (Jan 28, 2010)

What else did you delete besides /etc/mail when you installed the ports version.


----------



## goldenfire (Jan 28, 2010)

I think I only removed /etc/mail and deinstall sendmail ports
Maybe removed /etc/rc.d/sendmail. Maybe not.
But I am sure I did not touch /usr/sbin/sendmail


----------



## inurneck (Jan 28, 2010)

```
[187]daemon[/usr/sbin]: ls -al sendmail
lrwxr-xr-x  1 root  wheel  21 Jan 23 13:00 sendmail@ -> /usr/sbin/mailwrapper
[188]daemon[/usr/sbin]: ls -al /usr/libexec/sendmail
total 692
drwxr-xr-x  2 root  wheel     512 Jan 23 13:00 ./
drwxr-xr-x  5 root  wheel    1536 Jan 23 13:00 ../
-r-xr-sr-x  1 root  smmsp  682740 Jan 23 13:00 sendmail*
```

This is what I have on my system. Pay attention to the paths I am in when I run the commands.  @ is a symlink.
 in unix it means a shortcut. Unfortunately I have to go to sleep its 1am and I gotta work in 6 hours hopefully someone else here can help you with this or I can continue to help you tommorrow.


----------



## goldenfire (Jan 28, 2010)

```
ns# ln -s mailwrapper sendmail
ns# cd /etc/mail
ns# make
/usr/sbin/sendmail -bi -OAliasFile=/etc/mail/aliases
/etc/mail/aliases: 27 aliases, longest 10 bytes, 275 bytes total
chmod 0640 /etc/mail/aliases.db
```

Maybe I only need to get /etc/rc.d/sendmail back.


----------



## inurneck (Jan 28, 2010)

very good be proud of yourself! Thats what you needed. Now add sendmail_enable="YES" to /etc/rc.conf 

heres my etc/rc.d/sendmail


```
#!/bin/sh
#
# $FreeBSD: src/etc/rc.d/sendmail,v 1.19.2.1.2.1 2009/10/25 01:10:29 kensmith Exp $
#

# PROVIDE: mail
# REQUIRE: LOGIN cleanvar
#       we make mail start late, so that things like .forward's are not
#       processed until the system is fully operational
# KEYWORD: shutdown

# XXX - Get together with sendmail mantainer to figure out how to
#       better handle SENDMAIL_ENABLE and 3rd party MTAs.
#
. /etc/rc.subr

name="sendmail"
rcvar=`set_rcvar`
required_files="/etc/mail/${name}.cf"
start_precmd="sendmail_precmd"

load_rc_config $name
command=${sendmail_program:-/usr/sbin/${name}}
pidfile=${sendmail_pidfile:-/var/run/${name}.pid}
procname=${sendmail_procname:-/usr/sbin/${name}}

case ${sendmail_enable} in
[Nn][Oo][Nn][Ee])
        sendmail_enable="NO"
        sendmail_submit_enable="NO"
        sendmail_outbound_enable="NO"
        sendmail_msp_queue_enable="NO"
        ;;
esac

# If sendmail_enable=yes, don't need submit or outbound daemon
if checkyesno sendmail_enable; then
        sendmail_submit_enable="NO"
        sendmail_outbound_enable="NO"
fi
# If sendmail_submit_enable=yes, don't need outbound daemon
if checkyesno sendmail_submit_enable; then
        sendmail_outbound_enable="NO"
fi

sendmail_precmd()
{
        # Die if there's pre-8.10 custom configuration file.  This check is
        # mandatory for smooth upgrade.  See NetBSD PR 10100 for details.
        #
        if checkyesno ${rcvar} && [ -f "/etc/${name}.cf" ]; then
                if ! cmp -s "/etc/mail/${name}.cf" "/etc/${name}.cf"; then
                        warn \
    "${name} was not started; you have multiple copies of sendmail.cf."
                        return 1
                fi
        fi

        # check modifications on /etc/mail/aliases
        if checkyesno sendmail_rebuild_aliases; then
                if [ -f "/etc/mail/aliases.db" ]; then
                        if [ "/etc/mail/aliases" -nt "/etc/mail/aliases.db" ]; then
                                echo \
                "${name}: /etc/mail/aliases newer than /etc/mail/aliases.db, regenerating"
                                /usr/bin/newaliases
                        fi
                else
                        echo \
                "${name}: /etc/mail/aliases.db not present, generating"
                                /usr/bin/newaliases
                fi
        fi
}

run_rc_command "$1"

required_files=

if checkyesno sendmail_submit_enable; then
        name="sendmail_submit"
        rcvar=`set_rcvar`
  start_cmd="${command} ${sendmail_submit_flags}"
        run_rc_command "$1"
fi

if checkyesno sendmail_outbound_enable; then
        name="sendmail_outbound"
        rcvar=`set_rcvar`
        start_cmd="${command} ${sendmail_outbound_flags}"
        run_rc_command "$1"
fi

name="sendmail_clientmqueue"
rcvar="sendmail_msp_queue_enable"
start_cmd="${command} ${sendmail_msp_queue_flags}"
pidfile="${sendmail_mspq_pidfile:-/var/spool/clientmqueue/sm-client.pid}"
required_files="/etc/mail/submit.cf"
run_rc_command "$1"
```


----------



## inurneck (Jan 28, 2010)

create the file /etc/rc.d/sendmail and paste all that into it carefully then chmod +x /etc/rc.d/sendmail


----------



## inurneck (Jan 28, 2010)

I have to go to sleep I really hope we didnt miss anything and this resolves your problem. Be more careful next time. You may or may not have gotten lucky. Ill help you verify it all tomorrow.


----------



## goldenfire (Jan 28, 2010)

inurneck said:
			
		

> I have to go to sleep i really hope we diddnt miss anything anf this resolves your problem. Be more careful next time. You may or may not have gotten lucky.



Thank you very much!!
It really costed you much time. sorry , it is late at your hemisphere.


----------



## inurneck (Jan 28, 2010)

In a real world where I wake up and go to work, fight, battle all day long, no one appreciates shit and nothings good enough I come home on the PC and have FreeBSD. 

A community where we can help each other learn to do what we all enjoy and respect each other along the way. Your welcome times ten, I am rusty in all this I took a 5 year break.

 It's been a long time since I seen FreeBSD but I am getting it back little by little. My accident didn't help either.

I bruised my brain in a motor vehicle accident, one of several injuries and nearly died but didn't. Instead in return for my life they took a lot of things I knew previously including *nix and i'll have to relearn them. 

But I am grateful to be able to and it would be a lot harder If I wasn't in this google generation. The human mind is an amazing, delicate and dangerous toy.

 I had it all a thousand times and lost it. It only makes me stronger, less needy and more experienced.

 Anyway, you were worth every minute and it only helped me too in the long run.


----------



## goldenfire (Jan 28, 2010)

Thank a lot to inurneck.
Under his instructions, I caught the reason that there is a backspace character appending to my hostname.
This let /etc/mail/Makefile does not work well.


----------



## inurneck (Jan 28, 2010)

ZZzzz..


----------

