![Postfix 仅在“systemctl daemon-reload”后启动](https://linux22.com/image/711718/Postfix%20%E4%BB%85%E5%9C%A8%E2%80%9Csystemctl%20daemon-reload%E2%80%9D%E5%90%8E%E5%90%AF%E5%8A%A8.png)
今天我升级了 Postfix,一切都运行良好,直到我决定重新启动服务器,看看一切是否恢复。
一切顺利,但 systemd 似乎“忽略”了 Postfix 启动:
Oct 7 22:59:25 [REDACTED] systemd[1]: Stopped Postfix Mail Transport Agent.
Oct 7 22:59:25 [REDACTED] systemd[1]: Stopping Postfix Mail Transport Agent...
Oct 7 22:59:25 [REDACTED] systemd[1]: Starting Postfix Mail Transport Agent...
Oct 7 22:59:25 [REDACTED] systemd[1]: Started Postfix Mail Transport Agent.
正如你所看到的没有关于 Postfix 启动的任何信息预计会是这样:
postfix: Postfix is running with backwards-compatible default settings
postfix: See http://www.postfix.org/COMPATIBILITY_README.html for details
postfix: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
postfix/postfix-script: starting the Postfix mail system
当我输入
service postfix start
启动过程太快了,查看进程列表
ps -ef
没有列出任何 Postfix 服务,如 pickup、tlsmgr 等。
现在要解决这个问题,我发现我只需要重新加载 systemd
systemctl daemon-reload
使用时
service postfix start
systemd 按照应有的方式完成其工作:
Oct 7 23:00:08 [REDACTED] systemd[1]: Reloading.
Oct 7 23:00:08 [REDACTED] systemd[1]: apt-daily-upgrade.timer: Adding 15min 23.517714s random time.
Oct 7 23:00:08 [REDACTED] systemd[1]: apt-daily.timer: Adding 3h 21min 57.996507s random time.
Oct 7 23:00:28 [REDACTED] systemd[1]: Created slice system-postfix.slice.
Oct 7 23:00:28 [REDACTED] systemd[1]: Starting Postfix Mail Transport Agent (instance -)...
Oct 7 23:00:29 [REDACTED] postfix[1233]: Postfix is running with backwards-compatible default settings
Oct 7 23:00:29 [REDACTED] postfix[1233]: See http://www.postfix.org/COMPATIBILITY_README.html for details
Oct 7 23:00:29 [REDACTED] postfix[1233]: To disable backwards compatibility use "postconf compatibility_level=2" and "postfix reload"
Oct 7 23:00:30 [REDACTED] postfix/postfix-script[1333]: starting the Postfix mail system
Oct 7 23:00:30 [REDACTED] postfix/master[1335]: daemon started -- version 3.1.6, configuration /etc/postfix
Oct 7 23:00:30 [REDACTED] systemd[1]: Started Postfix Mail Transport Agent (instance -).
当我重启时,我必须重新加载 systemd 才能通过服务命令使 Postfix 工作。这是一个非常奇怪的行为,我在网上找不到任何答案。
系统规格:
中央处理器:英特尔 (R) 至强 (R) CPU E5-2670 v3 @ 2.30GHz
记忆:12 GB
固态硬盘:240 GB
操作系统:Debian 9 Stretch(64 位)
所有软件包都是最新的。
使用 KVM 虚拟化。
postfix 服务
[Unit]
Description=Postfix Mail Transport Agent
Conflicts=sendmail.service exim4.service
ConditionPathExists=/etc/postfix/main.cf
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/true
ExecReload=/bin/true
[Install]
WantedBy=multi-user.target
[Unit]
Description=Postfix Mail Transport Agent (instance %i)
Documentation=man:postfix(1)
PartOf=postfix.service
Before=postfix.service
ReloadPropagatedFrom=postfix.service
After=network-online.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
GuessMainPID=no
ExecStartPre=/usr/lib/postfix/configure-instance.sh %i
ExecStart=/usr/sbin/postmulti -i %i -p start
ExecStop=/usr/sbin/postmulti -i %i -p stop
ExecReload=/usr/sbin/postmulti -i %i -p reload
[Install]
WantedBy=multi-user.target
我尝试过用以下方法修复这个问题
systemctl enable postfix.service
但那也不起作用。
感谢您的帮助!
编辑:好吧,这很奇怪:“网络”服务无法“提升网络接口”。但是当我运行时,ifconfig
IPv4 和 IPv6 接口均已正确启动并运行。
Okt 10 20:48:43 [REDACTED] ifup[423]: ifup: failed to bring up eth0
Okt 10 20:48:43 [REDACTED] systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Okt 10 20:48:43 [REDACTED] systemd[1]: Failed to start Raise network interfaces.
Okt 10 20:48:43 [REDACTED] systemd[1]: networking.service: Unit entered failed state.
Okt 10 20:48:43 [REDACTED] systemd[1]: networking.service: Failed with result 'exit-code'.
14 个月前,我只触碰过interfaces
一次他们分配的 IP 地址。
答案1
好的,最终帮助我的是这个简单的命令:
systemctl enable postfix@-
重启后一切正常。
答案2
我有同样的问题。似乎是从 stretch 9.1 升级到 stretch 9.2 后出现的错误: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=877992
您是否尝试过按照那里的说明重新安装 postfix?这对我的系统没有帮助,但也许您运气更好。