[systemd-devel] [PATCH v4] use systemd.debug on the kernel command line, not "debug"

Hannes Reinecke hare at suse.de
Thu Apr 3 07:08:15 PDT 2014


From: Greg KH <gregkh at linuxfoundation.org>

If the kernel is started with "debug", that's for the kernel to switch
into debug mode.  We should rely on a namespace for our options, like
everything else (with the exception of "quiet").  Some people want to
only debug the kernel, not systemd, and the opposite as well so make
everyone happy.

Signed-off-by: Greg KH <gregkh at linuxfoundation.org>
Signed-off-by: Hannes Reinecke <hare at suse.de>
---
 man/kernel-command-line.xml |  4 ++--
 src/core/main.c             | 21 +++++++++++----------
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml
index dbfec61..19da7a3 100644
--- a/man/kernel-command-line.xml
+++ b/man/kernel-command-line.xml
@@ -126,10 +126,10 @@
                         </varlistentry>
 
                         <varlistentry>
-                                <term><varname>debug</varname></term>
+                                <term><varname>systemd.debug</varname></term>
                                 <listitem>
                                         <para>Parameter understood by
-                                        both the kernel and the system
+                                        the system
                                         and service manager to control
                                         console log verbosity. For
                                         details, see
diff --git a/src/core/main.c b/src/core/main.c
index 41605ee..2ca038c 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -374,6 +374,15 @@ static int parse_proc_cmdline_item(const char *key, const char *value) {
                 } else
                         log_warning("Environment variable name '%s' is not valid. Ignoring.", value);
 
+        } else if (streq(key, "systemd.debug") && !value) {
+
+                /* Log to kmsg, the journal socket will fill up before the
+                 * journal is started and tools running during that time
+                 * will block with every log message for for 60 seconds,
+                 * before they give up. */
+                log_set_max_level(LOG_DEBUG);
+                log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_CONSOLE : LOG_TARGET_KMSG);
+
         } else if (!streq(key, "systemd.restore_state") &&
                    !streq(key, "systemd.gpt_auto") &&
                    (startswith(key, "systemd.") || startswith(key, "rd.systemd."))) {
@@ -408,7 +417,8 @@ static int parse_proc_cmdline_item(const char *key, const char *value) {
                                  "systemd.default_standard_error=null|tty|syslog|syslog+console|kmsg|kmsg+console|journal|journal+console\n"
                                  "                                         Set default log error output for services\n"
                                  "systemd.setenv=ASSIGNMENT                Set an environment variable for all spawned processes\n"
-                                 "systemd.restore_state=0|1                Restore backlight/rfkill state at boot\n");
+                                 "systemd.restore_state=0|1                Restore backlight/rfkill state at boot\n"
+                                 "systemd.debug                            Enable debugging output\n");
                 }
 
         } else if (streq(key, "quiet") && !value) {
@@ -416,15 +426,6 @@ static int parse_proc_cmdline_item(const char *key, const char *value) {
                 if (arg_show_status == _SHOW_STATUS_UNSET)
                         arg_show_status = SHOW_STATUS_AUTO;
 
-        } else if (streq(key, "debug") && !value) {
-
-                /* Log to kmsg, the journal socket will fill up before the
-                 * journal is started and tools running during that time
-                 * will block with every log message for for 60 seconds,
-                 * before they give up. */
-                log_set_max_level(LOG_DEBUG);
-                log_set_target(detect_container(NULL) > 0 ? LOG_TARGET_CONSOLE : LOG_TARGET_KMSG);
-
         } else if (!in_initrd() && !value) {
                 unsigned i;
 
-- 
1.8.1.4



More information about the systemd-devel mailing list