Hi, 
  
some clarifications: 
the -p command line parameter in lfc executable is referring to the pid file 
used for lease file operations, while the KEA_LOCKFILE_DIR is used for the 
lockfile used for logging. 
  
I have tested your scenario and it seems to be working. I guess the problem on 
your side is that the exported environment variable is not inherited by the 
root environment when doing sudo -u ... 
  
the easiest way to pass the environment variable is to add it just before the 
executable: 
  
sudo -u ... KEA_LOCKFILE_DIR=/var/lib/kea-VRF039/ /usr/sbin/kea-lfc -4 ... 
  
to achieve this using services, please consult the man for options regarding 
environment variables in the service file. 
  
I hope this helps. 
  
Razvan 
  
  
  
  
 
 
 
 

-----Original Message-----

From: Darren <[email protected]>
To: Kea <[email protected]>
Date: Monday, 10 June 2024 10:01 PM EEST
Subject: Re: [Kea-users] kea-lfc not using KEA_LOCKFILE_DIR

Hi Martijn,

Looking in the ARM, I only find KEA_LOCKFILE_DIR mentioned here:
https://kea.readthedocs.io/en/kea-2.4.1/arm/logging.html#logging-during-kea-startup
which pertains only to controlling destination of logging while Kea is
starting up (before it has read the configuration file completely).
These environment variables don't seem to have anything to do with
`kea-lfc`. Can you point to where you saw that `kea-lfc` should
respect these environment variables?

Thank you,
Darren Ankney

On Tue, Jun 4, 2024 at 10:43 AM Martijn via Kea-users
<[email protected]> wrote:
>
> Hi,
>
> We are currently implementing Kea for a multi tenant/VRF scenario. We do this 
> by running multiple instances of kea-dhcp4 with a systemd unit template. 
> Because we have multiple Kea instances running, we need separate folders for 
> storing PIDs, lock files and configs. So far, this is working fine. The Kea 
> service is running, establishing HA session and serving requests.
>
> We just have a problem with the periodic lease file cleaning performed by 
> kea-lfc, while the lease file cleanup seems to be successful. It is logging 
> errors relating to using a lock file for the logger.
>
> Jun 04 15:49:27 dhcp-01 kea-dhcp4-VRF039[1395]: INFO 
> DHCPSRV_MEMFILE_LFC_START starting Lease File Cleanup
> Jun 04 15:49:27 dhcp-01 kea-dhcp4-VRF039[1395]: INFO 
> DHCPSRV_MEMFILE_LFC_EXECUTE executing Lease File Cleanup using: 
> /usr/sbin/kea-lfc -4 -x /var/lib/kea-VRF039/dhcp4.leases.2 -i 
> /var/lib/kea-VRF039/dhcp4.leases.1 -o /var/lib/kea-VRF039/dhcp4.leases.output 
> -f /var/lib/kea-VRF039/dhcp4.leases.completed -p 
> /var/lib/kea-VRF039/dhcp4.leases.pid -c ignored-path
> Jun 04 15:49:28 dhcp-01 kea-dhcp4-VRF039[2571]: Unable to use interprocess 
> sync lockfile (No such file or directory): /var/run/kea/logger_lockfile
> Jun 04 15:49:28 dhcp-01 kea-dhcp4-VRF039[2571]: Unable to use interprocess 
> sync lockfile (No such file or directory): /var/run/kea/logger_lockfile
> ---- 6 more identical messages ----
>
> I have tried manually running the process with the specified arguments from 
> the log message and setting the KEA_LOCKFILE_DIR environment variable. 
> However, kea-lfc still doesn’t seem to use the environment variable.
>
> $ export KEA_LOCKFILE_DIR=/run/lock/kea-VRF039
> $ echo $KEA_LOCKFILE_DIR
> /run/lock/kea-VRF039
>
> $ sudo -u _kea -g _kea \
> /usr/sbin/kea-lfc -4 \
> -x /var/lib/kea-VRF039/dhcp4.leases.2 \
> -i /var/lib/kea-VRF039/dhcp4.leases.1 \
> -o /var/lib/kea-VRF039/dhcp4.leases.output \
> -f /var/lib/kea-VRF039/dhcp4.leases.completed \
> -p /var/lib/kea-VRF039/dhcp4.leases.pid \
> -c ignored-path
>
> Unable to use interprocess sync lockfile (No such file or directory): 
> /var/run/kea/logger_lockfile
> Unable to use interprocess sync lockfile (No such file or directory): 
> /var/run/kea/logger_lockfile
> Unable to use interprocess sync lockfile (No such file or directory): 
> /var/run/kea/logger_lockfile
> Unable to use interprocess sync lockfile (No such file or directory): 
> /var/run/kea/logger_lockfile
> Unable to use interprocess sync lockfile (No such file or directory): 
> /var/run/kea/logger_lockfile
> Unable to use interprocess sync lockfile (No such file or directory): 
> /var/run/kea/logger_lockfile
> Unable to use interprocess sync lockfile (No such file or directory): 
> /var/run/kea/logger_lockfile
>
>
> I have read through the code and it seems like the environment variable 
> should be used. So I am not sure what’s going wrong. I have found an issue on 
> the nixpkgs GitHub which seems to describe the same issue (kea-lfc not using 
> KEA_LOCKFILE_DIR) https://github.com/NixOS/nixpkgs/issues/265826
>
> Is this a known issue or am I doing something wrong?
>
> Some additional info:
> Distro: Ubuntu 24.04 LTS
> Using the package from ubuntu APT sources:
> Package: kea-dhcp4-server
> Version: 2.4.1-3build3
>
>
> Regards,
>
> Martijn
> --
> ISC funds the development of this software with paid support subscriptions. 
> Contact us at https://www.isc.org/contact/ for more information.
>
> To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.
>
> Kea-users mailing list
> [email protected]
> https://lists.isc.org/mailman/listinfo/kea-users
-- 
ISC funds the development of this software with paid support subscriptions. 
Contact us at https://www.isc.org/contact/ for more information.

To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.

Kea-users mailing list
[email protected]
https://lists.isc.org/mailman/listinfo/kea-users   
-- 
ISC funds the development of this software with paid support subscriptions. 
Contact us at https://www.isc.org/contact/ for more information.

To unsubscribe visit https://lists.isc.org/mailman/listinfo/kea-users.

Kea-users mailing list
[email protected]
https://lists.isc.org/mailman/listinfo/kea-users

Reply via email to