LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 03-31-2009, 03:59 AM   #1
samengr
Member
 
Registered: Jan 2008
Posts: 59

Rep: Reputation: 15
(bind) named: couldn't open pid file '/var/run/named/named.pid' - any help?


Hi,

I am configuring BIND-9.3 server on RHEL5. Can any body look into it and help me to understand why I am getting this message in /var/log/messages


Mar 25 14:10:09 station1 named[27449]: couldn't open pid file '/var/run/named/named.pid': File exists
Mar 25 14:10:09 station1 named[27449]: exiting (due to early fatal error)



I am using RHEL5, port 53 and 953 are allowed by iptables. SELINUX is in enforcing mode.

[root@station1 run]# rpm -qa | grep bind
bind-utils-9.3.3-7.el5
bind-9.3.3-7.el5
bind-chroot-9.3.3-7.el5
system-config-bind-4.0.3-2.el5
bind-libs-9.3.3-7.el5

here are my config files

======== /etc/named.com =================

include "/etc/rndc.key";

options{
directory "/var/named/";
pid-file "/var/run/named/named.pid";
statistics-file "/var/log/named/named.stats";
dump-file "/var/log/named/named.dump";
zone-statistics yes;
allow-query { 192.168.182.0/24; };
};

key "rndc-key" {
algorithm hmac-md5;
secret "ykBHrr4mZJxlwAdcf9OuKw==";
};

controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};

zone "." IN {
type hint;
file "named.ca";
};

zone "localdomain" IN {
type master;
file "localdomain.zone";
allow-update { none; };
};

zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};

zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
type master;
file "named.ip6.local";
allow-update { none; };
};

zone "255.in-addr.arpa" IN {
type master;
file "named.broadcast";
allow-update { none; };
};

zone "0.in-addr.arpa" IN {
type master;
file "named.zero";
allow-update { none; };
};

zone "example.com" IN {
type master;
file "example.com";
allow-update { none; };
};

zone "182.168.192.in-addr.arpa" IN {
type master;
file "reverse.example.com";
allow-update { none; };
};




====================

=============== /etc/rndc.conf =============
[root@station1 ~]# cat /etc/rndc.conf
# Start of rndc.conf
key "rndckey" {
algorithm hmac-md5;
secret "ykBHrr4mZJxlwAdcf9OuKw==";
};

options {
default-key "rndckey";
default-server 127.0.0.1;
default-port 953;
};
# End of rndc.conf

#############

[root@station1 run]# named -u named -c /etc/named.conf

[root@station1 run]# tail -f /var/log/messages

Mar 25 14:27:38 station1 named[27536]: starting BIND 9.3.3rc2 -u named -c /etc/named.conf
Mar 25 14:27:38 station1 named[27536]: found 1 CPU, using 1 worker thread
Mar 25 14:27:38 station1 named[27536]: loading configuration from '/etc/named.conf'
Mar 25 14:27:38 station1 named[27536]: listening on IPv4 interface lo, 127.0.0.1#53
Mar 25 14:27:38 station1 named[27536]: listening on IPv4 interface eth0, 192.168.182.130#53
Mar 25 14:27:38 station1 named[27536]: command channel listening on 127.0.0.1#953
Mar 25 14:27:38 station1 named[27536]: zone 0.in-addr.arpa/IN: loaded serial 42
Mar 25 14:27:38 station1 named[27536]: zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
Mar 25 14:27:38 station1 named[27536]: zone 182.168.192.in-addr.arpa/IN: loaded serial 1997022700
Mar 25 14:27:38 station1 named[27536]: zone 255.in-addr.arpa/IN: loaded serial 42
Mar 25 14:27:38 station1 named[27536]: zone 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa/IN: loaded serial 1997022700
Mar 25 14:27:38 station1 named[27536]: zone example.com/IN: loaded serial 42
Mar 25 14:27:38 station1 named[27536]: zone localdomain/IN: loaded serial 42
Mar 25 14:27:38 station1 named[27536]: zone localhost/IN: loaded serial 42
Mar 25 14:27:38 station1 named[27536]: running

=====================

[root@station1 run]# /etc/init.d/named restart
Stopping named: [ OK ]
Starting named: [FAILED]


[root@station1 run]# tail -f /var/log/messages

Mar 25 14:29:31 station1 named[27536]: shutting down: flushing changes
Mar 25 14:29:31 station1 named[27536]: stopping command channel on 127.0.0.1#953
Mar 25 14:29:31 station1 named[27536]: no longer listening on 127.0.0.1#53
Mar 25 14:29:31 station1 named[27536]: no longer listening on 192.168.182.130#53
Mar 25 14:29:31 station1 named[27536]: exiting
Mar 25 14:29:34 station1 named[27574]: starting BIND 9.3.3rc2 -u named -t /var/named/chroot
Mar 25 14:29:34 station1 named[27574]: found 1 CPU, using 1 worker thread
Mar 25 14:29:34 station1 named[27574]: loading configuration from '/etc/named.conf'
Mar 25 14:29:34 station1 named[27574]: listening on IPv4 interface lo, 127.0.0.1#53
Mar 25 14:29:34 station1 named[27574]: listening on IPv4 interface eth0, 192.168.182.130#53
Mar 25 14:29:34 station1 named[27574]: command channel listening on 127.0.0.1#953
Mar 25 14:29:34 station1 named[27574]: couldn't open pid file '/var/run/named/named.pid': File exists
Mar 25 14:29:34 station1 named[27574]: exiting (due to early fatal error)

Note: SELINUX is in enfrocing mode and iptables are allowing port 53 and 953.


I dont know where is the problem? Can somebody help me to sortout this issue? hope above outputs will help to understand the issue?


Many thanks.
 
Old 03-31-2009, 04:01 AM   #2
samengr
Member
 
Registered: Jan 2008
Posts: 59

Original Poster
Rep: Reputation: 15
I have created the named.pid file by myself but still got the same error. I confirmed the selinux setting and permissions but got the same error.

Any help?
 
Old 03-31-2009, 04:17 AM   #3
robertjinx
Member
 
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 561

Rep: Reputation: 58
Check folder /var/named/chroot/var/run/named for the proper right, should be owned by named user.
Also check if /var/named/chroot/var/run/named/named.pid file doesnt exist, if it does, remove it.
something like:

chown -R named.named /var/named/chroot/var
chmod 770 /var/named/chroot/var/run
chmod 770 /var/named/chroot/var/log
chmod 770 /var/named/chroot/var

Last edited by robertjinx; 03-31-2009 at 04:18 AM.
 
Old 03-31-2009, 08:40 AM   #4
samengr
Member
 
Registered: Jan 2008
Posts: 59

Original Poster
Rep: Reputation: 15
Thanks mate atleast Its working now. but my bind/DNS is not working dont know whats wrong with this now :-( Can you look into it?

I have pasted my /etc/named.conf in the first message.

Here are the zones definitions

[root@station1 named]# cat /var/named/example.com
$TTL 86400
@ IN SOA station1.example.com. root.station1.example.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

@ IN NS station1.example.com.
station1 IN A 192.168.182.130
IN AAAA ::1

station2 IN A 192.168.182.132

[root@station1 named]# cat /var/named/reverse.example.com
$TTL 86400
@ IN SOA station1.example.com. root.station1.example.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
@ IN NS station1.example.com.
130 IN PTR station1.example.com.
132 IN PTR station2.example.com

=======

[root@station1 named]# host -l example.com
example.com name server station1.example.com.
station1.example.com has address 192.168.182.130
station1.example.com has IPv6 address ::1
station2.example.com has address 192.168.182.132

[root@station1 named]# ping station2.example.com
ping: unknown host station2.example.com

[root@station1 named]# host station2
Host station2 not found: 5(REFUSED)

#tail -f /var/log/messages

Mar 26 10:36:49 station1 named[4382]: client 127.0.0.1#58600: transfer of 'example.com/IN': AXFR started
Mar 26 10:36:49 station1 named[4382]: client 127.0.0.1#58600: transfer of 'example.com/IN': AXFR ended
Mar 26 10:37:32 station1 named[4382]: client 127.0.0.1#32772: query 'station2.example.com/A/IN' denied
Mar 26 10:37:32 station1 named[4382]: client 127.0.0.1#32772: query 'station2.example.com/A/IN' denied
Mar 26 10:37:32 station1 named[4382]: client 127.0.0.1#32772: query 'station2.example.com.example.com/A/IN' denied
Mar 26 10:37:32 station1 named[4382]: client 127.0.0.1#32772: query 'station2.example.com.example.com/A/IN' denied
Mar 26 10:37:37 station1 named[4382]: client 127.0.0.1#32772: query (cache) 'station2/A/IN' denied

What can be the wrong?
 
Old 03-31-2009, 09:12 AM   #5
robertjinx
Member
 
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 561

Rep: Reputation: 58
your /var/named/reverse.example.com should be place in /var/named/chroot, meaning should look like tis:

file /var/named/chroot/var/named/reverse.example.com

because you are using chrooted named.

Also make sure that they have named user rights.
 
Old 04-01-2009, 03:33 AM   #6
samengr
Member
 
Registered: Jan 2008
Posts: 59

Original Poster
Rep: Reputation: 15
]# ll -h /var/named/
total 15K
drwxr-x--- 6 root named 1.0K Mar 25 07:13 chroot
drwxr-x--- 2 root named 1.0K Jan 16 2007 data
lrwxrwxrwx 1 root named 39 Mar 25 11:44 example.com -> /var/named/chroot/var/named/example.com
lrwxrwxrwx 1 root named 45 Mar 25 05:41 localdomain.zone -> /var/named/chroot//var/named/localdomain.zone
lrwxrwxrwx 1 root named 43 Mar 25 05:41 localhost.zone -> /var/named/chroot//var/named/localhost.zone
lrwxrwxrwx 1 root named 44 Mar 25 05:41 named.broadcast -> /var/named/chroot//var/named/named.broadcast
lrwxrwxrwx 1 root named 37 Mar 25 05:41 named.ca -> /var/named/chroot//var/named/named.ca
lrwxrwxrwx 1 root named 44 Mar 25 05:41 named.ip6.local -> /var/named/chroot//var/named/named.ip6.local
lrwxrwxrwx 1 root named 40 Mar 25 05:41 named.local -> /var/named/chroot//var/named/named.local
lrwxrwxrwx 1 root named 39 Mar 25 05:41 named.zero -> /var/named/chroot//var/named/named.zero
lrwxrwxrwx 1 root named 36 Mar 25 07:17 reverse.example.com -> chroot/var/named/reverse.example.com
drwxr-x--- 2 root named 1.0K Jan 16 2007 slaves

########

]# ll -h /var/named/chroot/var/named/
total 26K
drwxrwx--- 2 root named 1.0K Aug 25 2004 data
-rwxrwx--- 1 root named 290 Mar 25 09:29 dev.com
-rwxrwx--- 1 root named 302 Mar 25 11:25 example.com
-rwxrwx--- 1 root named 198 Jan 16 2007 localdomain.zone
-rwxrwx--- 1 root named 195 Jan 16 2007 localhost.zone
-rwxrwx--- 1 root named 427 Jan 16 2007 named.broadcast
-rwxrwx--- 1 root named 2.5K Jan 16 2007 named.ca
-rwxrwx--- 1 root named 424 Jan 16 2007 named.ip6.local
-rwxrwx--- 1 root named 426 Jan 16 2007 named.local
-rwxrwx--- 1 root named 427 Jan 16 2007 named.zero
-rwxrwx--- 1 root named 505 Mar 25 07:22 reverse.example.com
drwxrwx--- 2 root named 1.0K Jul 27 2004 slaves



any idea??
 
Old 04-01-2009, 06:22 AM   #7
robertjinx
Member
 
Registered: Oct 2007
Location: Prague, CZ
Distribution: RedHat / CentOS / Ubuntu / SUSE / Debian
Posts: 561

Rep: Reputation: 58
I told u before, change the rights for /var/named/chroot from, root user to named user:

chown -R named /var/named/chroot

See what happens then, its still the user root there, not named.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
file /var/lib/named/var/named/reverse/named.zero failed: file not found Toadman Linux - Software 15 03-18-2009 07:01 PM
BIND/named Startup Error - named.root:1: '}' expected near ';' acutchin Linux - Server 4 11-10-2008 09:43 AM
chown -R named:named /var/named crash the system? joangopan Fedora 2 09-09-2007 02:46 AM
Dns /var/run/bind/named.pid permission denied namit Linux - Software 1 04-22-2007 04:16 PM
Named can't create .pid?!?!? morbo Linux - Networking 11 09-11-2006 02:53 AM


All times are GMT -5. The time now is 06:02 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration