bootchart
bootchart copied to clipboard
bootchart_init=... does not nothing i.e. use /sbin/init instead of given init command
I was trying to run /sbin/e4rat-preload as init just after bootchartd So I used the kernel command line option bootchart_init=/sbin/e4rat-preload along side the other init=/sbin/bootchartd (...)
But it seems the usual /sbin/init was running. I was no mention of e4rat-preload in /var/log/bootchart.png
Looking at /sbin/bootchartd line 176, bootchartd assume that the kernel command line option are passed as arguments to the init process. Well, I don't know if it's the case but not here. So I fixed it with using for i in $(cat /proc/cmdline); do
It worked and used e4rat-preload as 2nd init process. I don't know if it has any side effect regarding other option or behavior
That's strange, which bootchart2 / kernel version are you using?
Could you please add these lines before the loop:
echo cat /proc/cmdline
>> $TMPFS/kmsg
echo "params: $@" >> $TMPFS/kmsg
echo env
>> $TMPFS/kmsg
and then check dmesg | tail for messages.
Related to this, Issue #27 suggests to completely remove the loop and it makes sense since it matches bootparam(7) :|
I am using bootchart2 0.14.1, kernel 3.3.4 on archlinux 32 bits which uses an initrd
so in dmesg, I see
- the output of /proc/cmdline has expected: root=/dev/disk/by-uuid/46xxxxxx-52e9-4d73-accd-2775bcxxxxxx ro quiet acpi_os_name="Microsoft Windows NT" bootchart_init=/usr/sbin/e4rat-preload-lite init=/sbin/bootchartd initcall_debug printk.time=y
- params gives an empty string ! (which was already reported by xrmx)
- output of env is: TERM=linux PWD=/ SHLVL=1 _=/usr/bin/env
which explains the bug I am reporting. then why it is that way,I don't know man bootparam is dated 2007-12-16 here, so may be it's outdated.
I can't find doc about the parameters passed to init
There weren't changes in bootchartd from 0.14.1 to 0.14.2 so no need to test another version.
The relevant bootparam documentation is this paragraph under "The Argument List" chapter: Anything of the form 'foo=bar' that is not accepted as a setup function as described above is then interpreted as an environment variable to be set. A (useless?) example would be to use 'TERM=vt100' as a boot argu‐ ment.
What does cat /proc/1/cmdline say?
the output of echo cat /proc/1/cmdline
is
/bin/bash/sbin/bootchartd
no space between the 2 ?
The missing space is not a problem, will try to reproduce here
This is still broken... I looked into it, and the current bootchart code tries to find bootchart_init
in its $@
argument array. AFAIS this cannot work, Linux' init/main.c
parses the cmdline and sets environment variables for unrecognised arguments which look like key=val
(such as bootchart_init
).
However, I tried modifying the code in order to check for $ENV{BOOTCHART_INIT}
, but I couldn't get it to work: despite trying to pass various key=val
-style arguments, $ENV
never contained any of them (tested by invoking /usr/bin/env
at the top of /sbin/bootchartd
). So although the docs and code make me think using the environment is the correct way, I didn't get it working.
What did work is passing the real init as a normal argument (init=/sbin/bootchartd /sbin/my_custom_init
), after which is was available in $@
; but this isn't acceptable of course.
@maleadt Isn't that what 130d775e230636f2e15cd7f766bec7a84d6b2461 is supposed to do? The kernel matches bootparam(7) manual, see http://lxr.linux.no/#linux+v3.9.4/init/main.c#L232 so AFAIU it's not bootchart2 at fault here. Which kernel do you have?
Hmm, most strange. I'm using Arch Linux, currently at 3.9.4. Booting the following init
wrapper:
#!/usr/bin/bash
/usr/bin/env
/usr/bin/echo "Arguments: $*"
/usr/bin/sleep 5
exec /usr/bin/init $*
... with additional kernel arguments init=/usr/bin/init_wrapper bootchart_init=/usr/bin/init ro
, I only get to see:
TERM=linux
RD_TIMESTAMP=
PWD=/
SHLVL=1
_=/usr/bin/env
Arguments: