KEA on Ubuntu 24.04.2 LTS <- challenging?

I find it very challenging to use the kea dhcp.

I have installed a new Ubuntu 24.04.2 LTS server on some new hardware.
The old server is also Ubuntu 24.04.2 LTS, same as the new server.
The reason to install a new server is also because I notice some problems due migrating.
Before I always migrated my server to new version which also brings some changes.

One of the items was isc-dhcp-server and the move to kea as I read:
While Ubuntu still supports isc-dhcp-server, it is no longer supported by its vendor, ISC.org. ISC.org recommends using Kea, their newer DHCP server, for new implementations.

This is what has been installed:
kea 2.4.1-3build3.1
kea-admin 2.4.1-3build3.1
kea-common 2.4.1-3build3.1
kea-ctrl-agent 2.4.1-3build3.1
kea-dhcp-ddns-server 2.4.1-3build3.1
kea-dhcp4-server 2.4.1-3build3.1
kea-dhcp6-server 2.4.1-3build3.1
python3-kea-connector 2.4.1-3build3.1

One issue I got is these massages in the log and after reboot a failed to open socket:
2025-06-19 06:09:25.817 WARN DHCP4_MULTI_THREADING_INFO enabled: yes, number of threads: 3, queue size: 12
2025-06-20 05:15:05.187 WARN DHCPSRV_MT_DISABLED_QUEUE_CONTROL disabling dhcp queue control when multi-threading is enabled.
2025-06-20 05:15:05.187 WARN DHCP4_RESERVATIONS_LOOKUP_FIRST_ENABLED Multi-threading is enabled and host reservations lookup is always performed first.
2025-06-20 05:15:05.205 WARN DHCPSRV_OPEN_SOCKET_FAIL failed to open socket: the interface enp2s0 is not running
2025-06-20 05:15:05.205 WARN DHCPSRV_NO_SOCKETS_OPEN no interface configured to listen to DHCP traffic
2025-06-20 05:15:05.206 WARN DHCP4_MULTI_THREADING_INFO enabled: yes, number of threads: 3, queue size: 12

I checked the systemd sevice like /lib/systemd/system/kea-dhcp4-server.service

It mentions:
Wants=network-online.target
After=network-online.target

network-online.target mentions:
After=network.target

network.target mentions:
After=network-pre.target

network-pre.target mentions:
RefuseManualStart=yes

So why do I have this message about enp2s0 is not running?
I did start but I got these messages in the logging.

What to do with these warnings is also not clear to me.

I also got this error when I started with kea:
2025-06-19 05:14:34.593 INFO DHCPSRV_MEMFILE_LFC_START starting Lease File Cleanup
2025-06-19 05:14:34.593 ERROR Unable to lock logger lockfile
2025-06-19 05:14:34.593 INFO DHCPSRV_MEMFILE_LFC_EXECUTE executing Lease File Cleanup using: /usr/sbin/kea-lfc -4 -x /var/lib/kea/kea-leases4.csv.2 -i /var/lib/kea/kea-leases4.csv.1 -o /var/lib/kea/kea-leases4.csv.output -f /var/lib/kea/kea-leases4.csv.completed -p /var/lib/kea/kea-leases4.c
sv.pid -c ignored-path
2025-06-19 05:51:24.857 ERROR Unable to lock logger lockfile

The symptom I had was that after reboot it worked, but when a lease needed to be renewed, it didn’t and client got disconnected without any IP.

And it always happens around the LFC (Lease File Cleanup).
I did two thing and didn’t see the message anymore, but not sure what the cause is.
I disabled the LFC (as I use it at home in a very small environment - lfc-interval=0) in the kea-dhcp4.conf, like:

"lease-database": {
    "type": "memfile",
    "lfc-interval": 0,
    "persist": true,
    "name": "/var/lib/kea/kea-leases4.csv"
},

The next part is more tricky and I guess was the real problem.
There was also a /run/kea/logger_lockfile and not sure why.
The /etc/apparmor.d/usr.sbin.kea-dhcp4 mentions only these:

owner /run/kea/kea-dhcp4.kea-dhcp4.pid rw,
owner /run/lock/kea/logger_lockfile rwk,

I added the /run/lea/logger_lockfile to it and after reboot it was gone.
It’s also no longer created, but wonder if this is because I disabled the LFC?

I also had a hard time to get the default config working as it seems you have to remove all the comments, it just want a plain JSON config without any comments (not in the general way).

Anyone else with these problems?

I was also surprised about the complains and people moving back to isc-dhcp, and I can understand why.

Thanks in advance,
Matthijs

[EDIT] removed some typos (sorry)

I just wonder if I am the only person, as I experience a lot of difficulty.
I’m at a point to switch back to the old and good isc-dhcp-server as KEA gives me headaches.

Some devices just do not get a new IP-lease and I guess because of this:
INFO DHCPSRV_CFGMGR_ADD_IFACE listening on interface enp2s0

WARN DHCPSRV_OPEN_SOCKET_FAIL failed to open socket: the interface enp2s0 is not running
WARN DHCPSRV_NO_SOCKETS_OPEN no interface configured to listen to DHCP traffic

It says it’s just a warning but I guess it’s way more and just beaks kea. Not sure what to do.
The network is configured static and as you can read above, the kea-dhcp4-server.service should wait for network to be up … but does it?

Cheers,
Matthijs

I have also seen this problem with ERROR Unable to lock logger lockfile. The KEA docs state the location should be configurable using KEA_LOCKFILE_DIR. The config in /lib/systemd/system/kea-dhcp4-server.service has Environment="KEA_LOCKFILE_DIR=/run/lock/kea", so it shouldn’t be placed anywhere else. I do have the file in this location. My copy of /etc/apparmor.d/usr.sbin.kea-dhcp4 has other files mentioned, but not /run/lea/logger_lockfile.

I made the suggested change to use "lfc-interval": 0. Hopefully this will avoid this error in future. I’ve also confirmed that if an interface is not up when KEA starts, then it will skip it. It does not wait for it. You need to restart KEA once it is up.
This is all using KEA version 2.6.1 on 25.04.