Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

How to repair DNS

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
User avatar
fred44nl
Posts: 215
Joined: 2018-07-14 08:54
Has thanked: 1 time

How to repair DNS

#1 Post by fred44nl »

My system runs Debian 10 - Buster with kernel 4.19.118-2+deb10u1.
In order to test Pi-hole, I installed this with the script that has to be downloaded.
After testing for some time, I removed Pi-hole with the same script, using the uninstall option.
This must have caused my DNS to be damaged.
In order to try and solve this I installed or reinstalled dnsutils, ifupdown, iproute2, resolvconf.
But this did not repair my DNS.

I found that this can be solved by editing /etc/resolvconf/resolv.conf.d/tail and adding some working nameservers.
After that I ran

Code: Select all

sudo resolvconf -u 
The result in /etc/resolv.conf is

Code: Select all

fred44nl@Debian:~$ cat /etc/resolv.conf
# 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
nameserver 127.0.0.1
nameserver 1.1.1.1
nameserver 192.168.1.1
If I remove the 2nd and 3rd line from /etc/resolvconf/resolv.conf.d/tail and run resolve -u again, there is only the 1st line.
which means that DNS is looking on my loacalhost, which does not have a DNS server running.

so, where did it go wrong ??
Debian 10 - Buster on Compulab Fitlet2
Debian 12 - Bookworm on Acer Spin 1

LE_746F6D617A7A69
Posts: 932
Joined: 2020-05-03 14:16
Has thanked: 7 times
Been thanked: 65 times

Re: How to repair DNS

#2 Post by LE_746F6D617A7A69 »

Unless You're using some non-default network setup, the /etc/resolv.conf should be empty, and You should not use/install the resolvconf program at all.
Debian uses the NetworkManager (NM) by default, and by default there's no strictly defined DNS server address. The NM uses UDP port 53 to send DNS queries - so it uses the DNS provided by Your ISP or defined in Your router.

In fact, the NM ignores the /etc/resolv.conf and uses connection configuration from /etc/NetworkManager/system-connections/<your_connection>, and normally no DNS address should be defined in this file.

So basically, the DNS should work fine using standard NM connections - and the question is: how do You create/initialize the connections?
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed

User avatar
fred44nl
Posts: 215
Joined: 2018-07-14 08:54
Has thanked: 1 time

Re: How to repair DNS

#3 Post by fred44nl »

thank you.
I have a list of all installed packages from some time ago, but there is no NetworkManager on it.
also, I have a copy of my system, made with rsync and again no NetworkManager.
I don't think that I have a special network set-up
it has installed from an iso-file and nothing has been done to network settings.
never had problems with DNS, nor DHCP.
there is a service called resolvconf running and acrive.

don't understand what you mean with " how do You create/initialize the connections?"

almost everything I do is over SSH
my laptop makes connections using Samba
Debian 10 - Buster on Compulab Fitlet2
Debian 12 - Bookworm on Acer Spin 1

LE_746F6D617A7A69
Posts: 932
Joined: 2020-05-03 14:16
Has thanked: 7 times
Been thanked: 65 times

Re: How to repair DNS

#4 Post by LE_746F6D617A7A69 »

fred44nl wrote:I have a list of all installed packages from some time ago, but there is no NetworkManager on it.
also, I have a copy of my system, made with rsync and again no NetworkManager.
NM is installed by default, unless You have non-standard setup.
Can You post the output of:

Code: Select all

dpkg-query -l network-manager
What do You have in the /etc/NetworkManager/system-connections/ directory ?
fred44nl wrote:don't understand what you mean with " how do You create/initialize the connections?"
By default, NM initializes the wired connections automatically. If You don't have NM installed, then You must use tools like ifupdown and manually configure the network.
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: How to repair DNS

#5 Post by Head_on_a_Stick »

LE_746F6D617A7A69 wrote:the /etc/resolv.conf should be empty
^ This is incorrect.
LE_746F6D617A7A69 wrote:Debian uses the NetworkManager (NM) by default
Not for all of the desktop options and not if no desktop is selected at all.
LE_746F6D617A7A69 wrote:the NM ignores the /etc/resolv.conf
^ This is also incorrect.
fred44nl wrote:where did it go wrong ?
You didn't read

Code: Select all

man 8 resolvconf
This will show how you are connecting so that we can offer better assistance:

Code: Select all

systemctl status --no-p
deadbang

LE_746F6D617A7A69
Posts: 932
Joined: 2020-05-03 14:16
Has thanked: 7 times
Been thanked: 65 times

Re: How to repair DNS

#6 Post by LE_746F6D617A7A69 »

Head_on_a_Stick wrote:Not for all of the desktop options and not if no desktop is selected at all.
Yes, sometimes there are different front-ends used for systemd-notworkd, but everything else holds, unless You'll remove systemd ... or disable the networkd service and configure everything by hand.

By default, the resolv.conf is EMPTY, but after the connection is initialized, it looks like this:

Code: Select all

# Generated by NetworkManager
nameserver 192.168.43.1
So yes, it looks like I've expressed myself not very clear: the resolv.conf is not ignored - it is generated by the NM ;)
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed

User avatar
sickpig
Posts: 589
Joined: 2019-01-23 10:34

Re: How to repair DNS

#7 Post by sickpig »

fred44nl wrote:so, where did it go wrong ??
check your /etc/dhcp/dhclient.conf, pi-hole doesn't seem to remove entries added by it

reference https://www.dedoimedo.com/computers/lin ... oblem.html

edit - corrected /etc/dhcp/dhclient.conf

User avatar
fred44nl
Posts: 215
Joined: 2018-07-14 08:54
Has thanked: 1 time

Re: How to repair DNS

#8 Post by fred44nl »

the output of "dpkg-query -l network-manager" is:

Code: Select all

fred44nl@Debian:~$ sudo dpkg-query -l network-manager
Gevraagd=(U)onbekend/(I)nstalleren/ve(R)wijderen/(P)wissen/(H)ouden
| Status=Niet/Inst/Conf/Uitgep/halF-geconf/Halfgeïnst/verWacht-trig/Trig-bezig
|/ Fout?=(geen)/heRinst. nodig/ (Status,Fout: hoofdletter=ernstig)
||/ Naam            Versie       Architectuur Omschrijving
+++-===============-============-============-=================================
un  network-manager <geen>       <geen>       (geen beschrijving beschikbaar)
fred44nl@Debian:~$ 
and "apt policy network-manager" says:

Code: Select all

red44nl@Debian:~$ sudo apt policy network-manager
network-manager:
  Geïnstalleerd: (geen)
  Kandidaat:     1.14.6-2+deb10u1
  Versietabel:
     1.14.6-2+deb10u1 500
        500 http://ftp.nl.debian.org/debian buster/main amd64 Packages
fred44nl@Debian:~$ 
at the original installation I did choose a very limited setup, as I was used to Rasbian and used to work over SSSH.
Debian 10 - Buster on Compulab Fitlet2
Debian 12 - Bookworm on Acer Spin 1

User avatar
fred44nl
Posts: 215
Joined: 2018-07-14 08:54
Has thanked: 1 time

Re: How to repair DNS

#9 Post by fred44nl »

Head_on_a_Stick wrote:
LE_746F6D617A7A69 wrote:
fred44nl wrote:where did it go wrong ?
You didn't read

Code: Select all

man 8 resolvconf
yes, true, very true
but I was not changing in the settings of DHCP nor DNS
the problem came from uninstalling Pi-hole
This will show how you are connecting so that we can offer better assistance:

Code: Select all

systemctl status --no-p

Code: Select all

fred44nl@Debian:~$ sudo systemctl status --no-p
● Debian
    State: running
     Jobs: 0 queued
   Failed: 0 units
    Since: Fri 2020-07-10 19:38:03 CEST; 14h ago
   CGroup: /
           ├─user.slice
           │ ├─user-110.slice
           │ │ ├─session-c1.scope
           │ │ │ ├─632 lightdm --session-child 18 21
           │ │ │ └─648 /usr/sbin/lightdm-gtk-greeter
           │ │ └─user@110.service
           │ │   ├─gvfs-daemon.service
           │ │   │ └─663 /usr/lib/gvfs/gvfsd
           │ │   ├─init.scope
           │ │   │ ├─637 /lib/systemd/systemd --user
           │ │   │ └─638 (sd-pam)
           │ │   ├─at-spi-dbus-bus.service
           │ │   │ ├─652 /usr/lib/at-spi2-core/at-spi-bus-launcher
           │ │   │ ├─657 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --pri...
           │ │   │ └─659 /usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-session
           │ │   └─dbus.service
           │ │     └─651 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --sy...
           │ └─user-1000.slice
           │   ├─user@1000.service
           │   │ ├─gvfs-daemon.service
           │   │ │ ├─2880 /usr/lib/gvfs/gvfsd
           │   │ │ └─2929 /usr/lib/gvfs/gvfsd-trash --spawner :1.5 /org/gtk/gvfs/exec_spaw/0
           │   │ ├─gvfs-udisks2-volume-monitor.service
           │   │ │ └─2923 /usr/lib/gvfs/gvfs-udisks2-volume-monitor
           │   │ ├─init.scope
           │   │ │ ├─965 /lib/systemd/systemd --user
           │   │ │ └─966 (sd-pam)
           │   │ └─dbus.service
           │   │   └─2834 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --s...
           │   ├─session-2.scope
           │   │ ├─ 875 sshd: fred44nl [priv]
           │   │ ├─ 980 sshd: fred44nl@pts/0
           │   │ ├─ 981 -bash
           │   │ ├─5896 sudo systemctl status --no-p
           │   │ └─5897 systemctl status --no-p
           │   └─session-c2.scope
           │     ├─2899 /usr/bin/ssh-agent -s
           │     ├─2903 /usr/lib/at-spi2-core/at-spi-bus-launcher --launch-immediately
           │     └─2908 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --prin...
           ├─init.scope
           │ └─1 /sbin/init
           └─system.slice
             ├─systemd-udevd.service
             │ └─292 /lib/systemd/systemd-udevd
             ├─cron.service
             │ └─471 /usr/sbin/cron -f
             ├─polkit.service
             │ └─541 /usr/lib/policykit-1/polkitd --no-debug
             ├─lightdm.service
             │ ├─523 /usr/sbin/lightdm
             │ ├─551 /usr/lib/xorg/Xorg :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch
             │ └─684 lightdm --session-child 14 21
             ├─nmbd.service
             │ └─472 /usr/sbin/nmbd --foreground --no-process-group
             ├─systemd-journald.service
             │ └─265 /lib/systemd/systemd-journald
             ├─ssh.service
             │ └─535 /usr/sbin/sshd -D
             ├─xrdp.service
             │ └─536 /usr/sbin/xrdp
             ├─plexmediaserver.service
             │ ├─494 /usr/lib/plexmediaserver/Plex Media Server
             │ ├─629 Plex Plug-in [com.plexapp.system] /usr/lib/plexmediaserver/Resources/Plug-ins-79e214ead/Framework.bu...
             │ ├─770 /usr/lib/plexmediaserver/Plex Tuner Service /usr/lib/plexmediaserver/Resources/Tuner/Private /usr/li...
             │ └─799 Plex Plug-in [com.plexapp.agents.subzero] /usr/lib/plexmediaserver/Resources/Plug-ins-79e214ead/Fram...
             ├─rsyslog.service
             │ └─473 /usr/sbin/rsyslogd -n -iNONE
             ├─dhcpcd.service
             │ └─499 /usr/sbin/dhcpcd
             ├─xrdp-sesman.service
             │ └─514 /usr/sbin/xrdp-sesman
             ├─sabnzbdplus.service
             │ └─681 /usr/bin/python2 /usr/bin/sabnzbdplus --daemon --pidfile /var/run/sabnzbdplus/pid
             ├─ifup@eno1.service
             │ └─852 /sbin/dhcpcd eno1
             ├─udisks2.service
             │ └─484 /usr/lib/udisks2/udisksd
             ├─smbd.service
             │ ├─ 893 /usr/sbin/smbd --foreground --no-process-group
             │ ├─ 895 /usr/sbin/smbd --foreground --no-process-group
             │ ├─ 896 /usr/sbin/smbd --foreground --no-process-group
             │ ├─ 898 /usr/sbin/smbd --foreground --no-process-group
             │ └─1700 /usr/sbin/smbd --foreground --no-process-group
             ├─dbus.service
             │ └─469 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-...
             ├─systemd-timesyncd.service
             │ └─461 /lib/systemd/systemd-timesyncd
             ├─system-getty.slice
             │ └─getty@tty1.service
             │   └─516 /sbin/agetty -o -p -- \u --noclear tty1 linux
             ├─avahi-daemon.service
             │ ├─483 avahi-daemon: running [Debian.local]
             │ └─505 avahi-daemon: chroot helper
             └─systemd-logind.service
               └─482 /lib/systemd/systemd-logind
fred44nl@Debian:~$ 
Debian 10 - Buster on Compulab Fitlet2
Debian 12 - Bookworm on Acer Spin 1

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: How to repair DNS

#10 Post by Head_on_a_Stick »

Looks like you're using ifupdown so you should add the desired nameservers to /etc/network/interfaces: https://wiki.debian.org/NetworkConfigur ... ameservers
LE_746F6D617A7A69 wrote:sometimes there are different front-ends used for systemd-notworkd
Debian does not use systemd-networkd unless configured to do so by the user.
deadbang

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: How to repair DNS

#11 Post by p.H »

Head_on_a_Stick wrote:Looks like you're using ifupdown so you should add the desired nameservers to /etc/network/interfaces
Note that this requires resolvconf else it won't have any effect.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: How to repair DNS

#12 Post by Head_on_a_Stick »

p.H wrote:this requires resolvconf
Yes indeed, good point. Fortunately the OP is already using that.
deadbang

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: How to repair DNS

#13 Post by p.H »

Indeed, but someone else suggested to not use/install it, so I thought that I'd better warn.

User avatar
fred44nl
Posts: 215
Joined: 2018-07-14 08:54
Has thanked: 1 time

Re: How to repair DNS

#14 Post by fred44nl »

sickpig wrote: check your /etc/dhcp/dhclient.conf, pi-hole doesn't seem to remove entries added by it
yes, yes, yes, thank you

I commented the added lines in /etc/dhcp/dhclient out.
also I commented the temporary lines in /etc/resolvconf/resolv.conf.d/tail out.
now my resolv.conf looks like this:

Code: Select all

fred44nl@Debian:~$ cat /etc/resolv.conf
# 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
nameserver 192.168.1.1
search WORKGROUP
## nameserver 1.1.1.1
## nameserver 192.168.1.1
fred44nl@Debian:~$ 


and DNS is working.
I did have to reboot, as

Code: Select all

sudo resolvconf -u 
was not good enough.
is this because previously (in Stretch) I used dhclient and now in Buster it is resolvconf ??
Debian 10 - Buster on Compulab Fitlet2
Debian 12 - Bookworm on Acer Spin 1

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: How to repair DNS

#15 Post by p.H »

You don't use resolvconf instead of dhclient. resolvconf is not a replacement for dhclient. They have totally different roles.
dhclient is a DHCP client, and as such, a DNS information provider.
resolvconf is a framework which manages the contents of /etc/resolv.conf on behalf of any DNS information provider which supports it (/etc/network/interfaces, dhclient, NetworkManager...) instead of each one overwriting /etc/resolv.conf regardless of what another wrote previously.

User avatar
fred44nl
Posts: 215
Joined: 2018-07-14 08:54
Has thanked: 1 time

Re: How to repair DNS

#16 Post by fred44nl »

p.H wrote: dhclient is a DHCP client, and as such, a DNS information provider.
yes, ok, but I don't have dhclient on my system anymore.
so where does my ip-adres through DHCP come from ??
does this happen in /etc/dhcp/dhclient-enter-hooks.d/resolvconf ??
Debian 10 - Buster on Compulab Fitlet2
Debian 12 - Bookworm on Acer Spin 1

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: How to repair DNS

#17 Post by p.H »

dhclient is not the only DNS information provider nor the only DHCP client.
Maybe /etc/network/interfaces{,.d/*}, dhcpcd (another DHCP client that seems to be used on your system).

User avatar
fred44nl
Posts: 215
Joined: 2018-07-14 08:54
Has thanked: 1 time

[solved] Re: How to repair DNS

#18 Post by fred44nl »

p.H wrote:dhclient is not the only DNS information provider nor the only DHCP client.
Maybe /etc/network/interfaces{,.d/*}, dhcpcd (another DHCP client that seems to be used on your system).
I do have /sbin/dhcpcd

ok, thanks
Debian 10 - Buster on Compulab Fitlet2
Debian 12 - Bookworm on Acer Spin 1

User avatar
sickpig
Posts: 589
Joined: 2019-01-23 10:34

Re: How to repair DNS

#19 Post by sickpig »

fred44nl wrote:
sickpig wrote: check your /etc/dhcp/dhclient.conf, pi-hole doesn't seem to remove entries added by it
yes, yes, yes, thank you

I commented the added lines in /etc/dhcp/dhclient out.
also I commented the temporary lines in /etc/resolvconf/resolv.conf.d/tail out.
now my resolv.conf looks like this:

Code: Select all

fred44nl@Debian:~$ cat /etc/resolv.conf
# 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
nameserver 192.168.1.1
search WORKGROUP
## nameserver 1.1.1.1
## nameserver 192.168.1.1
fred44nl@Debian:~$ 


and DNS is working.
I did have to reboot, as

Code: Select all

sudo resolvconf -u 
was not good enough.
is this because previously (in Stretch) I used dhclient and now in Buster it is resolvconf ??
the default dhcp client in buster is still dhclient ref: https://wiki.debian.org/DHCP_Client.
pi-hole might have added the package resolvconf. Not needed though if you are using only dhcpcd to assign dns to /etc/resolv.conf. Just edit /etc/dhcpcd.conf to remove the entries added by pi-hole.

User avatar
fred44nl
Posts: 215
Joined: 2018-07-14 08:54
Has thanked: 1 time

Re: How to repair DNS

#20 Post by fred44nl »

since the repair of my DNS, I have had a temperary DNS resolve problem, twice
the solution has been in both cases, was to reboot.

the problem causes running software to be unable to get a dns-resolution.
my resolv.conf looks like this

Code: Select all

fred44nl@Debian:~$ sudo cat  /etc/resolv.conf
# Generated by dhcpcd from eno1.dhcp
# /etc/resolv.conf.head can replace this line
domain WORKGROUP
nameserver 1.1.1.1
nameserver 192.168.1.1
# /etc/resolv.conf.tail can replace this line
Debian 10 - Buster on Compulab Fitlet2
Debian 12 - Bookworm on Acer Spin 1

Post Reply