kea: Add systemd units and fix keactrl config paths (#1667) - #1668
Open
dcasota wants to merge 1 commit into
Open
kea: Add systemd units and fix keactrl config paths (#1667)#1668dcasota wants to merge 1 commit into
dcasota wants to merge 1 commit into
Conversation
Contributor
Author
|
@bo-gan-broadcom could you please review the PR suggested? The latest kea releases have the issue as well. I've opened an issue ticket at https://gitlab.isc.org/isc-projects/kea/-/work_items/4790 . |
dcasota
force-pushed
the
fix/kea-keactrl-paths-and-units-5.0
branch
from
August 31, 2026 19:41
c4f835e to
1821b5a
Compare
kea 3.1.9 obsoletes dhcp-server but is not usable in its place: it ships no
systemd unit, and keactrl looks for its configuration under /usr/etc.
$ keactrl status
ERROR/keactrl: keactrl configuration file doesn't exist in
/usr//etc/kea/keactrl.conf.
src/bin/keactrl/meson.build string-concatenates a literal '${prefix}/' in
front of the sysconfdir and localstatedir options, which assumes the
autotools convention that they are prefix-relative. Meson does not follow
it: BUILTIN_DIR_NOPREFIX_OPTIONS maps sysconfdir to an absolute /etc and
localstatedir to an absolute /var whenever prefix is /usr, whether or not
the values are passed on the command line. This is therefore not fixable by
changing the %meson flags.
Eight substitutions across two installed files are affected, not just the
one in the bug report: the keactrl.conf location, KEA_LOGGER_DESTINATION,
the PID directory, localstatedir, and all four kea_*_config_file entries
inside the installed keactrl.conf. Pointing keactrl at the real file with
-c does not help, because keactrl.conf carries the same corrupted paths.
Patch keactrl's meson.build to use the option directly when it is already
absolute, and keep the '${prefix}/' indirection when it is prefix-relative.
That indirection is what makes a self-contained install relocatable, so it
must survive for the prefixes where meson leaves the options relative: with
prefix=/usr/local and prefix=/opt/kea both generated files stay
byte-identical to an unpatched build.
Add units for the three daemons the package installs. They use Type=simple
rather than Type=notify: upstream Kea has no systemd integration at all, and
the shipped binaries carry no libsystemd dependency and no sd_notify symbol,
so a Type=notify unit would hang until TimeoutStartSec and be killed.
Also ship a disable-by-default preset. Photon's presets are an allow-list
with no catch-all rule, and systemd enables a unit that matches no rule, so
without this %systemd_post would enable three DHCP servers on every install.
kea.spec is gated on %{photon_subrelease} >= 91, so this covers subreleases
91 and 92. Subrelease 90 is unaffected: it still builds ISC dhcp-server from
SPECS/90/dhcp, which has its own unit.
Change-Id: Ieb172db51a45884c7fec40123ba0dfd3b98fe05a
Signed-off-by: Daniel Casota <dcasota@gmail.com>
dcasota
force-pushed
the
fix/kea-keactrl-paths-and-units-5.0
branch
from
September 1, 2026 10:08
1821b5a to
9b6f8af
Compare
Contributor
Author
|
I have read the DCO Document and I hereby sign the DCO for this and all future contributions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1667:
keaships no systemd unit, andkeactrllooks for itsconfiguration under
/usr/etcinstead of/etc.The report is accurate, and the second defect is wider than reported
Verified against the exact published binary,
kea-3.1.9-3.ph5.x86_64.rpmfromphoton_updates_5.0_x86_64.No systemd unit. The package ships 334 files and none of them is a unit:
Wrong config path, reproduced verbatim from the shipped script:
Two clarifications on top of the report:
The doubled slash is a fingerprint, not the fault. Linux collapses interior
//, so/usr//etcresolves to/usr/etc. The defect is that an alreadyabsolute
sysconfdirgets${prefix}/prepended; squashing the slash wouldchange nothing.
It is eight substitutions across two installed files, not one, because
localstatediris corrupted the same way:/usr/sbin/keactrl${prefix}//var/run/kea/var/run/kea/usr/sbin/keactrl${prefix}//var/log/kea.log/var/log/kea.log/usr/sbin/keactrl${prefix}//var/var/usr/sbin/keactrl${prefix}//etc/kea/keactrl.conf/etc/kea/keactrl.conf/etc/kea/keactrl.conf${prefix}//etc/kea/kea-*.conf/etc/kea/kea-*.confSo the obvious workaround does not work either — pointing
keactrlat thereal file with
-cgets one step further and then fails on the serverconfigs, because the installed
keactrl.confcarries the same corruption:It also means the package cannot reach its own directories: the spec creates
/var/log/kea(0750 kea:kea) and the tmpfiles unit creates/run/kea, whilethe script writes to
/usr/var/logand/usr/var/run.Root cause
src/bin/keactrl/meson.buildstring-concatenates a literal${prefix}/infront of the directory options:
That assumes the autotools convention, where those options are
prefix-relative. Meson does not follow it.
BUILTIN_DIR_NOPREFIX_OPTIONSinmesonbuild/options.pymapssysconfdirto an absolute/etcandlocalstatedirto an absolute/varwhenever the prefix is/usr:This is worth being precise about, because it rules out the fix you would
reach for first: the trigger is not the
--sysconfdir=/etcthat the%mesonmacro passes. Meson substitutes/etcfor anyprefix=/usrbuildwhether or not the flag is given, so no change to the spec's
-Dflags canfix this. Measured with meson 1.12.0 on the real templates:
--prefix=/usr --sysconfdir=/etc --localstatedir=/var${prefix}//etc/kea/keactrl.conf/etc/kea/keactrl.conf--prefix=/usr(no dir flags)${prefix}//etc/kea/keactrl.conf/etc/kea/keactrl.conf--prefix=/usr/local${prefix}/etc/kea/keactrl.conf${prefix}/etc/kea/keactrl.conf--prefix=/opt/kea${prefix}/etc/kea/keactrl.conf${prefix}/etc/kea/keactrl.confFor every prefix other than
/usr, both generated files are byte-identical toan unpatched build — verified with
cmponkeactrlandkeactrl.conf.sbindiris unaffected, which is why${prefix}/sbin/kea-dhcp4is correct inthe same file: meson relativizes
sbindirunder the prefix, so theconcatenation happens to be right for that one.
What this changes
0001-keactrl-Use-absolute-sysconfdir-and-localstatedir.patchuses theoption directly when it is already absolute, and keeps the
${prefix}/indirection when it is prefix-relative:
The indirection is what makes a self-contained install relocatable —
prefixis a live shell variable in the generated scripts — so it has to survive for
the prefixes where meson leaves the options relative. Only the
/usrcase,where meson forces an absolute value, changes.
This is an upstream bug and the patch is upstreamable as-is.
Three systemd units —
kea-dhcp4,kea-dhcp6,kea-dhcp-ddns, matchingthe three daemons the package actually installs. Kea 3.x has no control-agent
binary, so there is no
kea-ctrl-agent.service.The units follow the Fedora/CentOS layout, with one deliberate and necessary
divergence:
Type=simple, notType=notify. Distributions that useType=notifycarry an out-of-tree sd-daemon patch and build with-Dsystemd=enabled; upstream Kea has no such option and no systemdintegration at all. Verified against the shipped Photon binary — no
libsystemdinNEEDED, nosd_notifysymbol, noNOTIFY_SOCKETstring. AType=notifyunit here would hang untilTimeoutStartSecand then be killed.ConfigurationDirectory=is also omitted, because/etc/keais RPM-ownedroot:root 0755and systemd would chown it tokea:kea 0750. TheRuntimeDirectory/StateDirectory/LogsDirectorysettings are kept: theymatch the ownership and modes the spec and tmpfiles already establish
(
0750 kea:kea), so they are consistent rather than conflicting.A disable-by-default preset,
50-kea.preset. This one is not cosmetic.Photon's preset files are an allow-list with no catch-all rule, and systemd
enables a unit that matches no rule. Measured on Photon 5.0:
So shipping the units without a preset would mean
%systemd_postsilentlyenables three DHCP servers on every install and upgrade of
kea. Anunrequested DHCP server answering on a production network is a genuine
hazard, not just noise.
containerd,docker,lvm2,cyrus-saslandpostgresql18all shipdisablepresets for exactly this reason; thisfollows
containerd.spec's idiom (Source2: disable-<name>-by-default.presetinstalled to
%{_presetdir}/50-%{name}.preset). Operators enable the serversexplicitly, as they did with
dhcp.servicebefore.The spec changes follow the house idiom used by
nginx.spec— units asSource,%systemd_post/%systemd_preun/%systemd_postun_with_restart,BuildRequires: systemd-rpm-macros,Requires(pre): systemd-rpm-macros. Theexisting
%postalready ransystemd-tmpfiles --create, so%systemd_postis appended to it rather than added as a second
%post.Constellations
The bug is a property of the build prefix, not of the image or hypervisor, so
it reproduces identically on minimal and full ISOs, on generic and VMware
hypervisors, and with or without STIG hardening. What does vary is the
subrelease:
SPECS/90/dhcpstill builds ISCdhcp-serverwithdhcp.service;kea.specis skipped bybuild_ifSPECS/keaon the branchSPECS/kea; still shipSPECS/dhcpunconditionallykea.speclives only at top-levelSPECS/behind%global build_if %{photon_subrelease} >= 91, so a single change covers both91 and 92, and subrelease 90 is untouched by construction. The
vmware/5.0-9.1.1snapshot branch carries a byte-identicalSPECS/keaandwould need the same commit if it is still serviced.
The patch is prefix-agnostic: output for
prefix=/usr/localandprefix=/opt/keais byte-identical to an unpatched build, so it cannotregress a self-contained or relocated install.
Testing
Built as
kea-3.1.9-5.ph5in a cleanphoton:5.0container(
rpmbuild -bb --define "photon_subrelease 92"), then installed and exercisedin a second clean container. Source tarball SHA-512 matches the
archive_sha512suminconfig.yaml.Build is clean — no unpackaged files, all six subpackages produced.
The four corrupted paths in
/usr/sbin/keactrl:The four in the installed
/etc/kea/keactrl.conf:Grepping both installed artifacts for
${prefix}/or/usr//returns nothing.The reported symptom is gone — this is the command from the issue:
The shipped default configs parse under all three daemons
(
kea-dhcp4 -t,kea-dhcp6 -t,kea-dhcp-ddns -t— allresult: success(0)).The preset works, and a control run shows it is required:
Not covered here: a live DHCP lease exchange, which needs a real network
rather than a container, and the
%systemd_postun_with_restartupgrade pathfrom 3.1.9-3.
Upstream status — unfixed everywhere, including tip
Checked against ISC directly rather than assuming, because if upstream had
already fixed this, the right change would be a version bump instead of a
patch. It has not.
src/bin/keactrl/meson.buildis byte-identical to the 3.1.9 copy in everyone of these:
sysconfdirlinemaster@c69ece1cf15a(2026-08-31)'${prefix}/' + SYSCONFDIRKea-3.3.1'${prefix}/' + SYSCONFDIRKea-3.3.0'${prefix}/' + SYSCONFDIRKea-3.2.0'${prefix}/' + SYSCONFDIRSo upgrading Kea would not fix this — 3.2.0 and 3.3.x are affected the same
way. A search of the ISC issue tracker for
keactrl sysconfdir,keactrl prefixandusr//etcfinds no open issue covering it. The patch in this PRapplies cleanly to
masterunmodified (patch -p1 --dry-run, exit 0), so itcan be sent upstream as-is.
Unrelated to this bug, but noticed while checking: Kea 3.1.9 is a
development-series release. ISC's version
policy makes even-numbered minor versions
(3.0.x, 3.2.x) the stable production branches and odd-numbered ones (3.1.x)
development releases, maintained only until the next stable branch opens.
Photon 5.0 is shipping a development release in a production update repo, and
3.2.0 has since been released. Worth a look independently of this fix.
Out of scope, but worth a separate look
kea.speccarriesObsoletes: dhcp-serverwith no matchingProvides:, anddhcpcd.specdoes the same fordhcp-client. There is noProvides:foreither anywhere on the branch. That is what makes
tdnf updateperform theswap in the first place, and it leaves anything with
Requires: dhcp-serverunsatisfiable rather than satisfied by the replacement. The client side was
handled by rewriting the consumer instead (
cloud-init.specnow requiresdhcpcd); no equivalent was done fordhcp-server. I have not touched ithere, since it is a packaging-policy decision rather than part of this bug.