Plesk is one of the most full featured control panel in web hosting industry. Due to availability in both Linux and Windows platform Plesk is the choice of many System Administrators. Right now the latest release of Plesk control panel is Plesk Onyx. While restarting or troubleshooting DNS server in Plesk Onyx Linux many system administrators may encounter the following scenario with some “localhost.rev” error.
Command to restart
service named restart
systemctl restart named
In Plesk Onyx Linux, BIND DNS serer (named) always fails to start with above command. While checking the status of named service you may find an error message “loading from master file localhost.rev failed: file not found” along with several other file not found. The situation is demonstrated in the following figure.
The error is always persistent as as of now I didn’t find any clear documentation regarding this. Some of the inappropriate documentations may be found in link 1, link 2, link 3. I still hope Plesk official site do have some documentation regarding this but I didn’t find any..!!
My Story and System Environment
I’m writing this troubleshooting tutorial after facing the issue while setting up Plesk Onyx in a new server and no way I’m related to Plesk Developer team. I was playing around a little regarding ‘rndc’ setup for Slave name server. During that I altered some configuration and that leads me to writing this finally. I read several online tutorial including those linked above. Then I contacted Plesk professional. But as my license is from my server hosting provider they redirected me to hosting provider for support. Now after looking a little my hosting provider confirmed it as a complicate issue and asked for a diagnosis charge of USD 25 / 15 minutes and left me alone.
Some font practice used
All terms and name of daemon are written in italic inside a single quote like ‘ifconfig’, ls’ etc. All directory and file names are written in italic in a double quote. For example ‘named’ refers named user and named daemon and “named.conf” refers a file.
Reason and Diagnostics
Lets try to understand why this is happening. The striking part was the problem is very persistant and reproducable in any server. It’s impossible that a control panel like Plesk don’t have a running DNS server. Following way of diagnostics may be helpful
- In a clean server with Plesk installed DNS is working.
- The DNS server is BIND 9 off course (named Daemon in CentOS or RHEL)
- But you are unable to start or stop the DNS server using the way described above.
- If by any means it’s stopped you are unable o start it using the above command.
- In default configuration DNS server is working after system restart.
This saliently indicating that ‘named’ is not directly responsible for a DNS server in Plesk Onyx for Linux. Now let’s find what it is..!!
In the 5th point look that the default DNS server is working even after restart. So my approach was let’s find out what processes are enabled during system restart in freshly installed Plesk serve. Then find out something similar to ‘named’. In CentOS 7.3 environment you may use the following command to find processes (daemons – read more about daemons in RedHat ).
Then directly pipe it and find any ‘named’ in this with the output.
|systemctl list-unit-files | grep named|
The following figure explains the scenario for me.
You may clearly look that the service ‘named’ is disable on start up. So it’s not what is running the DNS server. The process responsible for DNS server is ‘named-chroot’ rather ‘named’ itself. Now I don’t know why then Plesk keep the process ‘named’ i.e. unmodified daemon of BIND 9 installed. But, while playing around things, I had altered some configuration. And was trying to turn on the service using familiar ‘named’ instead ‘named-chroot’.
If you are with me till now you already know the solution. But if you liked to jump to get the situation solved this is for you.
- Stop any ‘named’ if running with the following command. [It should not run if you’ve not seriously messed around the configuration file “/etc/named.conf” like me]
service named stop
systemctl stop named
- Turn off ‘named’ from system start up [if it is on, or just type the following to make it sure].
chkconfig named off
systemctl disable named
- Restore “/etc/named.conf” to it’s default if you’ve modified it. You may restore from a backup if you’ve one. Else at least ensure ‘directory “/var”;’ is correct in the “named.conf” configuration file. Or you may download the default “named.conf” from here for a freshly installed Plesk Onyx in CentOS 7.3 server, copy the text from the downloaded pdf to a file “/var/named/chroot/etc/named.conf”. Then create a symlink from “/etc/named.conf” to “/var/named/chroot/etc/named.conf” with the following command.
ln -sf /var/named/chroot/etc/named.conf /etc/named.conf
- Start ‘named-chroot’ with the following command
service named-chroot start
systemctl start named-chroot
- Enable ‘named-chroot’ at system start up
chkconfig named-chroot on
systemctl enable name-chroot
Check everything is working fine
You’re finished doing this, but before leaving just ensure everything is really working as it should.
- Check a DNS server is working in your system. If so, you’ll get some reply [not error message] while running the following command. [Typically a list of root name server is returned as reply, if recursion is on. If recursion is off the running local DNS server responds without any answer section.]
- Check some process is listening on post 53 with the following command.
netstat -tunlep | grep :53
This shall return ‘named’ listening on port 53
- Check ‘named-chroot’ is on at system start up with the following command
systemctl is-enabled named-chroot
This shall reply with an ‘enabled’.
If all above are positive for you, Congratulation the localhost.rev problem is over for you..!! 🙂 🙂
Further understanding about named-chroot
You may become interested what is this ‘named-chroot’ in Plesk Onyx Linux. In Linux chroot refers a procedure to keep users jailed in their respective home directory. A details about chroot and how to set it up will be a next post. The service ‘named-chroot’ run under an user ‘named’. Now, I think, for security reason Plesk want to keep this user chrooted.
You may notice, and surprised, that the directory derivative is set to “/var” in “named.conf” file. This theoretically means ‘/var’ is the directory where your DNS zone files and all other Zone related files are located. Surely this is not the case. You’ll find not a single zone file located just under “/var“. Plesk tricks to jail the user ‘named’ in “/var/named/chroot” while running the daemon ‘named-chroot’. Now for the user ‘named’ and for the daemon ‘named-chroot’ “/” actually indicate “/var/named/chroot/”. So, “/var” will become “/var/named/chroor/var” and you’ll find all your DNS Zone files, DNSSEC keys and all other DNS Zone related file in this directory.
Now regarding the actual problem, while starting ‘named’ daemon and not ‘named-chroot’ the user is getting non chrooted access. Hence “/var” is actually the system “/var” folder and “localhost.rev” is “/var/localhost.rev” which doesn’t exists. Same for all other zone files. So the daemon has no way but fail. Now for ‘named-chroot’ daemon “lcalhost.rev” is “/var/named/chroot/var/localhost.rev” which do exists and the DNS zone file for ‘localhost’ and your “hostname”.
This completes a full analysis and troubleshoot of ‘localhost.rev’ not found issue in Plesk Onyx Linux. Along with that we’ve covered the basic of ‘bind-chroot’ in Plesk Onyx Linux. For any quarry and suggestion please leave comment. Thanks for reading us.