kea-dhcp4-server 在树莓派重启后不工作

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

我已经在 raspberry pi3 b+ 上安装了 kea-dhcp4-server。 我在 /etc/kea/kea-dhcp4.conf 上配置了所有内容,但出现问题。 当我重新启动树莓派时,kea 不再响应 dhcp 请求,所以我 运行 sudo service kea-dhcp4-server status 向我展示了这个

● 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

我必须使用 sudo mkdir /var/run/kea/ 创建文件夹,然后使用 sudo service kea-dhcp4-service restart 重新启动服务以使其工作。但是如果我再次重启树莓派,问题又会出现。

我该如何解决?

我也在 Raspberry Pi 上使用 kea,我通过在每次 systemd 启动 kea 时创建 /var/run/kea 来解决它。

为此,请执行以下操作:

  1. 将kea systemd-unit文件复制到/etc/systemd/system

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

    复制这个单元文件确保它不会被 kea 包的下一次更新覆盖。

  2. 将以下内容添加到此文件的 [Service]-部分:(/etc/systemd/system/kea-dhcp4-server.service)

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

    此命令在 systemd 启动 kea 之前执行,它将创建丢失的目录。

  3. 执行systemctl daemon-reload。这将使 systemd 注意到新配置。

重启即可。