start request repeated too quickly
Asked Answered
B

8

21

I'm writing a bash-script but I often face this issue. When I try to start or stop a service I often get:

start request repeated too quickly 

How can I solve this problem? It's for example when I try to restart docker or openshift-origin master.

sudo service origin-master restart

● origin-master.service - Origin Master Service
   Loaded: loaded (/usr/lib/systemd/system/origin-master.service; enabled; vendor preset: disabled)
   Active: failed (Result: start-limit) since Wed 2016-02-17 08:22:11 UTC; 44s ago
     Docs: https://github.com/openshift/origin
  Process: 2296 ExecStart=/usr/bin/openshift start master --config=${CONFIG_FILE} $OPTIONS (code=exited, status=255)
 Main PID: 2296 (code=exited, status=255)

Feb 17 08:22:10 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: origin-master.service: main process exited, code=exited, status=255/n/a
Feb 17 08:22:10 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: Failed to start Origin Master Service.
Feb 17 08:22:10 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: Unit origin-master.service entered failed state.
Feb 17 08:22:10 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: origin-master.service failed.
Feb 17 08:22:11 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: origin-master.service holdoff time over, scheduling restart.
Feb 17 08:22:11 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: start request repeated too quickly for origin-master.service
Feb 17 08:22:11 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: Failed to start Origin Master Service.
Feb 17 08:22:11 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: Unit origin-master.service entered failed state.
Feb 17 08:22:11 ip-172-xx-xx-xx.eu-central-1.compute.internal systemd[1]: origin-master.service failed.

My script is just doing:

if [ $1 = "-u" ]
then
 sudo service origin-master restart
fi

A manual restart is possible before I've executed the script. But after it it remains giving the error

Baluchistan answered 17/2, 2016 at 9:26 Comment(1)
The problem is that origin-master is failing. Fix that, and rapid restarts won't occur.Diaphanous
D
27

This is a "feature" of systemctl. There is a parameter in the file that limits the restart frequency in seconds. Lower this while testing.

Edit the file /etc/systemd/system/multi-user.target.wants/<your service here>

my example:

Restart=on-failure
StartLimitBurst=2
# Restart, but not more than once every 10 minutes
#StartLimitInterval=600
# Restart, but not more than once every 30s (for testing purposes)
StartLimitInterval=30
Debidebilitate answered 19/8, 2018 at 17:39 Comment(5)
Isn't StartLimitIntervalSec? With a Sec at the end? Also then a systemctl daemon-reload.Dacy
Don't have a StartLimitInterval parameter in the file but have a restart=always. Doesn't that mean it should "always" restart when I request it to do so? Do I just add the StartLimitInterval parameter to the file?Hunley
On the issue of StartLimitInterval vs. StartLimitIntervalSec, see unix.stackexchange.com/a/464098/102206 — the latter was introduced with v230.Enesco
These changes don't fix the problem for me. I noticed that this happens when I tried to make a new server from an image. The new server was created from an image of the working server, but when I try to start the service the very first time, this error occurs. Changing the file as indicated above does not resolve the issue. I do a systemctl daemon-reload but same result.Greg
I had different ExecStart in this file than in /etc/systemd/system/<my service>, after setting ExecStart the same in both files, everything is working.Floruit
T
13

I suggest you familiarize yourself with systemd. That's what you're using under the hood when you run service. As @chepner says, the service is failing (as you can see from the second line of the log), and it's being restarted too quickly, triggering the error.

Try running journalctl -u origin-master.service to figure out why the error is happening.

Also, systemd cat origin-master.service will show you the Service Unit file that describes your service - there might be errors.

Trimurti answered 5/12, 2016 at 20:37 Comment(3)
I guess the latter should read "sudo cat /etc/systemd/system/origin-master.service"Halter
@Halter Nope, it should be systemctl catRepair
journalctl -u ... didn't give me enough information, but journalctl -xe did.Mellisa
K
2

I had this problem on Ubuntu 20.4. And by adding execute permission to the ExecStart file the problem was solved.

sudo chmod +x /path/to/execfile
Kufic answered 5/8, 2021 at 8:44 Comment(0)
U
2

I have faced same issue and solved this problem like that:

if /var/log/mysql folder not exists:

sudo mkdir /var/log/mysql

and then give permission this folder:

sudo chown -R mysql:mysql /var/log/mysql

sudo systemctl stop mysql

sudo systemctl start mysql
Uranus answered 13/9, 2021 at 6:10 Comment(0)
P
0

In my case , is my /etc/docker/daemon.json file format error, when i make this true, run systemctl start docker the server start success.

Plagioclase answered 27/11, 2022 at 14:11 Comment(1)
I had a /etc/docker/daemon.json file which was empty.Feverwort
F
0

I added a logfile in my python code and after I set the right permission to the log file it works:

sudo chmod 666 app.log
Furnace answered 7/6 at 21:3 Comment(0)
A
-1

in my case, there was a typing mistake in this file -> /etc/systemd/system/multi-user.target.wants/<your service here> so after tweaking necessary parameters, if you are still facing the same error, don't forget to check the file

Amaryl answered 31/7, 2022 at 9:23 Comment(0)
E
-1

Please try running the command : td-agent --dry-run This will give you the root cause.

Evanesce answered 22/10, 2022 at 0:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.