From 0d066dd1a4cdb6514c8630fc0cf841495bc820a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 29 Feb 2020 17:49:50 +0100 Subject: [PATCH] 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. --- TODO | 3 --- man/systemd.xml | 17 ++++++++--------- src/core/main.c | 2 +- src/core/manager.c | 2 +- src/core/show-status.c | 1 + src/core/show-status.h | 1 + 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/TODO b/TODO index d26b1be408..e944245a57 100644 --- a/TODO +++ b/TODO @@ -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) diff --git a/man/systemd.xml b/man/systemd.xml index bbe0834e23..28bf49e131 100644 --- a/man/systemd.xml +++ b/man/systemd.xml @@ -798,15 +798,14 @@ systemd.show_status - Takes a boolean argument or the constant - auto. 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. - auto behaves like until - there is a significant delay in boot. Defaults to enabled, unless - is passed as kernel command line option, in which case - it defaults to auto. If specified overrides the system - manager configuration file option , see + Takes a boolean argument or the constants error and + auto. 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 error, only messages about failures are shown, but + boot is otherwise quiet. auto behaves like until there is + a significant delay in boot. Defaults to enabled, unless is passed as kernel + command line option, in which case it defaults to error. If specified overrides + the system manager configuration file option , see systemd-system.conf5. diff --git a/src/core/main.c b/src/core/main.c index 5302c4d27c..3baecc5f00 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -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) { diff --git a/src/core/manager.c b/src/core/manager.c index e6739e28ab..6f8065bb08 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -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; diff --git a/src/core/show-status.c b/src/core/show-status.c index c998b51abd..9d7358a9c1 100644 --- a/src/core/show-status.c +++ b/src/core/show-status.c @@ -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", diff --git a/src/core/show-status.h b/src/core/show-status.h index 0686b60d74..178f624d6c 100644 --- a/src/core/show-status.h +++ b/src/core/show-status.h @@ -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 */