[systemd-devel] systemd default target

Kai Krakow hurikhan77 at gmail.com
Sat Feb 13 23:29:58 UTC 2016


Am Sat, 13 Feb 2016 14:34:59 -0800
schrieb Pathangi Janardhanan <path.jana at gmail.com>:

> Hi,
> 
>  I have some services configured with the above, Restart=on-failure
> and StartLimitInterval/StartLimitBurst and also StartLimitAction with
> reboot.
> 
>  The problem I am trying to look at is, how to get out of a continuous
> reboot cycle, if one of the services is failing. That is why I was
> looking for any options where systemd can have its default target
> changed to recover or something equivalent, if the system is
> undergoing repeated reboots within a certain interval?
> 
>  I may be able to do this by writing a separate unit/service for
> this, but was wondering if there was any already inbuilt mechanism to
> prevent continuous  reboot cycle from a mis-behaving service/unit,
> which is configured for reload on failure?

If you're using dracut-generated initrd you could simply add
"emergency" or "rescue" to the kernel cmdline. I think you can also
explicitly set a systemd.target=... variable at the cmdline, tho I'm not
sure about it.

> On Sat, Feb 13, 2016 at 2:48 AM, Lennart Poettering
> <lennart at poettering.net> wrote:
> 
> > On Fri, 12.02.16 20:58, Pathangi Janardhanan (path.jana at gmail.com)
> > wrote:
> >
> > > Hi All,
> > >
> > >  The default target is usually set to multi-user or someother
> > > equivalent target. Is there any way in systemd that I can say
> > > something like
> > >
> > > " If the system is reloaded n number of times within the last x
> > > second", than set the default target to recover or emergency mode
> > > etc.?
> > >
> > >  Basically I am looking for recovering from a failing
> > > unit/service that
> > is
> > > forcing the system to reboot, and that is going in a cycle?
> >
> > You may configure whether a unit shall be automatically restarted
> > with Restart=on-failure. You may put a limit on it with
> > StartLimitInterval= and StartLimitBurst=. You may configure what
> > shall happen if the limit is hit with StartLimitAction=, which
> > includes making the system reboot.
> >
> > See the systemd.service and systemd.unit man pages.
> >
> > Lennart
> >
> > --
> > Lennart Poettering, Red Hat
> >
> 


-- 
Regards,
Kai

Replies to list-only preferred.



More information about the systemd-devel mailing list