pid1: add new mode systemd.show-status=error and use it when 'quiet' is passed

systemd.show-status=error is useful for the case where people care about errors
only.

If people want to have a quiet boot, they most likely don't want to see all
status output even if there is a delay in boot, so make "quiet" imply
systemd.show-status=error instead of systemd.show-status=auto.

Fixes #14976.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-02-29 17:49:50 +01:00
parent 5bcf34ebf3
commit 0d066dd1a4
6 changed files with 12 additions and 14 deletions

3
TODO
View File

@ -677,9 +677,6 @@ Features:
* merge ~/.local/share and ~/.local/lib into one similar /usr/lib and /usr/share....
* systemd.show_status= should probably have a mode where only failed
units are shown.
* add systemd.abort_on_kill or some other such flag to send SIGABRT instead of SIGKILL
(throughout the codebase, not only PID1)

View File

@ -798,15 +798,14 @@
<varlistentry>
<term><varname>systemd.show_status</varname></term>
<listitem><para>Takes a boolean argument or the constant
<constant>auto</constant>. Can be also specified without an argument, with
the same effect as a positive boolean. If enabled, the systemd manager (PID
1) shows terse service status updates on the console during bootup.
<constant>auto</constant> behaves like <option>false</option> until
there is a significant delay in boot. Defaults to enabled, unless
<option>quiet</option> is passed as kernel command line option, in which case
it defaults to <constant>auto</constant>. If specified overrides the system
manager configuration file option <option>ShowStatus=</option>, see
<listitem><para>Takes a boolean argument or the constants <constant>error</constant> and
<constant>auto</constant>. Can be also specified without an argument, with the same effect as a
positive boolean. If enabled, the systemd manager (PID 1) shows terse service status updates on the
console during bootup. With <constant>error</constant>, only messages about failures are shown, but
boot is otherwise quiet. <constant>auto</constant> behaves like <option>false</option> until there is
a significant delay in boot. Defaults to enabled, unless <option>quiet</option> is passed as kernel
command line option, in which case it defaults to <constant>error</constant>. If specified overrides
the system manager configuration file option <option>ShowStatus=</option>, see
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para></listitem>
</varlistentry>

View File

@ -494,7 +494,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
} else if (streq(key, "quiet") && !value) {
if (arg_show_status == _SHOW_STATUS_INVALID)
arg_show_status = SHOW_STATUS_AUTO;
arg_show_status = SHOW_STATUS_ERROR;
} else if (streq(key, "debug") && !value) {

View File

@ -4085,7 +4085,7 @@ void manager_recheck_journal(Manager *m) {
void manager_set_show_status(Manager *m, ShowStatus mode, const char *reason) {
assert(m);
assert(IN_SET(mode, SHOW_STATUS_AUTO, SHOW_STATUS_NO, SHOW_STATUS_YES, SHOW_STATUS_TEMPORARY));
assert(mode >= 0 && mode < _SHOW_STATUS_MAX);
if (!MANAGER_IS_SYSTEM(m))
return;

View File

@ -16,6 +16,7 @@
static const char* const show_status_table[_SHOW_STATUS_MAX] = {
[SHOW_STATUS_NO] = "no",
[SHOW_STATUS_ERROR] = "error",
[SHOW_STATUS_AUTO] = "auto",
[SHOW_STATUS_TEMPORARY] = "temporary",
[SHOW_STATUS_YES] = "yes",

View File

@ -9,6 +9,7 @@
typedef enum ShowStatus {
SHOW_STATUS_NO, /* printing of status is disabled */
SHOW_STATUS_ERROR, /* only print errors */
SHOW_STATUS_AUTO, /* disabled but may flip to _TEMPORARY */
SHOW_STATUS_TEMPORARY, /* enabled temporarily, may flip back to _AUTO */
SHOW_STATUS_YES, /* printing of status is enabled */