Dovecot

未找到作為服務執行的 dovecot 套接字

  • May 10, 2020

我有一個關於鴿舍的奇怪問題。直到昨天,當我從 debian/jessie 升級到 debian/stretch (armhf) 時,我的 dovecot 在我的 cubietruck 上完美執行。

/var符號連結到另一個已安裝的驅動器(mountpoint /extended):/var->/extended/hostname/var

現在,每當我將它作為服務(“ systemctl start dovecot”)啟動時,它都不會啟動,而是立即退出並出現錯誤。

May 08 21:16:20 hostname systemd[1]: Starting Dovecot IMAP/POP3 email server...
May 08 21:16:20 hostname dovecot[32167]: Error: bind(/var/spool/postfix/private/auth_dovecot) failed: No such file or directory
May 08 21:16:20 hostname dovecot[32167]: Fatal: Failed to start listeners
May 08 21:16:20 hostname systemd[1]: dovecot.service: Control process exited, code=exited status=89
May 08 21:16:20 hostname systemd[1]: Failed to start Dovecot IMAP/POP3 email server.
May 08 21:16:20 hostname systemd[1]: dovecot.service: Unit entered failed state.
May 08 21:16:20 hostname systemd[1]: dovecot.service: Failed with result 'exit-code'.

每當我root在 shell 中啟動 dovecot 時,dovecot它不會顯示任何錯誤,但可以完美執行。

我的dovecot.conf

auth_mechanisms = plain login
log_timestamp = "%Y-%m-%d %H:%M:%S "
passdb {
 args = /etc/dovecot/dovecot-mysql.conf
 driver = sql
}
protocols = imap pop3
service auth {
 unix_listener /var/spool/postfix/private/auth_dovecot {
   mode = 0660
   user = postfix
   group = postfix
 }
 unix_listener auth-master {
   mode = 0600
   user = vmail
 }
 user = root
}
ssl_cert =</etc/postfix/sslcert/server.crt
ssl_key =</etc/postfix/sslcert/server.key
userdb {
 args = /etc/dovecot/dovecot-mysql.conf
 driver = sql
}
protocol pop3 {
 pop3_uidl_format = %08Xu%08Xv
}

# Enable installed protocols
!include_try /usr/share/dovecot/protocols.d/*.protocol

# Most of the actual configuration gets included below. The filenames are
# first sorted by their ASCII value and parsed in that order. The 00-prefixes
# in filenames are intended to make it easier to understand the ordering.
!include conf.d/*.conf

# A config file can also tried to be included without giving an error if
# ried not found:
!include_try local.conf
  • 我在啟動之前已經刪除了套接字/var/spool/postfix/private/auth_dovecot,但是作為服務啟動時沒有用。在 shell 中啟動時,套接字 ( auth_dovecot) 在啟動時重新創建。
  • 註釋掉unix_listener-part 可能會導致啟動超時。錯誤讀取PID file /var/run/dovecot/master.pid not readable (yet?) after start
  • 對套接字 ( /var/spool/postfix/private/auth) 使用另一個名稱會導致相同的錯誤。
  • 我已經嘗試完全重新安裝 dovecot(apt purge、autoremove、autoclean、clean、install ……),但這會導致超時問題和奇怪的配置文件。
  • 在 google/stackexchange 上搜尋並沒有找到解決方案。

因為我可以從 shell 以 root 身份執行 dovecot 而不會出現問題,所以我強烈懷疑systemd會生成某種chroot但我需要一些提示來進一步調查它。

先感謝您。

PS:幸運的是我應該可以回去,debian/jessie因為我有一個SD 卡的tar.gz存檔。cubietruck

似乎有一些奇怪的行為systemd

我通過編輯postfix.service文件 ( /etc/systemd/system/multi-user.target.wants/dovecot.service) 解決了這個問題,並將預設條目設置PrivateTmp=truePrivateTmp=false.

# This file is part of Dovecot
#
# If you want to pass additionally command line options to the dovecot
# binary, create the file:
#   `/etc/systemd/system/dovecot.service.d/service.conf'.
# In this file create a Service section and configure an Environment with
# the variable `OPTIONS'. For example:
#
#   [Service]
#   Environment='OPTIONS=-p'
#
# In the `Service' section you may also specify various other setting.
# If you have trouble with `Too many open files' you may set:
#LimitNOFILE=8192
#
# If you want to allow the Dovecot services to produce core dumps, use:
#LimitCORE=infinity

[Unit]
Description=Dovecot IMAP/POP3 email server
Documentation=man:dovecot(1)
Documentation=http://wiki2.dovecot.org/
After=local-fs.target network.target

[Service]
Type=forking
ExecStart=/usr/sbin/dovecot
PIDFile=/var/run/dovecot/master.pid
ExecReload=/usr/bin/doveadm reload
ExecStop=/usr/bin/doveadm stop
PrivateTmp=false
NonBlocking=yes
# Enable this if your systemd is new enough to support it:
#ProtectSystem=off

我不清楚為什麼一個名為的配置參數PrivateTmp不僅在記錄的文件夾上工作,/tmp或者/var/tmp還阻止訪問/var/spool(或/var/spool/postfix/private/auth_dovecot)內容的原因。

引用自:https://serverfault.com/questions/1016337