SOLVED Wrong system date

TheUnknown

Cadet
Joined
Nov 19, 2021
Messages
2
Hello everyone,
Today I tried TrueNAS for the first time and decided to install TrueNAS Scale.
But, some of the Docker applications behaved weird/didn't work so I debugged and found out that the system date was set to July.
The date inside the GUI is correct, only the system time is off.
I tried manually setting the time but that seemed to break things and was overwritten reboot.
I checked the Debian NTP servers which are shown in the GUI and they return correct times.

Any ideas?
 

TheUnknown

Cadet
Joined
Nov 19, 2021
Messages
2
Okay, I managed to resolve the issue.
In my case TrueNAS used my router (fritz.box) as an NTP server, which for whatever reason returned wrong dates.
The time shown in the router interface is right though, so I dunno what's up with that.
I disabled the NTP server function of the router and all seems good now.
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
For future posters, "ntpq -p" output is recommended.
 

Ashamed2228

Dabbler
Joined
Mar 17, 2023
Messages
21
I'm having issues with my system's date, running even as sudo "ntpq -p" outputs: "ntpq: read: Connection refused". My timezone is UTC-5, the time of the system is right now (UTC-5)-5 (is five hours behind what it should be)
 

jgreco

Resident Grinch
Joined
May 29, 2011
Messages
18,680
Make sure your time and date is correctly set to current UTC time in the BIOS, that your RTC battery isn't dead, and that you have reachable NTP servers configured.
 

Ashamed2228

Dabbler
Joined
Mar 17, 2023
Messages
21
Just checked BIOS and time is correct, NTP servers are the default ones. If I change my timezone to GMT I get the correct times, it seems it's applying twice the minus 5 hours
 

Ashamed2228

Dabbler
Joined
Mar 17, 2023
Messages
21
My output:

Local time: Sat 2023-03-18 07:49:29 GMT <--- I just changed this
Universal time: Sat 2023-03-18 07:49:29 UTC
RTC time: Sat 2023-03-18 07:49:29
Time zone: GMT (GMT, +0000)
System clock synchronized: no
NTP service: n/a
RTC in local TZ: no
 
Joined
Jun 2, 2019
Messages
591
1. Check output of "ntpq -pn"

2. Wait for reach=377

Code:
root@NAS-4[~]# ntpq -pn 
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*192.168.69.5    69.89.207.199    2 u   67   64  377    0.291   -0.142  10.207


3. Then check "timedatectl"

Code:
root@NAS-4[~]# timedatectl
Local time: Sat 2023-03-18 08:59:27 EDT
Universal time: Sat 2023-03-18 12:59:27 UTC
RTC time: Sat 2023-03-18 12:59:27
Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
NTP service: n/a
RTC in local TZ: no
 
Last edited:

Ashamed2228

Dabbler
Joined
Mar 17, 2023
Messages
21
1. Check output of "ntpq -pn"

Running "ntpq -pn" gives me "Connection refused", it seems it is trying to use the wrong net interface (I have 3, 1 disconnected, 1 connected directly to another computer so no Internet, 1 connected to router so Internet over there).

Running "systemctl status ntp" outputs this:

Code:
● ntp.service - Network Time Service
     Loaded: loaded (/lib/systemd/system/ntp.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sat 2023-03-18 07:45:03 GMT; 52min ago
       Docs: man:ntpd(8)
    Process: 9986 ExecStart=/usr/lib/ntp/ntp-systemd-wrapper (code=exited, status=0/SUCCESS)
   Main PID: 9991 (code=exited, status=255/EXCEPTION)
        CPU: 54ms

Mar 18 07:44:56 truenas ntpd[9991]: Listen normally on 4 enp7s0 192.168.1.1:123
Mar 18 07:44:56 truenas ntpd[9991]: Listen normally on 5 lo [::1]:123
Mar 18 07:44:56 truenas ntpd[9991]: Listen normally on 6 enp6s0 [fe80::2ad:24ff:fe90:ba87%2]:123
Mar 18 07:44:56 truenas ntpd[9991]: Listen normally on 7 enp7s0 [fe80::e61d:5dff:fe43:f6d3%4]:123
Mar 18 07:44:56 truenas ntpd[9991]: Listening on routing socket on fd #24 for interface updates
Mar 18 07:44:56 truenas ntpd[9991]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized
Mar 18 07:44:56 truenas ntpd[9991]: kernel reports TIME_ERROR: 0x41: Clock Unsynchronized
Mar 18 07:44:56 truenas systemd[1]: Started Network Time Service.
Mar 18 07:45:03 truenas systemd[1]: ntp.service: Main process exited, code=exited, status=255/EXCEPTION
Mar 18 07:45:03 truenas systemd[1]: ntp.service: Failed with result 'exit-code'.


The enp7s0 interface is the one directly connected to another machine. enp6s0 is the one with Internet access.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
@Ashamed2228, since your TrueNAS is a VM, make sure Proxmox is also sending GMT time, not local time to the VM, as well as confirming your host's BIOS time is set to GMT. From what you describe, it's likely your BIOS is localtime, and Proxmox is sending localtime to the VM, which would result in the double offset you're seeing.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Yes, for all Unix-based OSs, the BIOS time must be GMT.
 

Ashamed2228

Dabbler
Joined
Mar 17, 2023
Messages
21
Ah, thank you, that was it, it was set to my local timezone (GMT-5), I changed it and now the date is right. Thank you all!
 
Top