Date Time issues rPi4

I carefully followed all 4 steps according to your instructions, but the service still does not start on my rPi4.
After restarting, there is the date and time from the last rPi shutdown.

Strange this is basic linux command. Is there something in your network blocking internet access?
is google.com reachable?
wat does this command return:

curl -s --head http://google.com | grep '^Date:' | cut -d' ' -f 3-

This was the case at 17:07

Welcome to Volumio for Raspberry Pi (6.1.69-v7l+ armv7l)
volumio@volumio:~$ date
Wed Jan 31 14:24:17 CET 2024
volumio@volumio:~$ curl -s --head http://google.com | grep β€˜^Date:’ | cut -d’ ’ -f 3-
31 Jan 2024 16:07:26 GMT
volumio@volumio:~$ date
Wed Jan 31 14:26:13 CET 2024
volumio@volumio:~$

After 60 minutes, the date and time will most likely synchronize themselves again as usual.
That’s strange. This has been happening on my rPi4 for about one year.

Here is the log from 17:18

http://logs.volumio.org/volumio/uVZNAMm.html

the piece of code to test I gave, was just for the curl function, not to update your date.
But the test shows it’s working.

To update your date by script:
sudo date +"%d %b %Y %T %Z" -s "$(curl -s --head http://google.com | grep '^Date:' | cut -d' ' -f 3-)"

And this script works,
but after restarting rPi4 the problem returns

Welcome to Volumio for Raspberry Pi (6.1.69-v7l+ armv7l)
Last login: Wed Jan 31 14:24:12 2024 from 192.168.0.115
volumio@volumio:~$ date
Wed Jan 31 14:53:27 CET 2024
volumio@volumio:~$ sudo date +β€œ%d %b %Y %T %Z” -s β€œ$(curl -s --head http://google.com | grep β€˜^Date:’ | cut -d’ ’ -f 3-)”
[sudo] password for volumio:
31 Jan 2024 17:36:38 CET
volumio@volumio:~$

Then I can’t help you.
You stated that you followed my instructions.
You demonstrated that my script itself is working
You have the first rPi, that claims that the service is not there (sudo systemctl status setdatetime.service). Even though my instruction created the service.

Thank you very much for your help and for finding time for me.

I also checked the time synchronization settings on my RPI4 in the Raspberry Pi OS - 32bit system and there the time and date synchronization works correctly right after startup.

I don’t know if the problem may be with Volumio or if there is something wrong with my network.

I have the same. I done all 4 steps and shutdown Pi. After start 10 minutes later I have the same date as I power off Pi

In my friend Pi give correct time and date but Volumio has wrong date.

If I run this script Volumio has correct date and time.

but

tell me because I not understand everything.

Where I should put this script. Because it should be run automatic after start I think.

indeed. The service execute this code as soon as the network is available.

All time after start I have about 19:14

I put

and have

Jan 31 20:46:06 cichy5000 systemd[1]: Started Date Time service.
Jan 31 19:13:55 cichy5000 bash[616]: 31 Jan 2024 19:13:55 CET
Jan 31 19:13:55 cichy5000 systemd[1]: setdatetime.service: Succeeded.

It’s mean that Data Time Service give me wrong time.

I am pretty sure I mentioned this:

but I have the same wrong time, It is not changed. Wrong time zone should give me wrong time zone. I after restart have all time the same wrong time 19:13:55. Now and half hour earlier time server give me the same.

edit:

sudo date +β€œ%d %b %Y %T %Z” -s β€œ$(curl -s --head http://google.com | grep β€˜^Date:’ | cut -d’ ’ -f 3-)”

This command give me correct time and date it mean that it is the same zone like your.

Not sure why its failing. Have the same script on my rPi:
image

just forced wrong dates, seems things are stuggling indeed:

volumio@volumio-rpi4:~$ sudo date -s "28 JAN 2024 11:34:00"
Sun Jan 28 11:34:00 CET 2024
volumio@volumio-rpi4:~$ sudo systemctl stop setdatetime.service
volumio@volumio-rpi4:~$ sudo systemctl start setdatetime.service
volumio@volumio-rpi4:~$ date
Mon Jan 29 08:23:47 CET 2024

I find it:

in
/lib/systemd/system/setdatetime.service

I have

and it is correct.

but in
/home/volumio/setdatetime.sh

I have

it reason why I have still the same time :slight_smile:

yep, seems cat just place the date not the url. Good finding.

so do the following:

nano /home/volumio/setdatetime.sh

copy in this file:

#!/bin/bash
date +"%d %b %Y %T %Z" -s "$(curl -s --head http://google.com | grep '^Date:' | cut -d' ' -f 3-)"

CTRL+O
Enter
CTRL+X

sudo systemctl stop setdatetime.service
sudo systemctl start setdatetime.service
volumio@volumio-rpi4:~$ nano /home/volumio/setdatetime.sh
volumio@volumio-rpi4:~$ sudo systemctl stop setdatetime.service
volumio@volumio-rpi4:~$ sudo systemctl start setdatetime.service
volumio@volumio-rpi4:~$ date
Wed Jan 31 21:46:45 CET 2024

steel something wrong because time server give me always time 00:00:00

Jan 31 21:50:01 cichy5000 systemd[1]: Started Date Time service.
Jan 31 00:00:00 cichy5000 bash[623]: 31 Jan 2024 00:00:00 CET
Jan 31 00:00:00 cichy5000 systemd[1]: setdatetime.service: Succeeded.

What is the output of:

cat /home/volumio/setdatetime.sh

I changed to this:

and still the same.

Strange is that if I use

I have correct date:

Welcome to Volumio for Raspberry Pi (6.1.69-v7l+ armv7l)
volumio@cichy5000:~$ date
Wed Jan 31 01:01:35 CET 2024
volumio@cichy5000:~$ sudo systemctl stop setdatetime.service
volumio@cichy5000:~$ sudo systemctl start setdatetime.service
volumio@cichy5000:~$ date
Wed Jan 31 21:59:10 CET 2024
volumio@cichy5000:~$