[systemd-devel] ExecStartPost in a systemd unit file does not start docker service

Alex Chistyakov alexclear at gmail.com
Sat Apr 8 15:27:58 UTC 2017


Hello,

I am trying to establish a connection between firewalld and docker
services. I extended the default firewalld.service unit file by adding
the following:

[Service]
ExecStartPost=-/bin/bash -c '/usr/bin/test -f /etc/default/docker &&
/bin/systemctl stop docker && /bin/systemctl start docker'

to /etc/systemd/system/firewalld.service.d/docker.conf.

But this did not work, firewalld service timed out on start:

root at ubuntu-xenial:~# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/lib/systemd/system/firewalld.service; enabled;
vendor preset: enabled)
  Drop-In: /etc/systemd/system/firewalld.service.d
           └─docker.conf
   Active: failed (Result: timeout) since Sat 2017-04-08 14:39:45 UTC;
1min 35s ago
  Process: 26050 ExecStartPost=/bin/bash -c /usr/bin/test -f
/etc/default/docker && /bin/systemctl stop docker && /bin/systemctl
start docker (code=killed, signal=TERM)
  Process: 26000 ExecStart=/usr/sbin/firewalld --nofork --nopid
(code=exited, status=0/SUCCESS)
 Main PID: 26000 (code=exited, status=0/SUCCESS)

Apr 08 14:38:10 ubuntu-xenial systemd[1]: Starting firewalld - dynamic
firewall daemon...
Apr 08 14:39:41 ubuntu-xenial systemd[1]: firewalld.service:
Start-post operation timed out. Stopping.
Apr 08 14:39:45 ubuntu-xenial systemd[1]: Failed to start firewalld -
dynamic firewall daemon.
Apr 08 14:39:45 ubuntu-xenial systemd[1]: firewalld.service: Unit
entered failed state.
Apr 08 14:39:45 ubuntu-xenial systemd[1]: firewalld.service: Failed
with result 'timeout'.

I am aware of BindTo and Requires but I would like to restart the
docker service on every state change of firewalld so these directives
do not solve my problem.

Thank you,

--
SY,
Alex


More information about the systemd-devel mailing list