Discussion:
[systemd-devel] pid file /var/run/dhcpd.pid currenty exists
XYZDragon
2016-06-01 12:07:35 UTC
Permalink
Hello,

When trying to restart isc-dhcp-server, I was wondering why it didn't
start. After executing the suggested `journalctl -xe` I could see that
something was wrong:

May 27 13:32:15 my-pc isc-dhcp-server[26032]: Starting ISC DHCPv4
server: dhcpddhcpd service already running (pid file /var/run/dhcpd.pid
currenty exists) ... failed!

The message was helpful. I checked the file and noticed that it seemed
contain a process id. After checking with `ps -p` it seemed that that
process wasn't running anymore. In my opinion isc-dhcp-server should do
this check itself without user interaction, deleting the file if it
exists, but contains a process id of a dead process. After deleting the
file everything worked.

Also note the word doubling 'dhcpdhcpd' and the missing 'l' in
'currenty' in the debug message. Those could be fixed.
Reindl Harald
2016-06-01 12:17:54 UTC
Permalink
Post by XYZDragon
When trying to restart isc-dhcp-server, I was wondering why it didn't
start. After executing the suggested `journalctl -xe` I could see that
May 27 13:32:15 my-pc isc-dhcp-server[26032]: Starting ISC DHCPv4
server: dhcpddhcpd service already running (pid file /var/run/dhcpd.pid
currenty exists) ... failed!
The message was helpful. I checked the file and noticed that it seemed
contain a process id. After checking with `ps -p` it seemed that that
process wasn't running anymore. In my opinion isc-dhcp-server should do
this check itself without user interaction, deleting the file if it
exists, but contains a process id of a dead process. After deleting the
file everything worked.
Also note the word doubling 'dhcpdhcpd' and the missing 'l' in
'currenty' in the debug message. Those could be fixed
not a systemd problem, a proper systemd-unit would even advise dhcpd to
not create any pid-file at all
_______________________________

[***@srv-rhsoft:~]$ cat /etc/systemd/system/dhcpd.service
[Unit]
Description=DHCPD LAN
After=network-wlan-bridge.service

[Service]
Type=simple
ExecStart=/usr/sbin/dhcpd -4 -f -cf /etc/dhcp/dhcpd.conf -user dhcpd
-group dhcpd --no-pid
Restart=always
RestartSec=1
PrivateTmp=yes
PrivateDevices=yes
CapabilityBoundingSet=CAP_CHOWN CAP_DAC_OVERRIDE CAP_IPC_LOCK CAP_KILL
CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SETGID CAP_SETUID
CAP_SYS_CHROOT
ReadOnlyDirectories=/etc
ReadOnlyDirectories=/usr
ReadOnlyDirectories=/var/lib
ReadWriteDirectories=/var/lib/dhcpd
InaccessibleDirectories=/root
InaccessibleDirectories=/media
InaccessibleDirectories=/boot
InaccessibleDirectories=/home

[Install]
WantedBy=multi-user.targe
Mantas Mikulėnas
2016-06-01 12:31:12 UTC
Permalink
Post by XYZDragon
Hello,
When trying to restart isc-dhcp-server, I was wondering why it didn't
start. After executing the suggested `journalctl -xe` I could see that
dhcpddhcpd service already running (pid file /var/run/dhcpd.pid currenty
exists) ... failed!
The message was helpful. I checked the file and noticed that it seemed
contain a process id. After checking with `ps -p` it seemed that that
process wasn't running anymore. In my opinion isc-dhcp-server should do
this check itself without user interaction, deleting the file if it exists,
but contains a process id of a dead process. After deleting the file
everything worked.
Also note the word doubling 'dhcpdhcpd' and the missing 'l' in 'currenty'
in the debug message. Those could be fixed.
Then inform people whose software is printing that message – it's not
systemd's output. You're currently starting dhcpd via Debian's
auto-generated "compatibility" .service, which merely starts
/etc/init.d/isc-dhcp-server and lets it do whatever it used to do back in
the dark ages; this apparently includes printing messages with typos and
exiting when it finds a stale pidfile.
--
Mantas Mikulėnas <***@gmail.com>
Loading...