sendmail のトラブル

Debian LS-AVL/A

sendmail をインストールして、設定を進めていたのだが、 どうしても
Feb 25 11:06:00 av sendmail[32651]: q1P260uW032651: from=root, size=214, class=0, nrcpts=1, msgid=<201202250206.q1P260uW032651 @ av.yamasita.jp>, relay=root @ localhost
Feb 25 11:06:01 av sm-mta[32654]: q1P260Xb032654: SYSERR(root): collect: Cannot write ./dfq1P260Xb032654 (bfcommit, uid=0, gid=109): No such file or directory
Feb 25 11:06:01 av sm-mta[32654]: q1P260Xb032654: from=, size=458, class=0, nrcpts=1, proto=ESMTP, daemon=MTA-v4, relay=localhost [127.0.0.1]
Feb 25 11:06:01 av sendmail[32651]: q1P260uW032651: to=yasunari, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30214, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: 421 4.3.0 collect: Cannot write ./dfq1P260Xb032654 (bfcommit, uid=0, gid=109): No such file or directory
となって、メールが送れなかった。
何が No such file or directory なのか、さっぱりわからず、はまっていた。

sendmail の再インストール

ちょっと思い立って sendmail を再インストールしてみることにした。

sendmail の削除

root@av:/etc/mail# dpkg -P sendmail-cf sendmail-bin sendmail-base sendmail sensible-mda
して、
dpkg: warning: while removing sendmail-bin, directory '/usr/share/doc/sendmail' not empty so not removed.
dpkg: warning: while removing sendmail-bin, directory '/var/spool/mqueue-client' not empty so not removed.
dpkg: warning: while removing sendmail-bin, directory '/var/lib/sendmail' not empty so not removed.
dpkg: warning: while removing sendmail-bin, directory '/var/run/sendmail/mta' not empty so not removed.
dpkg: warning: while removing sendmail-bin, directory '/var/run/sendmail/stampdir' not empty so not removed.
dpkg: warning: while removing sendmail-bin, directory '/var/run/sendmail' not empty so not removed.
と言われたので、手で消して
root@av:/etc/mail# ps ax
  PID TTY      STAT   TIME COMMAND
	:
27017 ?        Ss     0:00 sendmail: MTA: accepting connections
	:
まだ動いていた!ので、kill

再度インストール

root@av:/etc/mail# apt-get install sendmail
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  sendmail-base sendmail-bin sendmail-cf sensible-mda
Suggested packages:
  sendmail-doc rmail ca-certificates logcheck resolvconf sasl2-bin openssl
The following NEW packages will be installed:
  sendmail sendmail-base sendmail-bin sendmail-cf sensible-mda
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/2022 kB of archives.
After this operation, 4985 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Selecting previously deselected package sendmail-base.
(Reading database ... 16448 files and directories currently installed.)
Unpacking sendmail-base (from .../sendmail-base_8.14.3-9.4_all.deb) ...
Selecting previously deselected package sendmail-cf.
Unpacking sendmail-cf (from .../sendmail-cf_8.14.3-9.4_all.deb) ...
Selecting previously deselected package sendmail-bin.
Unpacking sendmail-bin (from .../sendmail-bin_8.14.3-9.4_armel.deb) ...
Selecting previously deselected package sensible-mda.
Unpacking sensible-mda (from .../sensible-mda_8.14.3-9.4_armel.deb) ...
Selecting previously deselected package sendmail.
Unpacking sendmail (from .../sendmail_8.14.3-9.4_all.deb) ...
Processing triggers for man-db ...
Setting up sendmail-base (8.14.3-9.4) ...
adduser: Warning: The home directory `/var/lib/sendmail' does not belong to the user you are currently creating.
adduser: Warning: The home directory `/var/lib/sendmail' does not belong to the user you are currently creating.
Setting up sendmail-cf (8.14.3-9.4) ...
Setting up sendmail-bin (8.14.3-9.4) ...
update-rc.d: warning: sendmail stop runlevel arguments (0 1 6) do not match LSB Default-Stop values (1)
update-alternatives: using /usr/lib/sm.bin/sendmail to provide /usr/sbin/sendmail-mta (sendmail-mta) in auto mode.
update-alternatives: using /usr/lib/sm.bin/sendmail to provide /usr/sbin/sendmail-msp (sendmail-msp) in auto mode.
update-alternatives: warning: not replacing /usr/share/man/man8/sendmail.8.gz with a link.

You are doing a new install, or have erased /etc/mail/sendmail.mc.
If you've accidentaly erased /etc/mail/sendmail.mc, check /var/backups.

I am creating a safe, default sendmail.mc for you and you can
run sendmailconfig later if you need to change the defaults.

Stopping Mail Transport Agent (MTA): sendmail.
Updating sendmail environment ...
Validating configuration.
Writing configuration to /etc/mail/sendmail.conf.
Writing /etc/cron.d/sendmail.
Could not open /etc/mail/databases(No such file or directory), creating it.
Could not open /etc/mail/sendmail.mc(No such file or directory)
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Writing configuration to /etc/mail/sendmail.conf.
Writing /etc/cron.d/sendmail.
Turning off Host Status collection
Could not open /etc/mail/databases(No such file or directory), creating it.
Reading configuration from /etc/mail/sendmail.conf.
Validating configuration.
Creating /etc/mail/databases...

Checking filesystem, this may take some time - it will not hang!
  ...   Done.
	:
	:

カスタマイズ

/etc/mail の下、sendmail.mc 等を修正(詳細非公開)

make, sendmail の restart

テスト

root@av:/etc/mail# date | mail yasunari
root@av:/etc/mail# tail /var/log/mail.log
	:
	:
Feb 25 11:43:23 av sendmail[6815]: q1P2hNiT006815: from=root, size=214, class=0, nrcpts=1, msgid=<201202250243.q1P2hNiT006815 @ av.yamasita.jp>, relay=root @ localhost
Feb 25 11:43:23 av sm-mta[6819]: q1P2hN96006819: from=, size=458, class=0, nrcpts=1, msgid=<201202250243.q1P2hNiT006815 @ av.yamasita.jp>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Feb 25 11:43:23 av sendmail[6815]: q1P2hNiT006815: to=yasunari, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30214, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (q1P2hN96006819 Message accepted for delivery)
Feb 25 11:43:23 av sm-mta[6820]: q1P2hN96006819: to=, ctladdr= (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30674, dsn=2.0.0, stat=Sent
	:
	:
root@av:/etc/mail# Mail -f /var/mail/yasunari
Heirloom mailx version 12.4 7/29/08.  Type ? for help.
"/var/mail/yasunari": 1 message 1 unread
>U  1 root               Sat Feb 25 11:43   20/736
? 1
Message  1:
From root@yamasita.jp  Sat Feb 25 11:43:23 2012
Return-Path: 
From: root 
Date: Sat, 25 Feb 2012 11:43:23 +0900
To: yasunari@yamasita.jp
User-Agent: Heirloom mailx 12.4 7/29/08
Content-Type: text/plain; charset=us-ascii
Status: RO

Sat Feb 25 11:43:23 JST 2012

?
ようやく動いた。

Postfix やら exim やら、いろいろ試行錯誤していたので、 そのゴミが残っていた???
でも、ゴミのせいで No such file or directory というのも 考えにくいし、、、

深く考えず、先に進むことにする




LS-AVL/A
楽天市場
Amazon
uWorks
ValuMore
Yahoo!ショッピング


sendmail のインストール
ハックの記録
LinkStation/玄箱 をハックしよう

popd のインストール

Copyright (C) 2003-2012 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市