Named service won't start - seems to be caching errors

14,378

Okay, so I managed to resolve this by changing one line in /etc/init.d/named:-

Line 29 in /etc/init.d/named changed from...

named='named'

To...

named='named -u named'

Then service would start back up again without issue. Nothing like a misleading error message!

Sigh.

Share:
14,378

Related videos on Youtube

zigojacko
Author by

zigojacko

Updated on September 18, 2022

Comments

  • zigojacko
    zigojacko over 1 year

    When I try to restart / start the named service, it keeps failing.

    service named restart
    

    Results in:-

    Stopping named:                                            [  OK  ]
    Starting named:
    Error in named configuration:
    /etc/named.conf:2: missing ';' before '}'
                                                               [FAILED]
    
    service named start
    

    Results in:-

    Starting named:
    Error in named configuration:
    /etc/named.conf:2: missing ';' before '}'
                                                               [FAILED]
    

    The thing is, even if named.conf contains no syntax errors or even if the file doesn't exist at all, I'm still getting this error preventing me from starting the service.

    Currently trying with a named.conf containing the following:-

    options {
    listen-on port 53 { 127.0.0.1; };
    };
    

    And checking the syntax of named.conf using

    named-checkconf /etc/named.conf
    

    Results in no errors. Yet when starting the service, I still get the above error.

    I can't see any other errors in the logs relating to this and don't really know where to get to the bottom of this. Any ideas?

    (Even reverting back to the named.conf file that was in place before I stopped the service returns the same error now and this was previously running fine).

    Contents on init.d/named can be seen at this pastebin.

    CentOS 6.4 - Linux version 2.6.32-358.6.2.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Thu May 16 20:59:36 UTC 2013

    Update

    bash -x /etc/init.d/named start
    

    Snippet from results possibly of relevance?

    + echo 'Error in named configuration:'
    Error in named configuration:
    + echo '/etc/named.conf:2: missing '\'';'\'' before '\''}'\'''
    /etc/named.conf:2: missing ';' before '}'
    + failure
    + local rc=0
    + '[' color '!=' verbose -a -z '' ']'
    + echo_failure
    + '[' color = color ']'
    + echo -en '\033[60G'
                                                               + echo -n '['
    [+ '[' color = color ']'
    + echo -en '\033[0;31m'
    + echo -n FAILED
    FAILED+ '[' color = color ']'
    + echo -en '\033[0;39m'
    + echo -n ']'
    ]+ echo -ne '\r'
    + return 1
    + '[' -x /bin/plymouth ']'
    + /bin/plymouth --details
    + return 0
    + echo
    
    • S edwards
      S edwards about 10 years
      have you watch the script that probably exists in /etc/init.d/named ? the errors probably come from there
    • zigojacko
      zigojacko about 10 years
      Even though it specifically states /etc/named.conf file? (I've run a named-checkconfig on /etc/init.d/named as well but nothing flagged that would prevent service from starting). Thanks.
    • Anthon
      Anthon about 10 years
      @GeoffJackson-zigojacko yes, the service command does not execute /etc/named.conf it probably executes /etc/init.d/named, and that you cannot check with named-checkconf as it is not a named config file.
    • Anthon
      Anthon about 10 years
      @GeoffJackson-zigojacko what is your distribution? (Add a tag to the question).
    • zigojacko
      zigojacko about 10 years
      I see, thanks @Anthon (distro CentOS 6.4 - full version added above). What would be the process to check for issues in /etc/init.d/named please?
    • S edwards
      S edwards about 10 years
      @GeoffJackson-zigojacko copyt paste the content in your question or just open it and see where the error can happen to identify the problem, most of the time this is just a bash script. you can also tries bash -x /etc/init.d/named start to debug the script
    • zigojacko
      zigojacko about 10 years
      Thanks @Kiwy - will try the bash debug. Content can be seen at this pastebin too.
    • Anthon
      Anthon about 10 years
      @GeoffJackson-zigojacko And if the debug doesn't work, you can always insert some print statements in the scripts to narrow down where in the /etc/init.d/named script the message is generated.
    • zigojacko
      zigojacko about 10 years
      Managed to resolve by fluke (see my answer). Not entirely sure why this fixed it /was causing the error though. Thanks for both of your help.
  • S edwards
    S edwards about 10 years
    it's nice that you find a solution.