Directory /run is on tempfs, so it is empty at start.
I suppose PID file /run/dhcp-server/dhcpd.pid can't be created because directory /run/dhcp-server is missing at startup and I haven't found where it will be created.
I've fixed systemd unit "/lib/systemd/system/isc-dhcp-server.service" by creating the needed "/run/dhcp-server" folder before starting dhcpd:
-----------------
[Unit]
Description=ISC DHCP IPv4 server
Documentation=man:dhcpd(8)
Wants=network-online.target
After=network-online.target
After=time-sync.target
ConditionPathExists=/etc/default/isc-dhcp-server
ConditionPathExists=|/etc/ltsp/dhcpd.conf
ConditionPathExists=|/etc/dhcp/dhcpd.conf
[Service]
EnvironmentFile=/etc/default/isc-dhcp-server
RuntimeDirectory=dhcp-server
# The leases files need to be root:dhcpd even when dropping privileges
ExecStartPre=/bin/mkdir -p /run/dhcp-server
ExecStart=/bin/sh -ec '\
CONFIG_FILE=/etc/dhcp/dhcpd.conf; \
if [ -f /etc/ltsp/dhcpd.conf ]; then CONFIG_FILE=/etc/ltsp/dhcpd.conf; fi; \
[ -e /var/lib/dhcp/dhcpd.leases ] || touch /var/lib/dhcp/dhcpd.leases; \
chown root:dhcpd /var/lib/dhcp /var/lib/dhcp/dhcpd.leases; \
chmod 775 /var/lib/dhcp ; chmod 664 /var/lib/dhcp/dhcpd.leases; \
if [ ! -d /run/dhcp-server ]; then mkdir -p /run/dhcp-server ; chown dhcpd /run/dhcp-server ; chmod 775 /run/dhcp-server; fi; \
exec dhcpd -user dhcpd -group dhcpd -f -4 -pf /run/dhcp-server/dhcpd.pid -cf $CONFIG_FILE $INTERFACES'
Ubuntu 18.04 here, no apparmor.
Directory /run is on tempfs, so it is empty at start. server/ dhcpd.pid can't be created because directory /run/dhcp-server is missing at startup and I haven't found where it will be created.
I suppose PID file /run/dhcp-
I've fixed systemd unit "/lib/systemd/ system/ isc-dhcp- server. service" by creating the needed "/run/dhcp-server" folder before starting dhcpd: man:dhcpd( 8) online. target online. target sync.target ists=/etc/ default/ isc-dhcp- server ists=|/ etc/ltsp/ dhcpd.conf ists=|/ etc/dhcp/ dhcpd.conf
-----------------
[Unit]
Description=ISC DHCP IPv4 server
Documentation=
Wants=network-
After=network-
After=time-
ConditionPathEx
ConditionPathEx
ConditionPathEx
[Service] =/etc/default/ isc-dhcp- server y=dhcp- server /bin/mkdir -p /run/dhcp-server FILE=/etc/ dhcp/dhcpd. conf; \ dhcpd.conf ]; then CONFIG_ FILE=/etc/ ltsp/dhcpd. conf; fi; \ dhcp/dhcpd. leases ] || touch /var/lib/ dhcp/dhcpd. leases; \ dhcp/dhcpd. leases; \ dhcp/dhcpd. leases; \ server/ dhcpd.pid -cf $CONFIG_FILE $INTERFACES'
EnvironmentFile
RuntimeDirector
# The leases files need to be root:dhcpd even when dropping privileges
ExecStartPre=
ExecStart=/bin/sh -ec '\
CONFIG_
if [ -f /etc/ltsp/
[ -e /var/lib/
chown root:dhcpd /var/lib/dhcp /var/lib/
chmod 775 /var/lib/dhcp ; chmod 664 /var/lib/
if [ ! -d /run/dhcp-server ]; then mkdir -p /run/dhcp-server ; chown dhcpd /run/dhcp-server ; chmod 775 /run/dhcp-server; fi; \
exec dhcpd -user dhcpd -group dhcpd -f -4 -pf /run/dhcp-
[Install] multi-user. target
WantedBy=
-----------------
Still need to fix hardcoded PID filename instead of /etc/default/ isc-dhcp- server value...