Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootchart_init=... does not nothing i.e. use /sbin/init instead of given init command #35

Open
solsticedhiver opened this issue May 4, 2012 · 8 comments

Comments

@solsticedhiver
Copy link

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

@xrmx
Copy link
Owner

xrmx commented May 4, 2012

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) :|

@solsticedhiver
Copy link
Author

I am using bootchart2 0.14.1, kernel 3.3.4 on archlinux 32 bits which uses an initrd

so in dmesg, I see

  1. 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
  2. params gives an empty string ! (which was already reported by xrmx)
  3. 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

@xrmx
Copy link
Owner

xrmx commented May 5, 2012

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?

@solsticedhiver
Copy link
Author

the output of echo cat /proc/1/cmdline is
/bin/bash/sbin/bootchartd
no space between the 2 ?

@xrmx
Copy link
Owner

xrmx commented May 8, 2012

The missing space is not a problem, will try to reproduce here

@maleadt
Copy link

maleadt commented Jun 3, 2013

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.

@xrmx
Copy link
Owner

xrmx commented Jun 3, 2013

@maleadt Isn't that what 130d775 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?

@maleadt
Copy link

maleadt commented Jun 4, 2013

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: 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants