Esse post eu vou falar de um problema que encontrei no symedatectl , no qual a data e hora do sistema operacional não estava sendo sincronizada com o servidor de ntp especificado no arquivo de configuração do serviço systemd-timesyncd. No meu caso eu estava em um servidor ubuntu server 20.4.03 .
Ao ativar o ntp do timedatectl.
timedatectl set-timezone America/Maceio
timedatectl set-ntp true
sudo systemctl status ntp ● ntp.service Loaded: masked (Reason: Unit ntp.service is masked.) Active: inactive (dead) root@srv01:/home/unimed# timedatectl status Local time: Tue 2022-02-15 14:47:29 -03 Universal time: Tue 2022-02-15 17:47:29 UTC RTC time: Tue 2022-02-15 17:47:29 Time zone: America/Maceio (-03, -0300) System clock synchronized: yes NTP service: active RTC in local TZ: no
Mesmo mostrando que está ativo a data não estava sincronizando.
Ao analisar o log eu identifiquei a seguinte mensagem :
Server has too large root distance. Disconnecting.
Feb 15 15:54:44 srv01.it-howto.org systemd[1]: Started Network Time Synchronization. Feb 15 15:54:44 srv01.it-howto.org systemd-timesyncd[3961]: Server has too large root distance. Disconnecting. Feb 15 15:55:16 srv01.it-howto.org systemd-timesyncd[3961]: Server has too large root distance. Disconnecting. Feb 15 15:56:21 srv01.it-howto.org systemd-timesyncd[3961]: Server has too large root distance. Disconnecting. Feb 15 15:58:29 srv01.it-howto.org systemd-timesyncd[3961]: Server has too large root distance. Disconnecting.
Em algumas pesquisas pelo google identifiquei que o parâmetro RootDistanceMaxSec=5 era o motivo do problema.
Ao alterar esse parâmetro de 5 para 20 o problema foi solucionado.
vi /etc/systemd/timesyncd.conf
[Time] NTP=192.168.150.1 FallbackNTP=ntp.ubuntu.com RootDistanceMaxSec=5 PollIntervalMinSec=32 PollIntervalMaxSec=2048
Para 20.
[Time] NTP=192.168.150.1 FallbackNTP=ntp.ubuntu.com RootDistanceMaxSec=20 PollIntervalMinSec=32 PollIntervalMaxSec=2048
E reiniciar o serviço.
systemctl restart systemd-timesyncd.service
Ao analisar o log identifiquei que ele passou a sincronizar corretamente.
journalctl --unit=systemd-timesyncd.service
Feb 15 16:01:58 srv01.it-howto.org systemd[1]: systemd-timesyncd.service: Succeeded. Feb 15 16:01:58 srv01.it-howto.org systemd[1]: Stopped Network Time Synchronization. Feb 15 16:01:58 srv01.it-howto.org systemd[1]: Starting Network Time Synchronization... Feb 15 16:01:58 srv01.it-howto.org systemd[1]: Started Network Time Synchronization. Feb 15 14:26:30 srv01.it-howto.org systemd-timesyncd[4644]: Initial synchronization to time server 192.168.150.1:123 (192.168.150.1).
Agora o horário está correto.
ubuntu@srv01:~$ date Tue 15 Feb 2022 03:01:12 PM -03
Deixe seu comentário.