datetime problems at boot

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

datetime problems at boot

Postby hit » Tue Aug 13, 2019 8:51 am

I have a raspberry pi I use for an irrigation system. The problem is that, every time it reboots, the system time is wrong, and I cannot set it to sync it automatically.

I have discover that when the system time is wrong, dns requests doesn't work, so every time I try to send a request I just get:

Code: Select all
[root@alarmpi me]# ntpdate 3.es.pool.ntp.org
Error resolving 3.es.pool.ntp.org: Name or service not known (-2)
12 Aug 15:37:15 ntpdate[2385]: Can't find host 3.es.pool.ntp.org: Name or service not known (-2)
12 Aug 15:37:15 ntpdate[2385]: no servers can be used, exiting


By the way I get the same connection errors if I try to use pacman, wget, python/requests, even ping... So it is a dns thing for sure.

Code: Select all
[me@alarmpi ~]$ ping https://google.com
ping: https://google.com: Name or service not known


If I set the time and date manually, it works again, but I live 300km from where this thing is, and I can't do it manually every day there is a power cut.

Code: Select all
[root@alarmpi me]# timedatectl
               Local time: Mon 2019-08-12 15:47:40 CEST
           Universal time: Mon 2019-08-12 13:47:40 UTC
                 RTC time: n/a
                Time zone: Europe/Madrid (CEST, +0200)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no
[root@alarmpi me]# timedatectl set-ntp false
[root@alarmpi me]# timedatectl set-time "2019-08.13 10:45:45 CEST"
[root@alarmpi me]# ping google.com
PING google.com (172.217.168.174) 56(84) bytes of data.
64 bytes from 172.217.168.174 (172.217.168.174): icmp_seq=1 ttl=54 time=22.7 ms
64 bytes from 172.217.168.174 (172.217.168.174): icmp_seq=2 ttl=54 time=31.6 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 292ms
rtt min/avg/max/mdev = 22.739/27.161/31.583/4.422 ms

[root@alarmpi me]# ntpdate 3.es.pool.ntp.org
13 Aug 10:49:54 ntpdate[2498]: adjust time server 37.139.121.60 offset 0.004894 sec




So I'm a little lost here. How can I sync the clock automatically if it doesn't let me connect to the service because I'm out of sync?
hit
 
Posts: 3
Joined: Wed Jun 19, 2019 7:17 pm

Re: datetime problems at boot

Postby lostinlinux » Tue Aug 13, 2019 7:44 pm

i had the same problem a couple months ago. it was caused by DNSSEC. this solved it for me:
Code: Select all
echo 'DNSSEC=false' >> /etc/systemd/resolved.conf


bug report: https://github.com/systemd/systemd/issues/5873
lostinlinux
 
Posts: 7
Joined: Sun Jul 21, 2013 6:26 pm

Re: datetime problems at boot

Postby hit » Thu Aug 15, 2019 9:05 am

Thank you very much, that was it.
hit
 
Posts: 3
Joined: Wed Jun 19, 2019 7:17 pm


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 3 guests