PowerDNS Error Not Starting

This mornings issue of the day was, PowerDNS Error Not Starting on a Cpanel WHM server.

pdns has failed. Contact your system administrator if the service does not automagically recover.

AlmaLinux is the Linux platform but that is not expected to be a factor in this.

I could see errors in both the WHM web interface and at the command line. Slightly different text depending on which method, but the essence was the same. DNS is broken.

pdns_server[347366]: Error parsing bind configuration: Error in bind configuration '/etc/named.conf' on line xxxx : syntax error

Checking further in the /var/log/messages with a filter to find pdns entries:

#grep -n5 pdns /var/log/messages
2120518:Mar 29 01:38:49 ns3 pdns_server[87833]: [webserver] Listening for HTTP requests on
2120519:Mar 29 01:38:49 ns3 pdns_server[87833]: Creating backend connection for TCP
2120520:Mar 29 01:38:49 ns3 pdns_server[87833]: Error parsing bind configuration: Error in bind configuration '/etc/named.conf' on line 1274: syntax error

So the error is at a specific line and using my preferred Linux editor ‘mcedit’ (midnight commander editor “#yum install mc” will get it for you) I can see that the line is:

view "external" {

Which looks to be ok, so the issue must be within the syntax and manifests at that line.

Using named-checkconf to get an output:

# named-checkconf named.conf
named.conf:1274: unknown option 'view'
named.conf:2485: unexpected token near end of file

Of course, your line numbers will vary. However, the “unknown option ‘view'” is the one that we need to sort out, as ‘view’ is definitely a valid syntax option in named.conf.

So why is it broken ?

The syntax of the named.conf requires

  • a semi-colon ‘;’ to terminate each line or command
  • braces to open and close specific sections like { }

In this specific case, for reasons unknown, the view command at line 65 was opened correctly:

view "internal" { 
  • view command is valid
  • “internal” is the view name
  • the opening brace { is correctly placed

However when we get to lines 1270 and the last ‘zone’ element in the view section, the named.conf file failed to close the view segment with a closing brace and semi-colon, like ‘ }; ‘.

  ## end of last zone in the "internal" view section
}; //  this correctly closes the zone

}; // but this to close the "internal" view section is / was missing

view     "external" {

So the named.conf file was trying to have a second ‘view’ segment opening before the previous one was closed and that is a syntax error for named.conf. You cannot nest or embed ‘views’.

Ultimately a quick delete of named.conf and use of the cpanel rebuild script:

# /usr/local/cpanel/scripts/rebuilddnsconfig

fixed the problem. Noting that you must delete or rename the named.conf file first. If not then that rebuild script will run and silently not replace the named.conf with a working file. So your result is the same file, still not working.

I did review a number of pages gathering ideas for fixing this including:

As a bonus: named-checkconf can also accept an alternative filename so if you save multiple named.conf versions you can compare the output of errors or lack thereof. I used it when checking like this:

[root@ns3 etc]# named-checkconf named.conf.rebuild-save-thowden
named.conf.rebuild-save-thowden:1274: unknown option 'view'
named.conf.rebuild-save-thowden:2485: unexpected token near end of file

Use # named-checkconf -h to see a full list of options.

Leave a Comment