monapi
Posts: 45
Joined: Tue Aug 07, 2018 7:53 am

raspberry pi3 can't set date and time to the correct value with internet of LAN cable

Thu Dec 13, 2018 8:09 am

hi,
the problem is my raspberry pi 3 doesn't show the correct date and time. i use https://www.raspberrypi.org/documentati ... s-point.md tutorial and make raspberry pi an access point and now raspberry pi can connect to the internet with Ethernet cable and its wifi doesn't work. i set the location from 'raspi-config' and use these commands:
sudo /etc/init.d/ntp stop
sudo ntpd -q-g
sudo /etc/init.d/ntp start
but it still doesn't show the correct date and time.
i want to know does the problem related to that wifi doesn't work
and how can i fix the problem?
thank you

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: raspberry pi3 can't set date and time to the correct value with internet of LAN cable

Thu Dec 13, 2018 8:59 am

Are you using Raspbian Stretch?
If so, then you don't have the ntp service (and you should receive error messages when you use the init.d commands you mentioned.
What is the output of

Code: Select all

timedatectl
systemctl status systemd-timesyncd.service

monapi
Posts: 45
Joined: Tue Aug 07, 2018 7:53 am

Re: raspberry pi3 can't set date and time to the correct value with internet of LAN cable

Thu Dec 13, 2018 9:41 am

i use raspbian stretch .i installed ntp. this command
timedatectl
shows what i set in raspi-config location and this command
systemctl status systemd-timesyncd.service
shows this:
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendo
Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
└─disable-with-time-daemon.conf
Active: inactive (dead)
Docs: man:systemd-timesyncd.service(8)
lines 1-6/6 (END)
and when i run this command i receive this error :
ntpd - NTP daemon program - Ver. 4.2.8p10
Usage: ntpd [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \
[ <server1> ... <serverN> ]
but before it shows some date and time and adding to them i don't know why it doesn't work.

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: raspberry pi3 can't set date and time to the correct value with internet of LAN cable

Thu Dec 13, 2018 9:47 am

monapi wrote:
Thu Dec 13, 2018 9:41 am
i use raspbian stretch .i installed ntp.
Why. You should not need that and it will probably interfere with the systemd method.
I would suggest you uninstall it.
this command
timedatectl
shows what i set in raspi-config location
Please post the full output. There is more to it than just what you configured.
and this command
systemctl status systemd-timesyncd.service
shows this:
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendo
Drop-In: /lib/systemd/system/systemd-timesyncd.service.d
└─disable-with-time-daemon.conf
Active: inactive (dead)
Docs: man:systemd-timesyncd.service(8)
lines 1-6/6 (END)
This is dead almost certainly because you installed the ntp package.
On a standard Raspbian Stretch system it's normally not needed

monapi
Posts: 45
Joined: Tue Aug 07, 2018 7:53 am

Re: raspberry pi3 can't set date and time to the correct value with internet of LAN cable

Thu Dec 13, 2018 9:56 am

it doesn't show the correct time so i search and thought i should install ntp.
this is what systemctl shows:
Local time: Wed 2018-12-12 02:58:59 +03
Universal time: Tue 2018-12-11 23:58:59 UTC
RTC time: n/a
Time zone: Asia/Istanbul (+03, +0300)
Network time on: yes
NTP synchronized: yes
RTC in local TZ: no
Local time is now: Wed Dec 12 02:58:24 +03 2018.
Universal Time is now: Tue Dec 11 23:58:24 UTC 2018.

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: raspberry pi3 can't set date and time to the correct value with internet of LAN cable

Thu Dec 13, 2018 9:58 am

I would suggest you take the other actions I mentioned (remove ntp).
Otherwise I cannot help you any further

monapi
Posts: 45
Joined: Tue Aug 07, 2018 7:53 am

Re: raspberry pi3 can't set date and time to the correct value with internet of LAN cable

Thu Dec 13, 2018 10:05 am

DirkS wrote:
Thu Dec 13, 2018 9:58 am
I would suggest you take the other actions I mentioned (remove ntp).
Otherwise I cannot help you any further
i remove ntp.

DirkS
Posts: 10363
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: raspberry pi3 can't set date and time to the correct value with internet of LAN cable

Thu Dec 13, 2018 10:28 am

Please run

Code: Select all

sudo systemctl daemon-reload
sudo systemctl start systemd-timesyncd
and then post the same outputs as I asked before.
Please make sure you get the full output of the status of the service (the previous one had truncated lines)

W. H. Heydt
Posts: 12648
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: raspberry pi3 can't set date and time to the correct value with internet of LAN cable

Fri Dec 14, 2018 12:43 am

Another point... Wrap the posted output in [ code ] [ /code ] markup (without the spaces).

Return to “Beginners”