# [SOLVED] Can't start Bind

## joefish

Bind *should* be starting when I boot, rc-status says it is running:

```
# rc-status

Runlevel: default

...

  named                                                                                           [ started ]

...

```

'ps -ae' shows no 'named' running however.

The last message from dmesg says "process `named' is using obsolete setsockopt SO_BSDCOMPAT"

and /var/log/everything/current says:

```
Feb 24 16:15:03 [named] starting BIND 9.2.2-P1 -u named -n 1

Feb 24 16:15:03 [named] using 1 CPU

Feb 24 16:15:03 [named] loading configuration from '/etc/bind/named.conf'

Feb 24 16:15:03 [named] no IPv6 interfaces found

Feb 24 16:15:03 [named] listening on IPv4 interface lo, 127.0.0.1#53

Feb 24 16:15:03 [kernel] process `named' is using obsolete setsockopt SO_BSDCOMPAT

Feb 24 16:15:03 [named] listening on IPv4 interface eth0, 192.168.2.254#53

Feb 24 16:15:03 [named] listening on IPv4 interface eth1, 192.168.0.2#53

Feb 24 16:15:03 [named] listening on IPv4 interface eth2, 192.168.1.254#53

Feb 24 16:15:03 [named] command channel listening on 127.0.0.1#953

Feb 24 16:15:03 [named] couldn't open pid file '/var/run/named.pid': Permission denied

Feb 24 16:15:03 [named] exiting (due to early fatal error)
```

I can't start/restart it: 

```
# /etc/init.d/named restart

 * Stopping named...                                                                                    [ !! ]

 * WARNING:  "named" has already been started.
```

Last edited by joefish on Thu Feb 24, 2005 11:24 am; edited 1 time in total

----------

## wuzzerd

Who owns /var/run/named ??  It should be named.

```

# dir /var/run

...

drwxr-xr-x   2 named     named     4096 Feb 23 20:40 named

...

```

----------

## joefish

there was no such directory /var/run/named

I created it, and set the owner/group to named, but that does not solve my problem.

----------

## wuzzerd

Hmm, what do your configuration files in /etc/bind and /etc/conf.d look like?

----------

## joefish

/etc/conf.d/named: 

```
# Set various named options here.

#

OPTIONS=""

# Set this to the number of processors you have.

#

CPU="1"

# If you wish to run bind in a chroot, run:

# ebuild /var/db/pkg/net-dns/<bind version>/<bind-version> config

# and un-comment the following line.

# You can specify a different chroot directory but MAKE SURE it's empty.

# CHROOT="/chroot/dns"
```

/etc/bind/named.conf 

```
// This is the primary configuration file for the BIND DNS server named.

//

// Please read /usr/share/doc/bind9/README.Debian for information on the

// structure of BIND configuration files in Debian, *BEFORE* you customize

// this configuration file.

//

options {

        directory "/var/cache/bind";

        version "surely you must be joking";

        allow-recursion { 192.168.1.0/24; localhost; };

        auth-nxdomain no;    # conform to RFC1035

};

// prime the server with knowledge of the root servers

zone "." {

        type hint;

        file "/etc/bind/db.root";

};

// be authoritative for the localhost forward and reverse zones, and for

// broadcast zones as per RFC 1912

zone "localhost" {

        type master;

        file "/etc/bind/db.local";

};

zone "127.in-addr.arpa" {

        type master;

        file "/etc/bind/db.127";

};

zone "0.in-addr.arpa" {

        type master;

        file "/etc/bind/db.0";

};

zone "255.in-addr.arpa" {

        type master;

        file "/etc/bind/db.255";

};

// add entries for other zones below here

zone "taurima.tla" {

        type master;

        file "/etc/bind/db.taurima.tla";

};

zone "1.168.192.in-addr.arpa" {

        type master;

        file "/etc/bind/db.192.168.1";

};
```

The /etc/bind/named.conf is just copied from my previous debian server. I haven't got as far as testing whether it works or not yet.

----------

## wuzzerd

Ok, your Debian shows:

 *Quote:*   

> options {
> 
>         directory "/var/cache/bind"; 
> 
> 

 

My Gentoo shows

 *Quote:*   

>  ]options {
> 
>         directory "/var/bind"; 
> 
> 

 

That looks like a good place to start.

----------

## joefish

Well spotted, but still not the source of the problem.

----------

## wuzzerd

I'm trying to think what I did.  I think it ran out of the box.  You did all the etc-update rc-update stuff?

----------

## joefish

Yep.

----------

## wuzzerd

Is named listed in your group file?

----------

## j-m

```

mkdir /var/run/named

chown named:named /var/run/named

```

and then set the following in named.conf

```

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

```

(Re)start Bind.

----------

## joefish

When adding the pid-file option to my named.conf, my logs show:

```
Feb 24 22:24:13 [named] /etc/bind/named.conf:58: unknown option 'pid-file'
```

There is a line in /etc/group that says 'named:x:40:named'

----------

## j-m

Eh, you need to place it in the proper place...  :Rolling Eyes: 

```

options {

        directory "/var/bind";

        // uncomment the following lines to turn on DNS forwarding,

        // and change the forwarding ip address(es) :

        //forward first;

        //forwarders {

        //      123.123.123.123;

        //      123.123.123.123;

        //};

        listen-on-v6 { none; };

        listen-on { 127.0.0.1; };

        // to allow only specific hosts to use the DNS server:

        //allow-query {

        //      127.0.0.1;

        //};

        // if you have problems and are behind a firewall:

        //query-source address * port 53;

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

};

```

----------

## joefish

Thankyou! Now I can sleep...!

I'm also quite happy that I did not have to modify any of the rest of my bind configs - it's working well  :Smile:  Before today I have never touched bind.

----------

