systemd-resolved.service hangs a long time on shutdown
Bug #1648068 reported by
Martin Pitt
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemd (Ubuntu) |
Fix Released
|
Medium
|
Martin Pitt |
Bug Description
On shutdown or "systemctl stop systemd-resolved" you get a long hang:
● systemd-
CGroup: /system.
So that resolvconf hook tries to do name resolution which does not work any more at that time.
tags: | added: resolved |
summary: |
- systemd-resolved hangs a long time on shutdown + systemd-resolved.service hangs a long time on shutdown |
Changed in systemd (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → Medium |
To post a comment you must log in.
Unfortunately resolvconf does not have a --no-scripts or similar option that would disable running the update.d/ hooks. One possible local workaround is to change /lib/systemd/ system/ systemd- resolved. service. d/resolvconf. conf from
ExecStopPost= +/bin/sh -c '[ ! -e /run/resolvconf /enable- updates ] || /sbin/resolvconf -d systemd-resolved'
to
ExecStopPost+ =/bin/rm -f /run/resolvconf /interface/ systemd- resolved
or to drop the line completely.
This solves the hang on shutdown, but it does not drop 127.0.0.53 any more from /etc/resolv.conf if you manually stop systemd- resolved. service in a running system.
This should actually happen the same way with dnsmasq or any other local DNS server -- if only that is in resolv.conf, then the Avahi hook script would run into this timeout on "host" as well, as the local name server is already gone. Our workaround for that in 16.04 was to never stop dnsmasq even when NetworkManager. service got stopped (via KillMode=process). However, when you do stop dnsmasq then you get similar hangs with trying to do DNS queries.
At the moment, if you stop the local DNS server then there is nothing that would magically bring back the non-local DNS servers into resolv.conf (neither in zesty with resolved nor in 16.04 with dnsmasq), so you would run into timeouts either way. Thus I think just dropping the ExecStopPost= does not actually make things worse, but it fixes the hang on shutdown.