diff options
author | Luca Boccassi <bluca@debian.org> | 2024-07-26 20:07:23 +0200 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2024-08-27 13:24:45 +0200 |
commit | 7d8bbfbe0852ec89590d1dc5e28afc95d6d44fa1 (patch) | |
tree | 623499954eec628092582652c651080c1bbd30c2 /man/systemd.service.xml | |
parent | Merge pull request #34114 from yuwata/resolvconf-p (diff) | |
download | systemd-7d8bbfbe0852ec89590d1dc5e28afc95d6d44fa1.tar.xz systemd-7d8bbfbe0852ec89590d1dc5e28afc95d6d44fa1.zip |
service: add 'debug' option to RestartMode=
One of the major pait points of managing fleets of headless nodes is
that when something fails at startup, unless debug level was already
enabled (which usually isn't, as it's a firehose), one needs to manually
enable it and pray the issue can be reproduced, which often is really
hard and time consuming, just to get extra info. Usually the extra log
messages are enough to triage an issue.
This new option makes it so that when a service fails and is restarted
due to Restart=, log level for that unit is set to debug, so that all
setup code in pid1 and sd-executor logs at debug level, and also a new
DEBUG_INVOCATION=1 env var is passed to the service itself, so that it
knows it should start with a higher log level. Once the unit succeeds
or reaches the rate limit the original level is restored.
Diffstat (limited to 'man/systemd.service.xml')
-rw-r--r-- | man/systemd.service.xml | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/man/systemd.service.xml b/man/systemd.service.xml index d3ed79effb..047fb912e9 100644 --- a/man/systemd.service.xml +++ b/man/systemd.service.xml @@ -936,20 +936,40 @@ <listitem> <para>Takes a string value that specifies how a service should restart: <itemizedlist> - <listitem><para>If set to <option>normal</option> (the default), the service restarts by - going through a failed/inactive state.</para></listitem> - - <listitem><para>If set to <option>direct</option>, the service transitions to the activating - state directly during auto-restart, skipping failed/inactive state. - <varname>ExecStopPost=</varname> is invoked. - <varname>OnSuccess=</varname> and <varname>OnFailure=</varname> are skipped.</para></listitem> + <listitem> + <para>If set to <option>normal</option> (the default), the service restarts by going through + a failed/inactive state.</para> + + <xi:include href="version-info.xml" xpointer="v254"/> + </listitem> + + <listitem> + <para>If set to <option>direct</option>, the service transitions to the activating + state directly during auto-restart, skipping failed/inactive state. + <varname>ExecStopPost=</varname> is invoked. + <varname>OnSuccess=</varname> and <varname>OnFailure=</varname> are skipped.</para> + + <para>This option is useful in cases where a dependency can fail temporarily but we don't + want these temporary failures to make the dependent units fail. Dependent units are not + notified of these temporary failures.</para> + + <xi:include href="version-info.xml" xpointer="v254"/> + </listitem> + + <listitem> + <para>If set to <option>debug</option>, the service manager will log messages that are + related to this unit at debug level while automated restarts are attempted, until either the + service hits the rate limit or it succeeds, and the <varname>$DEBUG_INVOCATION=1</varname> + environment variable will be set for the unit. This is useful to be able to get additional + information when a service fails to start, without needing to proactively or permanently + enable debug level logging in systemd, which is very verbose. This is otherwise equivalent + to <option>normal</option> mode.</para> + + <xi:include href="version-info.xml" xpointer="v257"/> + </listitem> </itemizedlist> </para> - <para>This option is useful in cases where a dependency can fail temporarily - but we don't want these temporary failures to make the dependent units fail. - When this option is set to <option>direct</option>, dependent units are not notified of these temporary failures.</para> - <xi:include href="version-info.xml" xpointer="v254"/> </listitem> </varlistentry> |