Hey systemd hackers, While trying systemd-bootchart on my Ubuntu vivid system I ran into some issues. My system has upstart as /sbin/init, but I use init=/lib/systemd/systemd and that works fine. Today I tried to change that to /lib/systemd/systemd-bootchart but the charting failed on a missing /run/log. Turns out that it's because systemd-bootchart runs /sbin/init by default, would it make sense to run the systemd binary instead? I'm attaching a patch that does that
Cheers, Sebastien Bacher
>From 60783beb0cad6dc55be8591b8648e00a38fe9210 Mon Sep 17 00:00:00 2001 From: Sebastien Bacher <seb...@ubuntu.com> Date: Mon, 2 Feb 2015 15:48:40 +0100 Subject: [PATCH] Ensure that systemd is the init called after using bootchart When booting with systemd-bootchart, default to call the systemd binary rather than the init binary on disk, which might be another init system. Collecting data doesn't work out of systemd. --- man/bootchart.conf.xml | 2 +- man/systemd-bootchart.xml | 4 ++-- src/bootchart/bootchart.c | 8 ++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/man/bootchart.conf.xml b/man/bootchart.conf.xml index a364826..e11ccb5 100644 --- a/man/bootchart.conf.xml +++ b/man/bootchart.conf.xml @@ -124,7 +124,7 @@ <varlistentry> <term><varname>Init=[path]</varname></term> <listitem><para>Configures bootchart to run a non-standard - binary instead of <filename>/sbin/init</filename>. This + binary instead of <filename>/usr/lib/systemd/systemd</filename>. This option is only relevant if bootchart was invoked from the kernel command line with init=/usr/lib/systemd/systemd-bootchart.</para></listitem> diff --git a/man/systemd-bootchart.xml b/man/systemd-bootchart.xml index 0068e92..ff86be2 100644 --- a/man/systemd-bootchart.xml +++ b/man/systemd-bootchart.xml @@ -116,7 +116,7 @@ <command>systemd-bootchart</command> instead of the init process. In turn, <command>systemd-bootchart</command> - will invoke <command>/sbin/init</command>. + will invoke <command>/usr/lib/systemd/systemd</command>. </para></listitem> </varlistentry> @@ -218,7 +218,7 @@ <term><option>-i</option></term> <term><option>--init <replaceable>path</replaceable></option></term> <listitem><para>Use this init binary. Defaults to - <command>/sbin/init</command>. + <command>/usr/lib/systemd/systemd</command>. </para></listitem> </varlistentry> diff --git a/src/bootchart/bootchart.c b/src/bootchart/bootchart.c index 0808ba4..99ad745 100644 --- a/src/bootchart/bootchart.c +++ b/src/bootchart/bootchart.c @@ -76,7 +76,11 @@ int sysfd=-1; #define DEFAULT_HZ 25.0 #define DEFAULT_SCALE_X 100.0 /* 100px = 1sec */ #define DEFAULT_SCALE_Y 20.0 /* 16px = 1 process bar */ -#define DEFAULT_INIT "/sbin/init" +#ifdef HAVE_SPLIT_USR +#define DEFAULT_INIT "/lib/systemd/systemd" +#else +#define DEFAULT_INIT "/usr/lib/systemd/systemd" +#endif #define DEFAULT_OUTPUT "/run/log" /* graph defaults */ @@ -326,7 +330,7 @@ int main(int argc, char *argv[]) { /* * If the kernel executed us through init=/usr/lib/systemd/systemd-bootchart, then * fork: - * - parent execs executable specified via init_path[] (/sbin/init by default) as pid=1 + * - parent execs executable specified via init_path[] (/usr/lib/systemd/systemd by default) as pid=1 * - child logs data */ if (getpid() == 1) { -- 2.1.4
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel