1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

BIND 9, chroot, named_flags = fail

Discussion in 'Web and Network Services' started by ts_fbsd, Mar 13, 2012.

  1. ts_fbsd

    ts_fbsd New Member

    Messages:
    2
    Thanks Received:
    0
    I'm running FreeBSD 9 and I recently instlaled bind98 from ports. Install went fine. However, my previous configuration (bind96) did not work with this version of BIND. Well, the configuration was okay, but the rc.conf setup didn't work. It looks like bind98 ignored my "named_flags" settings:

    Code:
    named_flags="-u bind -c /etc/named.conf"


    That path is relative to my chroot for BIND. bind98 seems to only want to load named.conf from the following location:
    /etc/namedb/named.conf

    All the other rc.conf settings are okay, but unless I have named.conf in /etc/namedb/, startup fails with the message:

    Code:
    /etc/rc.d/named: ERROR: get_pidfile_from_conf: /etc/namedb/named.conf does not exist (named)


    If I start named manually, it is able to pick up my configuration file. This works fine:

    named -u bind -t /var/chroot/named -c /etc/named.conf

    So, my question is: did something change in the way bind98 works in regards to the location of the configuration? Does it have to be in that specific location? Or, is there a bug in the /etc/rc.d/named startup script?

    Thanks for whatever information you can provide.
     
  2. SirDice

    SirDice Moderator Staff Member Moderator

    Messages:
    17,524
    Thanks Received:
    2,351
    The standard BIND also uses /etc/named/named.conf. This has been the case for as long as I can remember.

    From /etc/defaults/rc.conf:
    Code:
    named_conf="/etc/namedb/named.conf"     # Path to the configuration file
    
     
  3. ts_fbsd

    ts_fbsd New Member

    Messages:
    2
    Thanks Received:
    0
    Yes, but I used to be able to override that with the "named_flags" variable in /etc/rc.conf. Alas, looking in /etc/default/rc.conf, I see that the "-c" and "-u" options seem to have been deprecated from the "named_flags" variable:

    Code:
    #named_flags=""                 # Use this for flags OTHER than -u and -c


    So, now if I try to use the "named_conf" variable to specify the named.conf file, it still doesn't work:

    Code:
    named_conf="/etc/named.conf"
    
    ...
    
    # /etc/rc.d/named start
    /etc/rc.d/named: ERROR: get_pidfile_from_conf: /etc/named.conf does not exist (named)


    And if I try to specify the full path in the "named_conf" variable, I get another error about includng the path to my chroot:
    Code:
    named_conf="/var/chroot/named/etc/named.conf"
    
    ...
    
    # /etc/rc.d/named start
    /etc/rc.d/named: WARNING: named chroot: /var/chroot/named/etc is a directory!
    rndc-confgen: create keyfile: file not found
    Starting named.
    named: config filename (-c /var/chroot/named/etc/named.conf) contains chroot path (-t /var/chroot/named)
    /etc/rc.d/named: WARNING: failed to start named


    If I leave the config file as /etc/namedb/named.conf in /etc/defaults/rc.conf then everything works fine and dandy. However, I've had my config file in /etc/named.conf in the named chroot for the past 12 years without a problem, and I just hate having to change it because a startup script isn't properly reading the value of a variable. :-/

    Still, thanks for pointing out that information. At least now I know that -u and -c are no longer used in "named_flags".
     
  4. wmoreno3

    wmoreno3 New Member

    Messages:
    60
    Thanks Received:
    3
    ts_fbsd, your thread help me,
    Problem:
    Code:
    root@server:/etc # /etc/rc.d/named start
    /etc/rc.d/named: ERROR: get_pidfile_from_conf: /etc/namedb/named.conf does not exist (named)

    Checking:
    Code:
    root@server:/root # ls -l /var/named/etc/namedb/
    total 40
    drwxr-xr-x  2 bind  wheel    512 Dec  4 04:32 dynamic
    drwxr-xr-x  2 root  wheel    512 Dec  4 04:34 master
    -rw-r--r--  1 bind  wheel  15150 Jan 17 15:57 named.conf
    -rw-r--r--  1 bind  wheel   3135 Dec  4 04:34 named.root
    -rw-------  1 bind  wheel     97 Dec 22 03:49 rndc.key
    drwxr-xr-x  2 bind  wheel    512 Dec  4 04:32 slave
    drwxr-xr-x  2 bind  wheel    512 Jan 25 02:04 working
    root@server:/root # cat /etc/defaults/rc.conf | grep named
    # named.  It may be possible to run named in a sandbox, man security for
    named_enable="NO"               # Run named, the DNS server (or NO).
    named_program="/usr/sbin/named" # Path to named, if you want a different one.
    named_conf="/etc/namedb/named.conf"     # Path to the configuration file
    #named_flags=""                 # Use this for flags OTHER than -u and -c
    named_uid="bind"                # User to run named as
    named_chrootdir="/var/named"    # Chroot directory (or "" not to auto-chroot it)
    named_chroot_autoupdate="YES"   # Automatically install/update chrooted
                                    # components of named. See /etc/rc.d/named.
    named_symlink_enable="YES"      # Symlink the chrooted pid file
    named_wait="NO"                 # Wait for working name service before exiting
    named_wait_host="localhost"     # Hostname to check if named_wait is enabled
    named_auto_forward="NO"         # Set up forwarders from /etc/resolv.conf
    named_auto_forward_only="NO"    # Do "forward only" instead of "forward first"
    root@server:/root # cat /etc/rc.conf | grep named
    named_enable="YES"

    Cause:
    FreeBSD 9.1 was running OK, but named fails today
    Solution:
    Code:
    root@server:/etc # ln -s /var/named/etc/namedb /etc/namedb
    root@server:/etc # /etc/rc.d/named start
    Starting named.

    I do not know what happened, any ideas ?
     
    RedErick thanks for this.
  5. RedErick

    RedErick New Member

    Messages:
    30
    Thanks Received:
    0
    I got the same error ten minutes ago because of unexpected power loss (bad UPS). I think that this could be a file system error.