# Bind 9 won't start with /etc/init.d/named script

## stevil

I've installed bind 9.  It works when I start it manually from the command line as root and works perfectly.  But I can't get it to start during startup.  I ran rc-update and /etc/init.d/named is there and it does get called during startup (it even says [OK]), but no process gets started.

When I try and run /etc/init.d/named manually it tells me that named has already been started when in fact it hasn't.

Any suggestions?

Thanks

----------

## arkane

If it means anything I have the same issue.

I gave up on it, myself.... I checked the man pages, info pages, deleted .pid files after the named service was killed by me, everything....

Any input by anyone would be nice.

----------

## Jebus

It's because it can't find the pid file in the right place. Put this line in your /etc/bind/named.conf:

options {

        pid-file "/var/run/named/named.pid";

}

Now it should start correctly. I had the same problem.

----------

## Hellfire

More info kplzthx.

Is the process starting and dying? 

Is the script usable via `/etc/init.d/named start` ?

Have you tried `rc-update del named default` and then `rc-update add named default` to make sure the script gets added without error?

BIND works as expected off a clean stage-3 1.1a tarball so the files in portage as of then did work. 

-h

----------

## arkane

 *Hellfire wrote:*   

> More info kplzthx.
> 
> Is the process starting and dying? 
> 
> Is the script usable via `/etc/init.d/named start` ?
> ...

 

It appears that mine is just dieing.  I can run "/etc/init.d/named start" all day long and it'll keep saying "started" but stopping of course since It's not there gives an error. ( the error [!!] ).

I did a "ps aux | grep -i name" and nothing (also switched to bind and nothing)

hmmm... I tried starting it again with the /etc/init.d/named script, and it said:

* WARNING:  "named" has already been started.

there is no /var/run/named.pid

I deleted and added it to the default runlevel before... it starts (or says it does) at boot... but it's not there.

----------

## arkane

okay.. I got it working from the commandline.  I made sure all of the files were in the right place in relation to the named.conf directives.  I used webmin to configure it, I should have just done the whole damned thing by hand like always.  There I go thinking again.

Now, the same issue is happening with the init.d script.  I created the /var/run/named.pid file and it has the correct pid in it for the running named   It just won't stop it.... (and keeps saying it's started)

Okay.. I got it fixed with the script.

It appears the script is trying to start it as the user "named".  I chown'ed the /var/run/named directory (after creating it....) as named.root.  (chmod 755)  the /etc/bind/named.conf file was altered to look in the /var/run/named directory for the pid, and everything is in /etc/bind for named.  it works fine for me now.  It appears that /var/log/daemon.log is the one that holds the named debug information, just FYI.

----------

## stevil

My /etc/init.d/named script had the following line to start named:

start-stop-daemon --start --quiet --exec /usr/sbin/named -- -u named -n 1

Once I deleted the double dashes before -u, named starts just fine during boot and the /etc/init.d/named script seem to work correctly (for shutdown and restart).

Not sure if the above suggestions in conjunction with removing the double dashes are the complete solution or not, but doing everything works fine for me.

Thanks for all the help.

----------

## choi65

Hi,

i had the same problem, but i find a solution for it. 

I should make the following steps.

1) execute rndc-confgen > /etc/rndc.conf

and uncomment the part of rndc.conf 

2) copy the named.conf part in the /etc/bind/named.conf

3) change the permission of /var/run/named directory

That's all.

----------

## ziwo

If `named' crash during startup (boot or manually) the link in 

```

/mnt/.init.d/started/named

```

isnt removed properly. The result is the annoying message

```

* WARNING: "named" has already been started.

```

if you try to start 'named' again. 

The Link is used to keep track of the daemons that are already started by init.d. So be carefull what you are doing  :Shocked: 

Remove the link and everthing is ok, accept your malformed `named.conf'. It is the main reason for an crashing `named'

Whatch the daemon.log for debugging.

Hope that helps

ziwo

----------

## Xor

if I remember right those "--" declare that the following parameters are intended for named and not start-stop-daemon. check out the man!

you may also want to configure some logs or check those allready created. Next start the daemon from a shell (with the same parameters!) and see what happens... you may also try to use strace... and check the logs... you may have to configure syslog first... and if you named is chrooted you may have to think twice befor doing stuff (like expecting that syslog catches any named msgs)   :Smile: 

----------

## ziwo

I have to correct my last posting:

The right and gentoo way to reset those `hanging' services is to use the `zap' option with the init.d-script (eg.):

```

/etc/init.d/named zap

```

like the help and 

[url= http://www.gentoo.org/doc/rc-scripts.html#doc_chap7] doc [/url] of the RC-Script say:

 *Quote:*   

> 
> 
> zap
> 
>       Reset a service that is currently stopped, but still marked as started,
> ...

 

hope that helps

-z

----------

## Jester20

ziwo, Thanks!  the zap worked for me.  =)

----------

