1
January
2026
23:56

How to set up time synchronization in antiX Runit: Creating the ntpd service in Runit

1 January 2026 23:56

The antiX distribution with the Runit service init system doesn't synchronize time over the internet out of the box. This article provides a solution for configuring and starting the ntpd service in runit for time synchronization.

Introduction

The runit system is non-standard for Linux. It is lighter than systemd.

Unlike SystemD, Runit doesn't have the ntpd service or the timedatectl command (see the article on time synchronization in systemd). On the other hand, managing services in runit is simpler—not with complex Units, but with "run" configuration files and the "sv" supervisor command.

Solution

1) Install the ntp utility, which will become the ntpd service at the end of this article.

sudo apt update
sudo sudo apt install ntp

2) Create a folder for the service settings. AntiX uses the /etc/sv folder.

cd /etc/sv
sudo mkdir ntpd

3) Create a run command file.

cd /etc/sv/ntpd
sudo nano run

Add the following text to the file for starting the "run" service:

#!/bin/sh

/etc/sv/ntpd/run

exec /usr/sbin/ntpd -d -p /run/ntpd.pid -c /etc/ntp.conf

where -c /etc/ntp.conf is the name of the configuration file.

3) Grant execute permissions (+x):

sudo chmod +x run

4) Create a symbolic link in services:

sudo ln -s /etc/sv/ntpd /etc/service/

5) Create a folder for the ntpsec component logs:

cd /var/log
sudo mkdir runit
cd runit
sudo mkdir ntpsec

6) Edit the /etc/ntp.conf file (empty by default).

sudo nano /etc/ntp.conf

My NTP client configuration file is as follows:

# General Configuration
pool 0.europe.pool.ntp.org iburst
pool 1.europe.pool.ntp.org iburst
pool 2.europe.pool.ntp.org iburst

Local Clock (Fallback)

server 127.127.1.0
fudge 127.127.1.0 stratum 10

File Locations

driftfile /var/lib/ntp/ntp.drift

Log file for monitoring [8].

logfile /var/log/ntp.log

--- Access Control ---

Deny all access by default, but allow localhost (127.0.0.1, ::1) [5, 8].

restrict default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict ::1

And saved it. Ctrl+S, Ctrl+X.

7) Created a symbolic link to start the service. Link to the /etc/sv/ntpd directory within the /etc/service/ directory:

sudo ln -s /etc/sv/ntpd /etc/service/
ls -ld /etc/service/ntpd

8) Select your time zone

sudo dpkg-reconfigure tzdata

The above command created a symbolic link. Checking with the command:

ls -l /etc/localtime

Result: "/etc/localtime -> /usr/share/zoneinfo/Europe/Moscow"

8) Starting the ntpd service using the sv supervisor command

sudo sv start ntpd

9) Checking the status and what to do if the service fails to start

sudo sv status ntpd
ps aux | grep ntpd
sudo kill -9 PID

where PID is the process number for /usr/sbin/ntpd -d -p /run/ntpd.pid -c /etc/ntp.conf

10) Restarting the ntpd service using the sv supervisor

sudo sv start ntpd

The command output should be similar to this:

ok: run: ntpd: (pid 32041) 53s

Result

The antiX clock now displays local time (in this case, Moscow time) rather than UTC.