Linux: systemd's start request repeated too quickly for xxx.service

Repeating "systemctl restart xxx" over 6 times in 10 seconds will cause error. This article will describe the workaround.

1 start request repeated too quickly for xxx.service

This error is for preventing many repetition of service restart in system error.

If the service restart exceeds the value of StartLimitBurst within the time specified by the value of StartLimitInterval, the service startup will fail. StartLimitInterval is 10 seconds by default and StartLimitBurst is 5 by default.

For example, dhcpd is as below. The service startup will fail with the 6th "systemctl restart dhcpd".

$ i=1
$ while : ; do
  echo ${i}
  i=$(expr ${i} + 1);
  sudo systemctl restart dhcpd || break
done
1
2
3
4
5
6
Job for dhcpd.service failed because start of the service was
attempted too often. See "systemctl status dhcpd.service" and
"journalctl -xe" for details.
To force a start use "systemctl reset-failed dhcpd.service" followed
by "systemctl start dhcpd.service" again.

"start request repeated too quickly for dhcpd.service" is in journal.

$ sudo journalctl -xeu dhcpd
<snip>
systemd[1]: start request repeated too quickly for dhcpd.service
<snip>

2 Use systemctl reload

Use "systemctl reload" if the service can reload.

$ systemctl show -p CanReload named
CanReload=yes

Running "systemctl reload" more than 6 times within 10 seconds will not fail.

$ sudo systemctl start named
$ i=1
$ while : ; do
  echo ${i}
  i=$(expr ${i} + 1);
  sudo systemctl restart named || break
done
1
2
3
4
5
6
7
8
<snip>

3 Use StartLimitBurst=0 if the service cannot reload

There is a service which cannot reload. The dhcpd community seems not to have the resource for implementation and maintenance of reload.

$ systemctl show -p CanReload dhcpd
CanReload=no

For a service which cannot reload, disable checker of service start with making StartLimitBurst be 0.

Check systemd's file with the following command.

$ systemctl show -p FragmentPath dhcpd
FragmentPath=/usr/lib/systemd/system/dhcpd.service

Write StartLimitBurst=0 in [Service] section.

$ diff -uprN /usr/lib/systemd/system/dhcpd.service{.org,}
--- /usr/lib/systemd/system/dhcpd.service.org   2017-02-17 10:57:45.657561554 -0500
+++ /usr/lib/systemd/system/dhcpd.service       2017-02-17 12:25:15.733977821 -0500
@@ -8,6 +8,7 @@ After=time-sync.target
 [Service]
 Type=notify
 ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid
+StartLimitBurst=0

 [Install]
 WantedBy=multi-user.target

Load changed systemd's file.

$ sudo systemctl daemon-reload

Running "systemctl restart" more than 6 times within 10 seconds will not fail.

$ i=1
$ while : ; do
  echo ${i}
  i=$(expr ${i} + 1);
  sudo systemctl restart dhcpd || break
done
1
2
3
4
5
6
7
8
<snip>