Search code examples
raspberry-piraspberry-pi3

kea-dhcp4-server doesn't work after a restart of the raspberry


I have installed kea-dhcp4-server on my raspberry pi3 b+. I configured everything on the /etc/kea/kea-dhcp4.conf but there is a problem. When I restart the raspberry kea no longer responds to dhcp request so I run sudo service kea-dhcp4-server status that show me this

● kea-dhcp4-server.service - ISC KEA IPv4 DHCP daemon
   Loaded: loaded (/lib/systemd/system/kea-dhcp4-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2020-03-04 12:08:52 CET; 5min ago
     Docs: man:kea-dhcp4(8)
 Main PID: 415 (kea-dhcp4)
    Tasks: 1 (limit: 2200)
   Memory: 10.2M
   CGroup: /system.slice/kea-dhcp4-server.service
           └─415 /usr/sbin/kea-dhcp4 -c /etc/kea/kea-dhcp4.conf

Mar 04 12:08:53 rasp1 kea-dhcp4[415]: Unable to use interprocess sync lockfile (No such file or directory): /var/run/kea/isc_kea_logger_lockfile
Mar 04 12:08:53 rasp1 kea-dhcp4[415]: Unable to use interprocess sync lockfile (No such file or directory): /var/run/kea/isc_kea_logger_lockfile
Mar 04 12:08:53 rasp1 kea-dhcp4[415]: Unable to use interprocess sync lockfile (No such file or directory): /var/run/kea/isc_kea_logger_lockfile
Mar 04 12:08:53 rasp1 kea-dhcp4[415]: Unable to use interprocess sync lockfile (No such file or directory): /var/run/kea/isc_kea_logger_lockfile
Mar 04 12:08:53 rasp1 kea-dhcp4[415]: Unable to use interprocess sync lockfile (No such file or directory): /var/run/kea/isc_kea_logger_lockfile
Mar 04 12:08:53 rasp1 kea-dhcp4[415]: Unable to use interprocess sync lockfile (No such file or directory): /var/run/kea/isc_kea_logger_lockfile
Mar 04 12:08:53 rasp1 kea-dhcp4[415]: Unable to use interprocess sync lockfile (No such file or directory): /var/run/kea/isc_kea_logger_lockfile
Mar 04 12:08:53 rasp1 kea-dhcp4[415]: Unable to use interprocess sync lockfile (No such file or directory): /var/run/kea/isc_kea_logger_lockfile
Mar 04 12:08:53 rasp1 kea-dhcp4[415]: Unable to use interprocess sync lockfile (No such file or directory): /var/run/kea/isc_kea_logger_lockfile
Mar 04 12:08:53 rasp1 kea-dhcp4[415]: Unable to use interprocess sync lockfile (No such file or directory): /var/run/kea/isc_kea_logger_lockfile

I have to create the folder with sudo mkdir /var/run/kea/ and then restart the service with sudo service kea-dhcp4-service restart to make it works. But if I restart the raspberry again the problem reoccurs.

How can I fix it?


Solution

  • I'm also using kea on a Raspberry Pi and I solved it by creating /var/run/kea every time systemd starts kea.

    To do so, do the following:

    1. Copy the kea systemd-unit file to /etc/systemd/system

      cp /lib/systemd/system/kea-dhcp4-server.service /etc/systemd/system

      Copying over this unit file makes sure that it won't be overwritten by the next update of the kea package.

    2. Add the following to the [Service]-Section of this file: (/etc/systemd/system/kea-dhcp4-server.service)

      ExecStartPre=/bin/mkdir -p /var/run/kea
      

      This command gets executed before systemd starts kea and it will create the missing directory.

    3. Execute systemctl daemon-reload. This will make systemd notice the new configuration.

    Reboot and you should be good to go.