AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1095337
Accepted
Marty Cagas
Marty Cagas
Asked: 2022-03-05 04:41:47 +0800 CST2022-03-05 04:41:47 +0800 CST 2022-03-05 04:41:47 +0800 CST

Postfix 在使用 systemctl 启用其服务并且不会在启动时启动时会导致问题

  • 772

在Rocky Linux 8.5 版机器(下游兼容 bug-for-bug 的 Red Hat Enterprise Linux)上,我配置了 Postfix + Dovecot 设置。在对所有配置错误进行故障排除后,我到了至少可以启动这两个服务的地步。

systemctl enable dovecot.service
systemctl enable postfix.service

重启机器后,我可以看到 Dovecot 在使用systemctl status dovecot. 另一方面,Postfix 无法启动,报告:

[root@mail ~]# systemctl status postfix
● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since ...; 12min ago
  Process: 1419 ExecStart=/usr/sbin/postfix start (code=exited, status=1/FAILURE)
  Process: 1396 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
  Process: 1364 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)

systemd[1]: Starting Postfix Mail Transport Agent...
postfix/postfix-script[1506]: fatal: the Postfix mail system is already running
systemd[1]: postfix.service: Control process exited, code=exited status=1
systemd[1]: postfix.service: Failed with result 'exit-code'.
systemd[1]: Failed to start Postfix Mail Transport Agent.

使用快速检查postfix status表明它确实没有运行。但令人惊讶的是,postfix start然后启动服务没有任何问题。查询postfix status然后报告 Postfix 正在使用新的 PID 愉快地运行。之后再查询systemctl status postfix一次,显示与之前相同的错误报告。

但是,报告的错误没有意义。我可以systemctl disable postfix,重新启动机器,检查 Postfix 是否真的没有同时使用,systemctl status postfix然后postfix status尝试启用它systemctl start postfix并得到相同的错误。

此外,如果我在 systemd 中禁用 Postfix 服务,重新启动机器并仅使用 启动它postfix start,该服务将启动,但systemctl status postfix报告它已加载、不活动...

[root@mail ~]# postfix start
postfix/postfix-script: starting the Postfix mail system
[root@mail ~]# postfix status
postfix/postfix-script: the Postfix mail system is running: PID: 2169
[root@mail ~]# systemctl status postfix
● postfix.service - Postfix Mail Transport Agent
   Loaded: loaded (/usr/lib/systemd/system/postfix.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[root@mail ~]#

为什么 RHEL 上的 Postfix 在它断然拒绝这样工作时甚至注册为服务?那么确保 Postfix 在引导时启动的正确方法是什么?

注意:我试过chkconfig postfix on了,因为我发现网上有人建议。这只是转发了systemctl enable postfix.service让我回到开始的请求。

...我真的必须破解它 using /etc/rc.local,当文件本身的内容说它只是为了兼容性目的而存在时,不应该再使用并且我应该考虑使用 systemd 服务?

更新 1:我暂时采用了一种看似合理的解决方法 -postfix start使用/etc/rc.local. 重新启动后,Postfix 仍然没有运行。使用 查看rc-local服务的状态,systemctl status rc-local服务启动失败,日志中的原因和我启用后的postfix服务日志中的原因一模一样systemctl——“fatal:postfix邮件系统已经跑步”。Postfix 在所有情况下都无法在启动时启动。

postfix startup systemd rhel8 rocky-linux
  • 1 1 个回答
  • 1400 Views

1 个回答

  • Voted
  1. Best Answer
    Alexis Wilke
    2022-03-06T11:54:15+08:002022-03-06T11:54:15+08:00

    这听起来像是 SysV 和 systemd 冲突。尝试在 systemd 中禁用该服务并重新启动并查看它是否运行。它可能会运行。

    sudo systemctl disable posfix
    sudo init 6
    

    请注意,我使用init 6它是因为这是最原始的重启方式。reboot和shutdown函数会做一些额外的事情,这些事情可能会导致副作用。最新的方法实际上是systemctl reboot,但我还没有使用它。

    这应该不会给您任何错误,并且它很可能正在运行。

    如果使用 SysV,那么您应该在/etc/rc?.d(其中?是从 1 到 6 的数字)下看到引用后缀的链接。

    此外,可能是 postfix 通过检查 PID 文件而不是具有该 PID 的进程是否确实在运行来检测它已经在运行。那将是我的下一次尝试。当进程无法启动时,我经常在启动前进行彻底停止,以便此类清理有机会重置:

    systemctl stop postfix
    systemctl start postfix
    
    • 1

相关问题

  • Postfix 在特定端口上接受邮件

  • 让 Postfix 以两种方式处理垃圾邮件

  • Postfix 或 exim:自动/程序化和转发电子邮件设置

  • 后缀电子邮件地址

  • 什么是最好的开源电子邮件解决方案包

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve