You are not logged in.

#1 2020-06-06 18:12:50

light9876
Member
Registered: 2020-01-05
Posts: 142

[SOLVED] Help setting automatic system time

I have been setting my time using this command:

timedatectl set-time 19:30:00

I want to make it automatic. I read these two pages:

https://wiki.archlinux.org/index.php/System_time
https://wiki.archlinux.org/index.php/Ne … col_daemon

And what I did is:

sudo ln -s /usr/share/zoneinfo/GMT /etc/localtime
sudo pacman -S ntp
sudo ntpd -u ntp:ntp
sudo systemctl enable ntpdate.service
ntpq -p
sudo timedatectl set-ntp true

The current output of:

$timedatectl status
               Local time: Sat 2020-06-06 19:21:01 GMT
           Universal time: Sat 2020-06-06 19:21:01 UTC
                 RTC time: Sat 2020-06-06 19:21:02    
                Time zone: GMT (GMT, +0000)           
System clock synchronized: no                         
              NTP service: active                     
          RTC in local TZ: no

The time remains unchanged even after a reboot. What am I doing wrong?

Last edited by light9876 (2020-06-07 09:28:34)

Offline

#2 2020-06-06 18:25:49

loqs
Member
Registered: 2014-03-06
Posts: 18,859

Re: [SOLVED] Help setting automatic system time

sudo ntpd -u ntp:ntp

manually start ntpd

sudo systemctl enable ntpdate.service

enable the service but do not start it

ntpq -p

print the status of peers.  What was the output?

sudo timedatectl set-ntp true

start and enable systemd-timesyncd?

What is the output of

ntpq -p
systemctl status ntpdate.service
systemctl status systemd-timesyncd.service
ps aux | grep ntpd

Offline

#3 2020-06-06 18:29:55

light9876
Member
Registered: 2020-01-05
Posts: 142

Re: [SOLVED] Help setting automatic system time

$ntpq -p

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 lithium.rubbler .XFAC.          16 u    - 1024    0    0.000   +0.000   0.000
 x.ns.gin.ntt.ne .XFAC.          16 u    - 1024    0    0.000   +0.000   0.000
 ntp.uk.eria.one .XFAC.          16 u    - 1024    0    0.000   +0.000   0.000
 fifi.m.faelix.n .XFAC.          16 u    - 1024    0    0.000   +0.000   0.000
$systemctl status ntpdate.service

● ntpdate.service - One-Shot Network Time Service
     Loaded: loaded (/usr/lib/systemd/system/ntpdate.service; enabled; vendor preset: disabled)
     Active: activating (start) since Sat 2020-06-06 19:02:12 GMT; 35min ago
   Main PID: 447 (ntpd)
      Tasks: 2 (limit: 19041)
     Memory: 5.8M
     CGroup: /system.slice/ntpdate.service
             └─447 /usr/bin/ntpd -q -n -g -u ntp:ntp

Jun 06 19:02:12 elias ntpd[447]:  6 Jun 19:02:12 ntpd[447]: Listen normally on 2 lo 127.0.0.1:123
Jun 06 19:02:12 elias ntpd[447]:  6 Jun 19:02:12 ntpd[447]: Listen normally on 3 lo [::1]:123
Jun 06 19:02:12 elias ntpd[447]:  6 Jun 19:02:12 ntpd[447]: Listening on routing socket on fd #20 for interface updates
Jun 06 19:02:12 elias ntpd[447]: Listening on routing socket on fd #20 for interface updates
Jun 06 19:02:19 elias ntpd[447]: Listen normally on 4 enp3s0 100.65.247.3:123
Jun 06 19:02:19 elias ntpd[447]:  6 Jun 19:02:19 ntpd[447]: Listen normally on 4 enp3s0 100.65.247.3:123
Jun 06 19:02:19 elias ntpd[447]:  6 Jun 19:02:19 ntpd[447]: Listen normally on 5 enp3s0 [fe80::e3f6:10b9:1a94:e2db%2]:123
Jun 06 19:02:19 elias ntpd[447]:  6 Jun 19:02:19 ntpd[447]: new interface(s) found: waking up resolver
Jun 06 19:02:19 elias ntpd[447]: Listen normally on 5 enp3s0 [fe80::e3f6:10b9:1a94:e2db%2]:123
Jun 06 19:02:19 elias ntpd[447]: new interface(s) found: waking up resolver
$systemctl status systemd-timesyncd.service

● systemd-timesyncd.service - Network Time Synchronization
     Loaded: loaded (/usr/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2020-06-06 19:20:58 GMT; 17min ago
       Docs: man:systemd-timesyncd.service(8)
   Main PID: 1337 (systemd-timesyn)
     Status: "Idle."
      Tasks: 2 (limit: 19041)
     Memory: 2.1M
     CGroup: /system.slice/systemd-timesyncd.service
             └─1337 /usr/lib/systemd/systemd-timesyncd

Jun 06 19:20:58 elias systemd[1]: Starting Network Time Synchronization...
Jun 06 19:20:58 elias systemd[1]: Started Network Time Synchronization.
$ps aux | grep ntpd

ntp          447  0.0  0.0  74952  5544 ?        Ssl  19:12   0:00 /usr/bin/ntpd -q -n -g -u ntp:ntp
elias       2057  0.0  0.0   6296  2144 pts/0    S+   19:38   0:00 grep --colour=auto ntpd

Last edited by light9876 (2020-06-06 18:30:27)

Offline

#4 2020-06-06 18:39:01

loqs
Member
Registered: 2014-03-06
Posts: 18,859

Re: [SOLVED] Help setting automatic system time

ntpd has not determined the accuracy of the peers,  so it has no reference time to adjust to,  when the peers stratum drops to 2 or 3 then ntpd will start adjusting the time.
You have two competing services ntpd and systemd-timesyncd.service managing the clock is that intended?

Offline

#5 2020-06-06 18:50:07

light9876
Member
Registered: 2020-01-05
Posts: 142

Re: [SOLVED] Help setting automatic system time

Oh I thought both services were required. If so, then I only need one.

Say I want to use only systemd-timesyncd, what shall I do now?

And thank you for your time.

Offline

#6 2020-06-06 19:04:16

loqs
Member
Registered: 2014-03-06
Posts: 18,859

Re: [SOLVED] Help setting automatic system time

If you only want to use systemd-timesyncd disable and stop ntpdate.service you can also remove the ntp package.

Offline

#7 2020-06-06 19:36:34

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,889

Re: [SOLVED] Help setting automatic system time

Keep in mind that it's unclear whether systemd-timesyncd is reliable if you don't use systemd-networkd as network management tool.

NTP on the other hand works if there's any active network connection.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#8 2020-06-07 09:28:22

light9876
Member
Registered: 2020-01-05
Posts: 142

Re: [SOLVED] Help setting automatic system time

Thank you all!

Offline

Board footer

Powered by FluxBB