Date Time issues rPi4

Hi @gvolt,

I try to install Volumio on my friend Pi via Team Viever but still we have error during instalation TouchDisplay, here are logs

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

It is on Pi4 . It works before on previous ver. Now is problem to install it on 3.601 clean installation.

Can you help ??

Please validate the date on your system, guess that is causing the errors:

`Jan 19 18:53:43 `

ups… I will check it. Thank you.

1 Like

Yes, after use

ddate -s “28 JAN 2024 11:34:00” everything started.

I see that my friend hasn’t clock signal, it is wired connection but without time server signal.

Everytime when he turn off Pi, clock on Pi is stoped.

yeah, rPi4 doesn’t come with a RTC.
I have 2 rPi4 suffering the same problem and discussed it internally.
The date does come back with 20 minutes.
Whenever I am in a hurry I use the date command.

I said the same to the owner. “Always after power on Pi you should adjust date and clock”

No that’s the thing, you shouldn’t have to do that.
I have the same issues with 2 out of 4 rPi4.

  • All 4 are connected to the same switch.
  • Same rPi4 HW versions
  • 2 have the correct timedate form start and 2 are annoying me…

But you don’t know why…

UPS… it means that you don’t know everything

:rofl: :rofl: :rofl:

No we don’t know why.
Even debugged it with the help of Volumio’s developers. But for some strange reason, some rPi’s take a holiday, walk the dog, take a beer or whatever, before updating the clock.

I have another situation, this R Pi4 works in my home. I configured Volumio for him. I have it one week with Now Playing clock and weather on screen saver. Time was correct, data too. He wait 3 days for shipping and after power on Pi was 3 days late.

It was his second Pi4, first he burnt with power supply. First works with correct date and time.

you could add the very same command to /etc/rc.local, it will be executed at the startup

Which command ?? Because command what I use it only gives me the date and time I entered.

Something like this:

sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"

or:

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

You only need to find a server in your timezone.

You can start it as service, as you want the network online before doing this:

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

chmod 755 /home/volumio/setdatetime.sh

sudo cat <<EOF >>/lib/systemd/system/setdatetime.service
[Unit]
Description=Date Time service
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/bin/bash /home/volumio/setdatetime.sh

[Install]
WantedBy=multi-user.target
EOF
sudo chmod 644 /lib/systemd/system/setdatetime.service
sudo systemctl daemon-reload && sudo systemctl enable setdatetime.service && sudo systemctl start setdatetime.service

Ran this test on the 2 problem pi’s and it did the trick.

start:
image

reboot:

2 Likes

I have a similar problem. On my rPi4, the time syncs after about 60 minutes.
I applied these settings and they work right after adding the commands, but after a reboot it is back to the time when rPi was last turned off.
What am I doing wrong?

if you’ve added the service it should set the date again during a reboot.
What are the results of:
sudo systemctl status setdatetime.service

login as: volumio
volumio@volumio's password:
                       ___
                      /\_ \                        __
         __  __    ___\//\ \    __  __    ___ ___ /\_\    ___
        /\ \/\ \  / __`\\ \ \  /\ \/\ \ /' __` __`\/\ \  / __`\
        \ \ \_/ |/\ \L\ \\_\ \_\ \ \_\ \/\ \/\ \/\ \ \ \/\ \L\ \
         \ \___/ \ \____//\____\\ \____/\ \_\ \_\ \_\ \_\ \____/
          \/__/   \/___/ \/____/ \/___/  \/_/\/_/\/_/\/_/\/___/

             Free Audiophile Linux Music Player - Version 3.0

          © 2015-2021 Michelangelo Guarise - Volumio Team - Volumio.org

Volumio Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Welcome to Volumio for Raspberry Pi (6.1.70-v7l+ armv7l)
Last login: Wed Jan 31 01:18:28 2024 from 192.168.0.115
volumio@volumio:~$ date
Wed Jan 31 01:26:38 CET 2024
volumio@volumio:~$ sudo systemctl status
â—Ź volumio
    State: degraded
     Jobs: 0 queued
   Failed: 1 units
    Since: Thu 1970-01-01 01:00:09 CET; 54 years 0 months ago
   CGroup: /
           ├─user.slice
           │ └─user-1000.slice
           │   ├─user@1000.service
           │   │ └─init.scope
           │   │   ├─1829 /lib/systemd/systemd --user
           │   │   └─1830 (sd-pam)
           │   └─session-7.scope
           │     ├─1825 sshd: volumio [priv]
           │     ├─1848 sshd: volumio@pts/0
           │     ├─1849 -bash
           │     ├─1865 sudo systemctl status
           │     ├─1866 systemctl status
           │     └─1867 less
           ├─init.scope
           │ └─1 /sbin/init
           └─system.slice
             ├─alsa-state.service
lines 1-23...skipping...
â—Ź volumio
    State: degraded
     Jobs: 0 queued
   Failed: 1 units
    Since: Thu 1970-01-01 01:00:09 CET; 54 years 0 months ago
   CGroup: /
           ├─user.slice
           │ └─user-1000.slice
           │   ├─user@1000.service
           │   │ └─init.scope
           │   │   ├─1829 /lib/systemd/systemd --user
           │   │   └─1830 (sd-pam)
           │   └─session-7.scope
           │     ├─1825 sshd: volumio [priv]
           │     ├─1848 sshd: volumio@pts/0
           │     ├─1849 -bash
           │     ├─1865 sudo systemctl status
           │     ├─1866 systemctl status
           │     └─1867 less
           ├─init.scope
           │ └─1 /sbin/init
           └─system.slice
             ├─alsa-state.service
             │ └─551 /usr/sbin/alsactl -E HOME=/run/alsa -s -n 19 -c rdaemon
             ├─ifplugd.service
             │ └─701 /usr/sbin/ifplugd -i eth0 -q -f -u0 -d10 -w -I
             ├─mpd.service
             │ └─1378 /usr/bin/mpd --systemd
             ├─nmbd.service
             │ ├─654 /usr/sbin/nmbd --foreground --no-process-group
             │ └─716 /usr/sbin/nmbd --foreground --no-process-group
             ├─volumio.service
             │ ├─ 971 /usr/bin/node /volumio/index.js
             │ ├─1021 /usr/bin/node /volumio/app/plugins/miscellanea/albumart/serverStartup.js 3001 /data/albumart
             │ ├─1028 /usr/bin/node /volumio/app/plugins/miscellanea/albumart/serverStartup.js 3001 /data/albumart
             │ ├─1029 /usr/bin/node /volumio/app/plugins/miscellanea/albumart/serverStartup.js 3001 /data/albumart
             │ ├─1030 /usr/bin/node /volumio/app/plugins/miscellanea/albumart/serverStartup.js 3001 /data/albumart
             │ └─1285 /usr/bin/node /myvolumio/plugins/music_service/streaming_services/streamingProxy.js
             ├─dbus.service
             │ └─560 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
             ├─winbind.service
             │ ├─890 /usr/sbin/winbindd --foreground --no-process-group
             │ ├─917 winbindd: domain child [VOLUMIO]
lines 1-43
1 Like

Welcome to Volumio for Raspberry Pi (6.1.70-v7l+ armv7l)
Last login: Wed Jan 31 01:33:55 2024 from 192.168.0.115
volumio@volumio:~$ setdatetime.service
-bash: setdatetime.service: command not found
volumio@volumio:~$ setdatetime.service

This is one command not two!

sudo systemctl status setdatetime.service

Welcome to Volumio for Raspberry Pi (6.1.70-v7l+ armv7l)
Last login: Wed Jan 31 01:35:04 2024 from 192.168.0.115
volumio@volumio:~$ sudo systemctl status setdatetime.service
Unit setdatetime.service could not be found.
volumio@volumio:~$

Please follow my instructions as the service was not created.
Every block needs to be copied and ran as one statement.

block 1:

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

block 2:

chmod 755 /home/volumio/setdatetime.sh

block 3:

sudo cat <<EOF >>/lib/systemd/system/setdatetime.service
[Unit]
Description=Date Time service
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/bin/bash /home/volumio/setdatetime.sh

[Install]
WantedBy=multi-user.target
EOF

block 4:

sudo chmod 644 /lib/systemd/system/setdatetime.service && sudo systemctl daemon-reload && sudo systemctl enable setdatetime.service && sudo systemctl start setdatetime.service
1 Like