Monday, June 2, 2014

httpd dead but pid file exists

Your Apache is not working because it gives following error :
httpd dead but pid file exists

You have tried to restart Apache several times but still it gives same error.
To remove this error, you need to remove Semaphore Arrays of Apache.

Find all Semaphore Arrays of Apache. Run following command in terminal.
ipcs -s | grep apache
Now remove each entry using command
ipcrm -s semid
semid is second column of the table.

If there are multiple entries of Apache and it is difficult to remove each entry individually, Run following command.
for i in `ipcs -s | grep apache | awk '{ print $2 }'` ; do ipcrm -s $i ; done;
If it is not working for you, Run
ipcs -s | grep apache |  perl -e 'while (<STDIN>) { @a=split(/\s+/); print `ipcrm sem $a[1]`}'
Now restart Apache. Run following command.
service httpd restart 

Solution : 2
If still you are facing same error after restarting Apache. Run
rm /var/lock/subsys/httpd
and Run
rm /var/run/httpd/httpd.pid
Now restart Apache again.
service httpd restart 
Now what is Semaphore Array
A semaphore is a variable or abstract data type that is used for controlling access, by multiple processes.
In its simplest form a semaphore is a location in memory whose value can be tested and set by more than one process. 
ipcs  provides  information on the ipc facilities for which the calling process has read access.
-s displays semaphore arrays.
ipcrm removes a message queue, semaphore set or shared memory id.

Tuesday, May 20, 2014

code 127 --> sh: /usr/bin/expect: not found

 sh: /usr/bin/expect: not found

Install expect on your Linux system.

If you are using ubuntu or debian, Run
sudo apt-get install expect

If you are using CentOS, fedora or RHEL, Run
sudo yum install expect

ftp server vsftpd - Allow root login

 
By Default, root is not able to access ftp because it's name in the list of /etc/ftpusers or /etc/vsftpd/ftpusers
Remove root from the list. Save the file.
Restart vsftpd.
root will be able to log-in using ftp.

If you are using CentOS, fedora or RHEL and still you are not able to log in as root in your ftp server.
Add following line in the file vsftpd.conf
userlist_deny=YES
Remove user root in file /etc/vsftpd/user_list 
Restart vsftpd.
root should be able to log-in using ftp.
 
You can see the solution in the following video.