The officially official Devuan Forum!

You are not logged in.

#1 2018-11-28 17:47:54

giorgiob
Member
Registered: 2017-04-30
Posts: 18  

Apt-get: DNS problem

I am not sure what the problem on my laptop is (running Devuan Ascii). Maybe I have interrupted
an upgrade a few days ago and some executables or configuration files got broken, no idea.

Anyway, apt-get has stopped working and is not able to resolve hostnames. For example:

$ sudo apt-get update
Err:1 http://deb.devuan.org/merged ascii InRelease
  Could not resolve 'deb.devuan.org'
Err:2 http://deb.devuan.org/merged ascii-security InRelease
  Could not resolve 'deb.devuan.org'
Err:3 http://deb.devuan.org/merged ascii-updates InRelease
  Could not resolve 'deb.devuan.org'
Err:4 http://deb.devuan.org/merged ascii-backports InRelease
  Could not resolve 'deb.devuan.org'
Reading package lists... Done
W: Failed to fetch http://deb.devuan.org/merged/dists/ascii/InRelease  Could not resolve 'deb.devuan.org'
W: Failed to fetch http://deb.devuan.org/merged/dists/ascii-security/InRelease  Could not resolve 'deb.devuan.org'
W: Failed to fetch http://deb.devuan.org/merged/dists/ascii-updates/InRelease  Could not resolve 'deb.devuan.org'
W: Failed to fetch http://deb.devuan.org/merged/dists/ascii-backports/InRelease  Could not resolve 'deb.devuan.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.

I have checked that /etc/resolv.conf contains the same nameserver that is configured on another laptop, on which apt-get works.
Also, dig works:

$ sudo dig  deb.devuan.org

; <<>> DiG 9.10.3-P4-Debian <<>> deb.devuan.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5203
;; flags: qr rd ra; QUERY: 1, ANSWER: 16, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;deb.devuan.org.			IN	A

;; ANSWER SECTION:
deb.devuan.org.		115	IN	CNAME	deb.roundr.devuan.org.
deb.roundr.devuan.org.	56996	IN	A	185.26.197.8
deb.roundr.devuan.org.	56996	IN	A	46.4.50.2
deb.roundr.devuan.org.	56996	IN	A	185.203.114.135
deb.roundr.devuan.org.	56996	IN	A	91.121.196.103
deb.roundr.devuan.org.	56996	IN	A	131.188.12.211
deb.roundr.devuan.org.	56996	IN	A	31.220.0.151
deb.roundr.devuan.org.	56996	IN	A	130.225.254.116
deb.roundr.devuan.org.	56996	IN	A	141.84.43.19
deb.roundr.devuan.org.	56996	IN	A	37.220.36.58
deb.roundr.devuan.org.	56996	IN	A	185.183.113.129
deb.roundr.devuan.org.	56996	IN	A	195.85.215.180
deb.roundr.devuan.org.	56996	IN	A	37.187.111.86
deb.roundr.devuan.org.	56996	IN	A	5.196.38.18
deb.roundr.devuan.org.	56996	IN	A	95.216.15.86
deb.roundr.devuan.org.	56996	IN	A	200.236.31.1

;; Query time: 1 msec
;; SERVER: 192.168.2.1#53(192.168.2.1)
;; WHEN: Wed Nov 28 17:38:17 CET 2018
;; MSG SIZE  rcvd: 307

and nslookup gives:

$ nslookup de.deb.devuan.org
Server:		192.168.2.1
Address:	192.168.2.1#53

Non-authoritative answer:
de.deb.devuan.org	canonical name = pkgmaster.devuan.org.
Name:	pkgmaster.devuan.org
Address: 5.196.38.18

192.168.2.1 is the nameserver configured in the resolv.conf file.

I have no idea what I should check next: why are dig and nslookup resolving correctly while apt-get is not?

Offline

#2 2018-11-28 20:00:43

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,251  

Re: Apt-get: DNS problem

Rule out the /etc/hosts file.

Offline

#3 2018-11-29 17:42:05

chris2be8
Member
Registered: 2018-08-11
Posts: 307  

Re: Apt-get: DNS problem

Try:
ping -c 1 deb.devuan.org

That should do the DNS lookup the same way as apt-get does.

Chris

Offline

#4 2018-11-29 18:27:25

arnaiz
Member
From: Leon
Registered: 2018-10-28
Posts: 28  
Website

Re: Apt-get: DNS problem

Try to use another mirror url:

deb http://pkgmaster.devuan.org/merged ascii main

and directly the main repository direction:

deb http://5.196.38.18/merged ascii main

and let see what happen.

Offline

#5 2018-11-29 18:35:00

giorgiob
Member
Registered: 2017-04-30
Posts: 18  

Re: Apt-get: DNS problem

My /etc/hosts contains:

127.0.0.1	localhost laptop-1

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

where laptop-1 is also the host name contained in /etc/hostname

I do not see any difference wrt to the other laptop where everything works fine.

BTW, ntp does not work either: the time is off by one hour and ntp won't synchronize. I tried stopping the service and
forcing synchronization with

$ sudo service ntp stop

and then:

$  sudo ntpd -gq
29 Nov 18:28:06 ntpd[7737]: ntpd 4.2.8p10@1.3728-o Sun Feb 25 21:22:55 UTC 2018 (1): Starting
29 Nov 18:28:06 ntpd[7737]: Command line: ntpd -gq
29 Nov 18:28:06 ntpd[7737]: proto: precision = 1.606 usec (-19)
29 Nov 18:28:06 ntpd[7737]: Listen and drop on 0 v6wildcard [::]:123
29 Nov 18:28:06 ntpd[7737]: Listen and drop on 1 v4wildcard 0.0.0.0:123
29 Nov 18:28:06 ntpd[7737]: Listen normally on 2 lo 127.0.0.1:123
29 Nov 18:28:06 ntpd[7737]: Listen normally on 3 eth0 192.168.2.159:123
29 Nov 18:28:06 ntpd[7737]: Listen normally on 4 lo [::1]:123
29 Nov 18:28:06 ntpd[7737]: Listen normally on 5 eth0 [2003:73:f22:3f49:226:9eff:fe25:3db5]:123
29 Nov 18:28:06 ntpd[7737]: Listen normally on 6 eth0 [fe80::226:9eff:fe25:3db5%2]:123
29 Nov 18:28:06 ntpd[7737]: Listening on routing socket on fd #23 for interface updates

but it stops there indefinitely
On the working laptop it just takes a few seconds and I get:

$ sudo ntpd -gq
29 Nov 19:30:16 ntpd[11274]: ntpd 4.2.8p10@1.3728-o Sun Feb 25 21:22:55 UTC 2018 (1): Starting
29 Nov 19:30:16 ntpd[11274]: Command line: ntpd -gq
29 Nov 19:30:16 ntpd[11274]: proto: precision = 0.162 usec (-22)
29 Nov 19:30:16 ntpd[11274]: Listen and drop on 0 v6wildcard [::]:123
29 Nov 19:30:16 ntpd[11274]: Listen and drop on 1 v4wildcard 0.0.0.0:123
29 Nov 19:30:16 ntpd[11274]: Listen normally on 2 lo 127.0.0.1:123
29 Nov 19:30:16 ntpd[11274]: Listen normally on 3 eth0 192.168.2.108:123
29 Nov 19:30:16 ntpd[11274]: Listen normally on 4 lo [::1]:123
29 Nov 19:30:16 ntpd[11274]: Listen normally on 5 eth0 [2003:73:f22:3f49:3ad5:47ff:fed7:11cb]:123
29 Nov 19:30:16 ntpd[11274]: Listen normally on 6 eth0 [fe80::3ad5:47ff:fed7:11cb%2]:123
29 Nov 19:30:16 ntpd[11274]: Listening on routing socket on fd #23 for interface updates
29 Nov 19:30:17 ntpd[11274]: Soliciting pool server 178.238.225.189
29 Nov 19:30:18 ntpd[11274]: Soliciting pool server 138.201.64.208
29 Nov 19:30:18 ntpd[11274]: Soliciting pool server 213.202.247.29
29 Nov 19:30:19 ntpd[11274]: Soliciting pool server 129.250.35.250
29 Nov 19:30:19 ntpd[11274]: Soliciting pool server 37.58.57.238
29 Nov 19:30:19 ntpd[11274]: Soliciting pool server 2001:4ba0:ffa4:3d2:5:199:135:170
29 Nov 19:30:20 ntpd[11274]: Soliciting pool server 2a01:4f8:221:3c82::123
29 Nov 19:30:20 ntpd[11274]: Soliciting pool server 145.239.0.227
29 Nov 19:30:20 ntpd[11274]: Soliciting pool server 195.50.171.101
29 Nov 19:30:20 ntpd[11274]: Soliciting pool server 131.188.3.220
29 Nov 19:30:21 ntpd[11274]: Soliciting pool server 94.130.231.116
29 Nov 19:30:21 ntpd[11274]: Soliciting pool server 2a01:4f8:212:24c4::12
29 Nov 19:30:21 ntpd[11274]: Soliciting pool server 213.251.52.43
29 Nov 19:30:22 ntpd[11274]: Soliciting pool server 188.68.36.203
29 Nov 19:30:22 ntpd[11274]: Soliciting pool server 2a02:c207:2010:9464::1
29 Nov 19:30:23 ntpd[11274]: Soliciting pool server 94.130.76.108
29 Nov 19:30:23 ntpd[11274]: Soliciting pool server 85.214.38.116
29 Nov 19:30:25 ntpd[11274]: ntpd: time slew +0.001472 s
ntpd: time slew +0.001472s

So I am not making any progress at the moment.

Last edited by giorgiob (2018-11-29 18:55:05)

Offline

#6 2018-11-29 18:39:00

giorgiob
Member
Registered: 2017-04-30
Posts: 18  

Re: Apt-get: DNS problem

chris2be8 wrote:

Try:
ping -c 1 deb.devuan.org

That should do the DNS lookup the same way as apt-get does.

Chris

As a normal user I get:

$ ping -c 1 deb.devuan.org
ping: socket: Operation not permitted

As root I get:

$ sudo ping -c 1 deb.devuan.org
ping: deb.devuan.org: Name or service not known

On the working laptop (from the same LAN), without root:

$ ping -c 1 deb.devuan.org
PING deb.roundr.devuan.org (37.187.111.86) 56(84) bytes of data.
64 bytes from ns327660.ip-37-187-111.eu (37.187.111.86): icmp_seq=1 ttl=54 time=56.4 ms

--- deb.roundr.devuan.org ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 56.463/56.463/56.463/0.000 ms

Offline

#7 2018-11-29 18:49:14

giorgiob
Member
Registered: 2017-04-30
Posts: 18  

Re: Apt-get: DNS problem

arnaiz wrote:

Try to use another mirror url:

deb http://pkgmaster.devuan.org/merged ascii main

and directly the main repository direction:

deb http://5.196.38.18/merged ascii main

and let see what happen.

The first option gives the same error:

$ sudo apt-get update
Err:1 http://pkgmaster.devuan.org/merged ascii InRelease
  Could not resolve 'pkgmaster.devuan.org'
Err:2 http://pkgmaster.devuan.org/merged ascii-security InRelease
  Could not resolve 'pkgmaster.devuan.org'
Err:3 http://pkgmaster.devuan.org/merged ascii-updates InRelease
  Could not resolve 'pkgmaster.devuan.org'
Err:4 http://pkgmaster.devuan.org/merged ascii-backports InRelease
  Could not resolve 'pkgmaster.devuan.org'
Reading package lists... Done
W: Failed to fetch http://pkgmaster.devuan.org/merged/dists/ascii/InRelease  Could not resolve 'pkgmaster.devuan.org'
W: Failed to fetch http://pkgmaster.devuan.org/merged/dists/ascii-security/InRelease  Could not resolve 'pkgmaster.devuan.org'
W: Failed to fetch http://pkgmaster.devuan.org/merged/dists/ascii-updates/InRelease  Could not resolve 'pkgmaster.devuan.org'
W: Failed to fetch http://pkgmaster.devuan.org/merged/dists/ascii-backports/InRelease  Could not resolve 'pkgmaster.devuan.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.

I had tried the second option already: with that I can do

$ sudo apt-get update

but then if I upgrade, symbolic addresses are used at some points and these cannot be resolved.

Offline

#8 2018-11-29 19:56:55

ralph.ronnquist
Administrator
From: Battery Point, Tasmania, AUS
Registered: 2016-11-30
Posts: 1,251  

Re: Apt-get: DNS problem

I think there may well be explanation stories making ipv6 the culprit, and If you don't need it, you should disable it. E.g. put the following into a file /etc/sysctl.d/noipv6.conf and reboot:

net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1

Offline

#9 2018-11-29 23:04:57

arnaiz
Member
From: Leon
Registered: 2018-10-28
Posts: 28  
Website

Re: Apt-get: DNS problem

If @ralph.ronnquist solution not fix the problem I suggest:

- check if your are using mdns4 and how:

grep mdns4 /etc/nsswitch.conf

- check what happen if you use another DNS server like google' s 8.8.8.8.
Also try using static IP configuration and static DNS to exclude DHCP problems. Be sure the netmask its in your address range.

- try ping and telnet 192.168.2.1 53 to be sure your DNS server its accessible.

Something stands out me its why a non root user cant run ping. Maybe it solves with chmod the setuid, but the keys its that maybe you have applied a strong misconfiguration. Try to remember what you done or iterate you shell history.

Last edited by arnaiz (2018-11-29 23:05:40)

Offline

#10 2018-11-30 17:14:37

chris2be8
Member
Registered: 2018-08-11
Posts: 307  

Re: Apt-get: DNS problem

Check what /etc/nsswitch.conf says for hosts (see the man page for nsswitch.conf for what it means).
Check /etc/resolv.conf (that tells the system which DNS server(s) to use).

If there is more than 1 DNS server in there try commenting out all but one and checking if it works with that one.
If there is only one them comment it out and add nameserver 8.8.8.8 (that's google's nameserver).

Chris

Offline

#11 2018-12-01 09:01:30

giorgiob
Member
Registered: 2017-04-30
Posts: 18  

Re: Apt-get: DNS problem

@chris2be8: Thanks for the hints that led me to find the problem!
(Lesson learned: never tweak with a system and leave before you are finished with what you were trying to achieve.)

Indeed I had set

hosts files

in /etc/nsswitch.conf about two weeks ago. The reason, if I can remember correctly, was that my router was giving me wrong or outdated information for some hosts in my LAN.
So I had temporarily changed /etc/nsswitch.conf (without really understanding what I was doing). Then I had to leave and forgot to change the line back to

hosts files dns

I did it now and both apt-get and ntp work again.

Thanks to all of you for your time and useful information.

Offline

Board footer