Skip to content

feat(library): Add chronyd 4.8 - #288

Open
vTusharr wants to merge 2 commits into
unikraft:mainfrom
vTusharr:add_chrony
Open

feat(library): Add chronyd 4.8#288
vTusharr wants to merge 2 commits into
unikraft:mainfrom
vTusharr:add_chrony

Conversation

@vTusharr

@vTusharr vTusharr commented Aug 5, 2026

Copy link
Copy Markdown

Add the definition for the unikraft.org/chronyd:4.8 image, an NTP server running chrony in binary compatibility mode.

Build chrony from source with HAVE_RECVMMSG removed from config.h.
Unikraft has no recvmmsg syscall and the stock Alpine binary has no runtime
fallback, so it busy-loops on a socket it can never drain.

Bake the configuration into the image, since a unikernel has no shell to
generate one at startup.

Run chronyd with -x so it never adjusts the guest clock, whose set and adjust
syscalls are stub, and adds test.py to query the running instance.

@vTusharr vTusharr assigned vTusharr and unassigned vTusharr Aug 5, 2026
@vTusharr
vTusharr requested a review from razvanvirtan August 5, 2026 17:21
@vTusharr vTusharr self-assigned this Aug 5, 2026
@vTusharr
vTusharr requested a lite review from Copilot August 5, 2026 17:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Unikraft library image definition for unikraft.org/chronyd:4.8, packaging chronyd built from source (with HAVE_RECVMMSG removed) plus baked-in configuration and a small Python helper to query NTP sync status.

Changes:

  • Introduces a new chronyd/4.8 image build (Dockerfile rootfs + Kraftfile) and static chrony configuration.
  • Documents build/run instructions and operational notes for running chronyd in a unikernel.
  • Adds test.py to query the instance and fail until upstream synchronization is complete.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
library/chronyd/4.8/test.py Adds a Python NTP query helper for validating chronyd responsiveness/sync.
library/chronyd/4.8/README.md Documents how to build/run/query the chronyd unikernel and key notes.
library/chronyd/4.8/Kraftfile Defines the Unikraft build template, kconfig, and runtime command for chronyd.
library/chronyd/4.8/Dockerfile Builds chronyd from source and assembles a minimal scratch rootfs.
library/chronyd/4.8/conf/resolv.conf Provides a static resolver configuration for DNS in the unikernel.
library/chronyd/4.8/conf/chrony.conf Provides a baked-in chronyd configuration for upstream servers and client access.
library/chronyd/4.8/.dockerignore Ignores Unikraft build outputs/config artifacts during image build context.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,40 @@
# chrony built from source with HAVE_RECVMMSG removed
FROM alpine:3.24 AS build
Comment on lines +7 to +8
ADD https://chrony-project.org/releases/chrony-${CHRONY_VERSION}.tar.gz /chrony.tar.gz
RUN tar xzf /chrony.tar.gz && \

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

valid

Comment on lines +38 to +39
if stratum == 0:
sys.exit("answering but not synchronized yet, retry shortly")
Comment on lines +33 to +36
# musl loader (+ libc alias) and nettle, for SECHASH symmetric-key auth
COPY --from=build /lib/ld-musl-x86_64.so.1 /lib/ld-musl-x86_64.so.1
COPY --from=build /lib/ld-musl-x86_64.so.1 /lib/libc.musl-x86_64.so.1
COPY --from=build /usr/lib/libnettle.so.8 /usr/lib/libnettle.so.8

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah nope

Comment on lines +15 to +32
def RequestTimefromNtp(addr="127.0.0.1", port=1123):
client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
client.settimeout(5)
client.sendto(b"\x1b" + 47 * b"\0", (addr, port))
data, _ = client.recvfrom(48)
t = struct.unpack("!12I", data)[10] - REF_TIME_1970
stratum = data[1]
refid = ".".join(str(b) for b in data[12:16]) # selected upstream
return stratum, refid, time.ctime(t)


if __name__ == "__main__":
host = sys.argv[1] if len(sys.argv) > 1 else "127.0.0.1"
port = int(sys.argv[2]) if len(sys.argv) > 2 else 1123
try:
stratum, refid, served = RequestTimefromNtp(host, port)
except TimeoutError:
sys.exit(f"no reply from {host}:{port}")
@vTusharr vTusharr added the enhancement New feature or request label Aug 5, 2026
Add the definition for the `unikraft.org/chronyd:4.8` image, an NTP server
running chrony in binary compatibility mode.

Signed-off-by: Tushar Verma <tusharVermaiota@proton.me>
Add the build, push and runtime validation workflow for the
`unikraft.org/chronyd:4.8` image, and list the image in the top-level README
table.

Validate the running instance with test.py, which queries the unikernel over
NTP and exits non zero until chronyd has selected an upstream source.

Signed-off-by: Tushar Verma <tusharVermaiota@proton.me>
@vTusharr
vTusharr requested a balanced review from Copilot August 7, 2026 09:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants