Partner with experts to accelerate your digital transformation journey
Bobcares

Sendmail dead but subsys locked – Here’s how to fix it

PDF Header PDF Footer

An option to send emails is a required feature in any web app. And, for handling mails, we need a mail server.

Many people prefer to run Sendmail as the mail server as it is free and easy to setup.

Unfortunately, many times these mail servers fail with errors like “Sendmail dead but subsys locked.” And, the fix may not be easy.

That’s why, we often get requests from customers to solve mail server errors as part of our Server Management Services.

Today, we’ll see how our Support Engineers fixed “Sendmail dead but subsys locked” for one of our customers.

What causes Sendmail dead but subsys locked error?

Firstly, let’s see what causes any service to go to ‘Dead’ status and show subsys locked error.

In simple words, this error means the service was running, but crashed recently.

Usually, in Linux servers, starting any service creates a “lock” file. This file helps server to understand that the service is running. Again, it avoids multiple instances of same service. Similarly, stopping the service removes this lock file.

But, when sendmail service crashes accidentally, the lock file exists but the process no longer exists. As a result, it shows the message as:

sendmail dead but subsys locked

For the proper functioning of Sendmail, the configuration file /var/run/sendmail.pid and /var/lock/subsys/sendmail should agree with each other. That is, when the lockfile /var/lock/subsys/sendmail exists, then the first line of the file /var/run/sendmail.pid should contain the PID of the sendmail process running on the server. A missing process with that pid indicates that something is wrong. Again, if the process is running with a different Process ID, that will also result in the error.

 

Main reasons for the Sendmail error

OK. Now, we know about the error as such. It’s time to see that exact reasons that would cause this.

 

1. Running alternate service

From our experience in managing the servers, our Dedicated Engineers often see sendmail dead but subsys locked error when another mail service run on the same port. For example, in most Sendmail servers, the Postfix mail server can create problems.

Thus, in effect server tries to run two mail servers on the same port. It fails and result in the error. Usually, the second service will be started by any automated programs on the server like chkconfig or so.

Recently, we saw this error in a DigitalOcean droplet when customer tried to switch the mail server to Postfix. Here, the switch did not complete and resulted in trying to run both process at the same time.

 

2. Configuration errors

Similarly, Sendmail configuration errors can also result in Sendmail dead error message.

In many cases this happens when the process is unable to start due to a fatal error. Here, the fatal error will be the result of a messed up or missing configuration file /etc/mail/sendmail.cf.

Again, this occurs in scenario where the customer directly edit the sendmail configuration file, without using the ‘m4‘ utility. Here, the system loses the process id information for Sendmail and hence may not be able to shutdown the exact Sendmail process.

 

Steps to fix the error “Sendmail dead but subsys locked”

We saw the top two reasons for the “Sendmail dead but subsys locked” error. Now, let’s see how our Dedicated Engineers fixed this error for our customer.

Here, the customer approached us asking for the reason for periodic Sendmail failure messages from the server. The alert mail said:

mysqld (pid 1314) is running...
sendmail dead but subsys locked
openssh-daemon (pid 11173) is running...

This was a new server and hence we started the troubleshooting by checking the Sendmail status on the server.

[root@server ~]# /etc/init.d/sendmail status
sendmail dead but subsys locked
sm-client (pid 28752) is running

The error was evident from the results. So, we checked the status of Postfix on the server. It was also running on the server.

[root@server ~]# /etc/init.d/postfix status
-b (pid 1748) is running...

An attempt to stop the Postfix process failed. That’s why, our Dedicated Engineers collected the exact process id of the Postfix process from the ‘netstat‘ command and killed it. After that the sendmail restart command worked perfectly. Finally, Sendmail began running again.

[root@server ~]# service sendmail status
sendmail (pid 15503) is running...
sm-client (pid 15512) is running...

Again, to ensure that Postfix do not automatically restart, we turned it Off in the chkconfig too using the command.

[root@server ~]# chkconfig --level 35 postfix off

 

[Need help in fixing Sendmail on your server? We are here to help you.]

 

Conclusion

In short, Sendmail dead but subsys locked error occurs when another service listens on the same port. Today, we saw the top 2 reasons for the error and how our Support Engineers solved it for our customer.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";
0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Get featured on the Bobcares blog and share your expertise with a global tech audience.

WRITE FOR US
server management

Spend time on your business, not on your servers.

TALK TO US

Or click here to learn more.

Speed issues driving customers away?
We’ve got your back!

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF