{"id":418,"date":"2018-01-10T08:57:00","date_gmt":"2018-01-10T08:57:00","guid":{"rendered":"https:\/\/mellowhost.com\/blog\/?p=418"},"modified":"2018-01-10T08:57:00","modified_gmt":"2018-01-10T08:57:00","slug":"troubleshoot-fatal-open-lock-file-var-lib-postfix-master-lock-unable-to-set-exclusive-lock","status":"publish","type":"post","link":"https:\/\/mellowhost.com\/blog\/troubleshoot-fatal-open-lock-file-var-lib-postfix-master-lock-unable-to-set-exclusive-lock.html","title":{"rendered":"Troubleshoot: fatal: open lock file \/var\/lib\/postfix\/master.lock: unable to set exclusive lock"},"content":{"rendered":"<h4>Error Message &amp; Trace details:<\/h4>\n<p>One of my customer came with an error saying the postfix in his server isn&#8217;t working. The server was running CentOS 7, and the system postfix status was inactive, means not running. Although, the system queue was running I could see. The error that was returning while restarting\/checking status was the following:<\/p>\n<p><code># service postfix status<br \/>\nRedirecting to \/bin\/systemctl status postfix.service<br \/>\n\u25cf postfix.service - Postfix Mail Transport Agent<br \/>\nLoaded: loaded (\/usr\/lib\/systemd\/system\/postfix.service; enabled; vendor preset: disabled)<br \/>\nActive: failed (Result: exit-code) since Tue 2018-01-09 04:04:05 UTC; 1s ago<br \/>\nProcess: 9201 ExecStart=\/usr\/sbin\/postfix start (code=exited, status=1\/FAILURE)<br \/>\nProcess: 9197 ExecStartPre=\/usr\/libexec\/postfix\/chroot-update (code=exited, status=0\/SUCCESS)<br \/>\nProcess: 9194 ExecStartPre=\/usr\/libexec\/postfix\/aliasesdb (code=exited, status=0\/SUCCESS)<br \/>\nMain PID: 1358 (code=killed, signal=TERM)<\/code><\/p>\n<p><code>Jan 09 04:04:03 twin7.hifrank.biz systemd[1]: Starting Postfix Mail Transport Agent...<br \/>\nJan 09 04:04:03 twin7.hifrank.biz postfix\/master[9273]: fatal: open lock file \/var\/lib\/postfix\/master.lock: unable to set exclusive lock: Resource tempo...vailable<br \/>\nJan 09 04:04:04 twin7.hifrank.biz postfix\/master[9272]: fatal: daemon initialization failure<br \/>\nJan 09 04:04:05 twin7.hifrank.biz postfix\/postfix-script[9274]: fatal: mail system startup failed<br \/>\nJan 09 04:04:05 twin7.hifrank.biz systemd[1]: postfix.service: control process exited, code=exited status=1<br \/>\nJan 09 04:04:05 twin7.hifrank.biz systemd[1]: Failed to start Postfix Mail Transport Agent.<br \/>\nJan 09 04:04:05 twin7.hifrank.biz systemd[1]: Unit postfix.service entered failed state.<br \/>\nJan 09 04:04:05 twin7.hifrank.biz systemd[1]: postfix.service failed.<\/code><\/p>\n<h4>How to fix:<\/h4>\n<p>The error to note here is the following:<\/p>\n<p><code>fatal: open lock file \/var\/lib\/postfix\/master.lock<\/code><\/p>\n<p>I first killed the smtp and smtpd processes that runs by postfix:<\/p>\n<p><code># killall -9 smtp<br \/>\n# killall -9 smtpd<\/code><\/p>\n<p>But that didn&#8217;t solve the problem. I then used the fuser command to check which process holds the lock file:<\/p>\n<p><code># fuser \/var\/lib\/postfix\/master.lock<br \/>\n\/var\/lib\/postfix\/master.lock: 18698<\/code><\/p>\n<p>Then we check the process 18698 and kill the responsible process:<\/p>\n<p><code># ps -axwww|grep 18698<br \/>\n9333 pts\/0 S+ 0:00 grep --color=auto 18698<\/code><br \/>\n<code>18698 ? Ss 4:28 \/usr\/libexec\/postfix\/master -w<br \/>\n# killall -9 \/usr\/libexec\/postfix\/master<br \/>\nor<br \/>\n# kill -9 18698<\/code><\/p>\n<p>Once the process is killed, you can now start the postfix:<\/p>\n<p><code># service postfix start<br \/>\n# service postfix status|grep Active<br \/>\nRedirecting to \/bin\/systemctl status postfix.service<br \/>\nActive: active (running) since Tue 2018-01-09 04:15:50 UTC; 4min 45s ago<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Error Message &amp; Trace details: One of my customer came with an error saying the postfix in his server isn&#8217;t working. The server was running CentOS 7, and the system postfix status was inactive, means not running. Although, the system queue was running I could see. The error that was returning while restarting\/checking status was &hellip; <a href=\"https:\/\/mellowhost.com\/blog\/troubleshoot-fatal-open-lock-file-var-lib-postfix-master-lock-unable-to-set-exclusive-lock.html\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Troubleshoot: fatal: open lock file \/var\/lib\/postfix\/master.lock: unable to set exclusive lock&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[12,211,246,191,21,150,26],"tags":[220,250,249,248,247,221],"_links":{"self":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/418"}],"collection":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/comments?post=418"}],"version-history":[{"count":1,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/418\/revisions"}],"predecessor-version":[{"id":419,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/posts\/418\/revisions\/419"}],"wp:attachment":[{"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/media?parent=418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/categories?post=418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mellowhost.com\/blog\/wp-json\/wp\/v2\/tags?post=418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}