• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

NTP updated nicht Systemzeit

StefanP.

Newbie
rotz Neustart des Dienstes und auch der Maschine wird meine Systemzeit nicht aktualisiert.

Unter ntp.conf im etc. Ordner habe ich drei erreichbare Server eingetragen

Code:
server 194.97.4.214
server 130.149.17.21
server 194.97.5.110

mittels ntpd -q sehe ich ja, dass die da angebunden sind.

Auch in den Iptables habe ich port 123 als input und output upd port freigegeben.

Mache ich irgend etwas falsch oder kann mir da jemand helfen?
 

stka

Guru
Da wird wahrscheinlich der systemd-timesyncd laufen und der bekommt seine Infos aus der /etc/systemd/timesyncd.conf. Aber wie Sauerland schon schreibt, ohne die Distribution kann man da nur raten.
 
OP
S

StefanP.

Newbie
Wie kann ich euch da helfen bzgl. der Distribution?
Da steht der Firmenname als Linux da es ein Arm Linux auf einem eingebetteten System ist welches über eine buildroot erzeugt wird
 

abgdf

Guru
Also, um die Uhrzeit aus dem Internet zu bekommen, verwende ich von Hand als root:
Code:
ntpdate 194.97.4.214 && hwclock --systohc
Weiß ja nicht, ob das bei Dir geht.
 

marce

Guru
... abgesehen davon - je nach Umfang der Änderung der Uhrzeit kann es sein, daß ntp sich weigert, die Zeit automatisch zu setzen (weil Differenz zu groß) und man da 1x manuell nachhelfen muss.

Gründe für das Verhalten sollten sich im Logfile finden.
 

susejunky

Moderator
Teammitglied
Hallo StefanP,


StefanP. schrieb:
rotz Neustart des Dienstes und auch der Maschine wird meine Systemzeit nicht aktualisiert.
die man-pages zu ntpd nennen da mehrere Möglichkeiten, die dieses Verhalten erklären könnten:
https://linux.die.net/man/8/ntpd schrieb:
The ntpd behavior at startup depends on whether the frequency file, usually ntp.drift, exists. This file contains the latest estimate of clock frequency error. When the ntpd is started and the file does not exist, the ntpd enters a special mode designed to quickly adapt to the particular system clock oscillator time and frequency error. This takes approximately 15 minutes, after which the time and frequency are set to nominal values and the ntpd enters normal mode, where the time and frequency are continuously tracked relative to the server. After one hour the frequency file is created and the current frequency offset written to it. When the ntpd is started and the file does exist, the ntpd frequency is initialized from the file and enters normal mode immediately. After that the current frequency offset is written to the file at hourly intervals.
https://linux.die.net/man/8/ntpd schrieb:
Most operating systems and hardware of today incorporate a time-of-year (TOY) chip to maintain the time during periods when the power is off. When the machine is booted, the chip is used to initialize the operating system time. After the machine has synchronized to a NTP server, the operating system corrects the chip from time to time. In case there is no TOY chip or for some reason its time is more than 1000s from the server time, ntpd assumes something must be terribly wrong and the only reliable action is for the operator to intervene and set the clock by hand. This causes ntpd to exit with a panic message to the system log. The -g option overrides this check and the clock will be set to the server time regardless of the chip time. However, and to protect against broken hardware, such as when the CMOS battery fails or the clock counter becomes defective, once the clock has been set, an error greater than 1000s will cause ntpd to exit anyway.

Enthält der System-Log Hinweise?

Viele Grüße

susejunky
 
OP
S

StefanP.

Newbie
abgdf schrieb:
Also, um die Uhrzeit aus dem Internet zu bekommen, verwende ich von Hand als root:
Code:
ntpdate 194.97.4.214 && hwclock --systohc
Weiß ja nicht, ob das bei Dir geht.

Das macht bei mir die Meldung

the NTP socket is in use,existing
 
OP
S

StefanP.

Newbie
marce schrieb:
... abgesehen davon - je nach Umfang der Änderung der Uhrzeit kann es sein, daß ntp sich weigert, die Zeit automatisch zu setzen (weil Differenz zu groß) und man da 1x manuell nachhelfen muss.

Gründe für das Verhalten sollten sich im Logfile finden.
wo finde ich das Logfile?
 
OP
S

StefanP.

Newbie
susejunky schrieb:
Hallo StefanP,


StefanP. schrieb:
rotz Neustart des Dienstes und auch der Maschine wird meine Systemzeit nicht aktualisiert.
die man-pages zu ntpd nennen da mehrere Möglichkeiten, die dieses Verhalten erklären könnten:
https://linux.die.net/man/8/ntpd schrieb:
The ntpd behavior at startup depends on whether the frequency file, usually ntp.drift, exists. This file contains the latest estimate of clock frequency error. When the ntpd is started and the file does not exist, the ntpd enters a special mode designed to quickly adapt to the particular system clock oscillator time and frequency error. This takes approximately 15 minutes, after which the time and frequency are set to nominal values and the ntpd enters normal mode, where the time and frequency are continuously tracked relative to the server. After one hour the frequency file is created and the current frequency offset written to it. When the ntpd is started and the file does exist, the ntpd frequency is initialized from the file and enters normal mode immediately. After that the current frequency offset is written to the file at hourly intervals.
https://linux.die.net/man/8/ntpd schrieb:
Most operating systems and hardware of today incorporate a time-of-year (TOY) chip to maintain the time during periods when the power is off. When the machine is booted, the chip is used to initialize the operating system time. After the machine has synchronized to a NTP server, the operating system corrects the chip from time to time. In case there is no TOY chip or for some reason its time is more than 1000s from the server time, ntpd assumes something must be terribly wrong and the only reliable action is for the operator to intervene and set the clock by hand. This causes ntpd to exit with a panic message to the system log. The -g option overrides this check and the clock will be set to the server time regardless of the chip time. However, and to protect against broken hardware, such as when the CMOS battery fails or the clock counter becomes defective, once the clock has been set, an error greater than 1000s will cause ntpd to exit anyway.

Enthält der System-Log Hinweise?

Viele Grüße

susejunky
Ich finde das drift-File nicht. Könnte es daran liegen?
Wie erzeuge ich dieses?
 

susejunky

Moderator
Teammitglied
Hallo StefanP,


StefanP. schrieb:
... Ich finde das drift-File nicht. Könnte es daran liegen?
Wie erzeuge ich dieses?
ich nutze ntpd nicht und kann Dich daher nur auf die man-pages verweisen:
https://linux.die.net/man/8/ntpd schrieb:
The ntpd behavior at startup depends on whether the frequency file, usually ntp.drift, exists. This file contains the latest estimate of clock frequency error. When the ntpd is started and the file does not exist, the ntpd enters a special mode designed to quickly adapt to the particular system clock oscillator time and frequency error. This takes approximately 15 minutes, after which the time and frequency are set to nominal values and the ntpd enters normal mode, where the time and frequency are continuously tracked relative to the server. After one hour the frequency file is created and the current frequency offset written to it. When the ntpd is started and the file does exist, the ntpd frequency is initialized from the file and enters normal mode immediately. After that the current frequency offset is written to the file at hourly intervals.

Ohne Details zu Deiner Hardware zu kennen, könnte natürlich auch folgendes eine Rolle spielen...

https://linux.die.net/man/8/ntpd schrieb:
Most operating systems and hardware of today incorporate a time-of-year (TOY) chip to maintain the time during periods when the power is off. When the machine is booted, the chip is used to initialize the operating system time. After the machine has synchronized to a NTP server, the operating system corrects the chip from time to time. In case there is no TOY chip or for some reason its time is more than 1000s from the server time, ntpd assumes something must be terribly wrong and the only reliable action is for the operator to intervene and set the clock by hand. This causes ntpd to exit with a panic message to the system log. The -g option overrides this check and the clock will be set to the server time regardless of the chip time. However, and to protect against broken hardware, such as when the CMOS battery fails or the clock counter becomes defective, once the clock has been set, an error greater than 1000s will cause ntpd to exit anyway.

Möglicherweise führt auch das manuelle setzen der Systemzeit dazu, dass (nach einer gewissen Zeit?) die drift-Datei erstellt wird.

Viele Grüße

susejunky
 
OP
S

StefanP.

Newbie
ich hab mal

Code:
# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 194.97.4.214    .INIT.          16 u    -  256    0    0.000    0.000   0.000
 130.149.17.21   .INIT.          16 u    -  256    0    0.000    0.000   0.000
 194.97.5.110    .INIT.          16 u    -  256    0    0.000    0.000   0.000
ausprobiert.

a steht refId immer noch auf init

Wenn ich

Code:
 ps -ef |grep ntpd
eingebe kommt:

Code:
  765 root     {ntpd-watch} /bin/sh /usr/sbin/ntpd-watch
  794 ntp-dmn  /usr/sbin/ntpd -g -u ntp-dmn:ntp-dmn -i /var/ntpd
  825 root     grep ntpd

Wenn ich folgendes mache:

Code:
# watch -n1 ntpq -c cv -c rv

kommt
Code:
Every 1s: ntpq -c cv -c rv                                  2022-03-10 09:26:04

***Association ID 0 unknown to server

associd=0 status=c016 leap_alarm, sync_unspec, 1 event, restart,
version="ntpd 4.2.8p13@1.3847-o Thu Jun 25 12:54:48 UTC 2020 (1)",
processor="armv5tejl", system="Linux/4.20.17", leap=11, stratum=16,
precision=-17, rootdelay=0.000, rootdisp=9.180, refid=INIT,
reftime=(no time),
clock=e5d4349c.38546ace  Thu, Mar 10 2022  9:26:04.220, peer=0, tc=3,
mintc=3, offset=0.000000, frequency=0.000, sys_jitter=0.000000,
clk_jitter=0.008, clk_wander=0.000
Every 1s: ntpq -c cv -c rv
 

gehrke

Administrator
Teammitglied
@StefanP.: Bitte zukünftig <code>-Tags verwenden - https://linux-club.de/forum/viewtopic.php?f=92&t=105750
TNX
 
Oben