can't change DNS to add 127.0.0.1 to the list of DNS servers

I posted this in issues which might have been the wrong place for a (currently) GPL user.

Operating System:
Ubuntu 14.04 LTS
Description

After fighting Centos7 for over a week I created a new cloud server running Ubuntu 14.04.3 . I immediately installed Virtualmin version 4.18.gpl and post congifured it. All looked really promising till the configuration check where I got -“Virtualmin is configured to setup DNS zones, but this system is not setup to use itself as a DNS server. Either add 127.0.0.1 to the list of DNS servers, or turn off the BIND feature on the module config page.”

I tried many time to add 127.0.0.1 but the error remains. On the Hostname and DNS Client screen I can add 127.0.0.1 to the DNS list but it isn’t saved.

I can alter and save hostname and resolution order but not DNS list or “search” domains.

I can change and save these settings on the centos7 server Virtualmin but not the Ubuntu version.

Turning off Bind didn’t seem to work either.

I guess some permissions are wrong somewhere.
Eddie,

I find Cenots 7 great and never had a problem (at least not big one) with Virtualmin. You should stick with one OS and try to solve the problems instead on jumping from one OS to another and in the process change one problem with another.

You should change “/etc/resolv.conf” and add “127.0.0.1” to that file if for some reason you cant edit from Wmin - Net. conf. - Hostname and DNS Client.

I’m not exactly “jumping” I’ve been stuck for quite a while.

Creating a new server in a cloud is cheap and easy so I thought I’d give Ubuntu a try.

Things that took me days in centos happened in minutes on Ubuntu - then I hit the above snag.

One reason for my drama with centos may be because I started with webmin and then added virtualmin.

If I’d installed the combined package it may have gone smother.

Howdy,

Is your server by chance setup to obtain it’s IP address via DHCP, rather than using a static IP address?

That could cause the issue you’re seeing, and cause the DNS servers to be overwritten periodically.

If that’s the case, is it possible to change your IP to a static IP?

There are some additional thoughts on that particular issue here:

https://www.virtualmin.com/documentation/dns/faq#Received_Virtualmin_error_that_127.0.0.1_isn-t_listed_in_etcresolv.conf

andreychek,
The server is in a cloud by binarylane.com.au
The IP is static but I don’t know how the server gets the IP.
Thanx - I will be following up but there is an unrelated server issue I need to fix first.

BTW, the conf file starts with -
“# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)”
“# DO NOT EDIT THIS FILE BY HAND – YOUR CHANGES WILL BE OVERWRITTEN”

File resolv.conf is usually overwritten during server restart. In my case all Vmin docs and suggestions from Eric didnt work, it could be because of virtualization, so i made a simple solution.

First create new file with the same name resolv.conf in root folder (or new folder, doesnt matter). Edit new file and add:
search domain1.tld domain2.tld domain3.tld (and so on, depends how many domains you have)
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver xxx.xxx.xxx.xxx (your server IP)

Then edit etc/rc.local and add this line:

/bin/cp /root/resolv.conf /etc/resolv.conf

Of course if you saved your custom resolv.conf somewhere else and not in root then change /root/resolv.conf to match your path.

This solution works on Centos 7 without any problem but i’m not sure if can be applied to Ubuntu.

P.S. Before you restart your server make a local copy of your original resolv.conf file.

Thanx.
I was wondering if something like that would work.

Instead of
/bin/cp /root/resolv.conf /etc/resolv.conf
it is
/bin/cp /resolv.conf /run/resolvconf/resolv.conf

/etc/resolv.conf is a link so I copied to the actual file and I needed to remove the
“/root”
It appears to be working - thanx again.
Eddie,

Nice that it works just be sure it will run immediately after server restart or the resolv.conf will be overwritten and you will be at the beginning. On Centos i got that by editing rc.local so be sure you do same but for Ubuntu.

I did one restart. Yes the copy command is in rc.local
Four accounts are migrated and PHP is being served.
Mail is starting to flow in which is a relief because that had be stumped on centos.
One virtual server to move (getting some errors ATM) and the centos server can be deleted.
Nice to be over the hump.
Good to see this forum is active and useful.