[xenial] systemctl hangs when stopping isc-dhcp-server

Bug #1551855 reported by Jamie Strandboge on 2016-03-01
This bug report is a duplicate of:  Bug #1551351: dhclient does not renew leases. Edit Remove
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
isc-dhcp (Ubuntu)
Undecided
Unassigned

Bug Description

This affects both 4.3.3-5ubuntu8 that exists in xenial right now and 4.3.3-5ubuntu9 which I just uploaded to fix another bug.

With the move to systemd service file, 'sudo systemctl stop isc-dhcp-server.service' just hangs. Here is the service file (from 4.3.3-5ubuntu9):

[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
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; \
    exec dhcpd -user dhcpd -group dhcpd -f -4 -pf /run/dhcp-server/dhcpd.pid -cf $CONFIG_FILE $INTERFACES'

[Install]
WantedBy=multi-user.target

Eg:
$ sudo systemctl stop isc-dhcp-server.service
<hangs>

wait long enough and systemd will KILL it. In the logs:
Mar 1 10:58:14 sec-xenial-amd64 systemd[1]: isc-dhcp-server.service: State 'stop-sigterm' timed out. Killing.
Mar 1 10:58:14 sec-xenial-amd64 systemd[1]: isc-dhcp-server.service: Main process exited, code=killed, status=9/KILL
Mar 1 10:58:14 sec-xenial-amd64 systemd[1]: isc-dhcp-server.service: Unit entered failed state.
Mar 1 10:58:14 sec-xenial-amd64 systemd[1]: isc-dhcp-server.service: Failed with result 'signal'.

Things I tried to resolve it, none of which worked:
 * add Type=forking
 * add Type=forking and remove '-f' from the dhcpd exec
 * adjust /run/dhcp-server to be root:root and 755
 * adjust /run/dhcp-server to be dhcpd:dhcpd and 755 (this was in 4.3.3-5ubuntu8 but fails to create a pid file and was fixed in 4.3.3-5ubuntu9)
 * adjust /run/dhcp-server to be root:dhcpd and 775
 * add Type=forking and remove '-f' from the dhcpd exec and use KillSignal=SIGINT (see https://wiki.archlinux.org/index.php/Dhcpd#Service_file)

This bug is not related to AppArmor. With 4.3.3-5ubuntu9 this bug persists and there are no apparmor denials. Furthermore, if I disable the apparmor profile, the bug persists.

Graham Clinch (g-clinch) wrote :

Bug #1549330 ("dhcpd 4.3.3-5ubuntu7 aborts after getting stuck on futex (bind 9.10 library interaction?)"), which has been marked a duplicate of bug #1551351 is reporting the same symptoms - dhcpd doesn't respond to SIGTERM and appears to be stuck on a futex. I think this is related to the switch from bind 9.9 export library to bind 9.10.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in isc-dhcp (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers