In this tutorial, we can check how to fix “DirectAdmin dead but subsys locked” error.
DirectAdmin
DirectAdmin is a web-based hosting control panel designed to make administration easier. DirectAdmin is compatible with the constantly evolving web hosting environments. DirectAdmin is often called DA for short. DirectAdmin runs on any system with minimum configurations. DirectAdmin uses port 2222 by default.
Check DA status
This will help you to know whether your DirectAdmin is currently running or not. You can check the current status of your DirectAdmin by performing the below command. You must be logged in as root user to perform this. Run the below command in your terminal.
# service directadmin status
Dead but subsys locked
If you get the status ‘directadmin dead but subsys locked’, this means that DirectAdmin is not currently running on your server, but the ‘pid’ file is present. PID refers to the process identification number. Every process in a system is defined a unique id with which they can be identified. You will not be able to access your DirectAdmin control panel if you get this status message. This is a big problem as you may not be able to manage your server until you regain access to the control panel. To regain access to your control panel, you must restart the DirectAdmin service. In this situation, the restarting process may be a bit difficult. But I can guide you to make your DirectAdmin service run again. Thus, you will regain access to your DirectAdmin control panel.
How to fix it?
Make sure DirectAdmin is dead
Before restarting the service, you must make sure that DirectAdmin is dead. You can check this by the ‘ps’ command. The ps command is used to provide information about the currently running processes, including their process identification numbers (PIDs). The ps command displays all the current running processes. To print only the information of DirectAdmin in the result, we can use ‘grep’. This is a very useful pattern matching tool used in all unix/linux based systems. You must be logged in as root user to perform this.
# ps -aux | grep directadmin
example output
root 22755 0.0 0.0 6444 692 pts/0 S+ 06:51 0:00 grep directadmin
If this command displays a ‘grep’ line, then its okay. This explains that currently there is no DirectAdmin processes running in your system. You can confirm DirectAdmin is really dead now.
Kill the process
If the above command displays any lines other than the ‘grep’ line, this means that DirectAdmin process are existing in the system. These processes have no effect as the DirectAdmin service is currently inactive. But it will block the start/restart operations on DirectAdmin service. To restart your DirectAdmin service you must kill these processes by using their process id. The kill command will kill a process using the kill signal and PID given by the user. You will get the process id from the output of ps command. To kill a process, you can use ‘kill’ command with the process id.
syntax
# kill <pid>
where <pid> is the number displayed in the second column of the ps output.
Force kill
After performing the above method do the ps line again. This is to confirm that all the DirectAdmin process are dead by now.
# ps waux | grep directadmin
If the output still shows any line other than the ‘grep’ line, then you must force kill all the existing process with process id. There are two ways in unix/linux based systems to force kill a process using pid.
syntax
# kill -9 <pid>
OR
# kill -SIGKILL <pid>
kill all the existing DirectAdmin processes using any one method.
Remove pid file
A Pid-File is a file containing the process identification number (pid) that is stored in a well-defined location of the filesystem thus allowing other programs to find out the pid of a running script. Once all instances of DirectAdmin are stopped, see if there’s a file at /var/run/directadmin.pid . If you find this file, then remove it using ‘rm’ command.
# rm /var/run/directadmin.pid
Restart DirectAdmin
Then restart DirectAdmin service. You can restart DirectAdmin service by using
# service directadmin restart
If you need any further assistance please contact our support department.