[Nix-dev] How to plug systemd-bootchart into kernel args?
Mateusz Czaplinski
czapkofan at gmail.com
Tue Jul 12 18:09:12 CEST 2016
I'm mostly interested in analyzing what happens during systemd. I seem
to understand systemd-bootchart should provide somewhat more detailed
analysis of what's going on - e.g. like in
https://wiki.apertis.org/Docs/System_startup#systemd-bootchart. I find
the basic "systemd-analyze plot" somewhat too opaque for the noob I
am... to tell the truth, I'd love to collect as much information as
possible from wherever possible. E.g. some udev-related stuff looks
highly suspicious in my plot (I have long red bar for my disk); but I
couldn't find yet if/how it is possible to log the timing of udev
events during boot... So, was hoping bootchart could maybe help me at
least in some way...?
I'd be very grateful for any hints on how to plug systemd-bootstrap at
any stage/point up to systemd start. I'm OK with patching nixpkgs (and
`nixos-rebuild -I nixpkgs=~/nixpkgs switch`); anything is ok, though
I'd sure be extra grateful for "style/approach" guidance which could
result in a pull request that could be useful/make life easier for
future users.
/Mateusz.
On Mon, Jul 11, 2016 at 2:40 AM, Nikolay Amiantov <ab at fmap.me> wrote:
> I don't think it's possible now to run systemd-bootchart before stage-1
> (initrd) and stage-2 along with the activation script finish running and
> control is passed to systemd. We could add support for running
> systemd-bootchart instead of systemd at this point (should be simple).
>
> However, if you wanted to measure how earlier boot stages perform I'm
> afraid we don't have any means to do so ATM (other than a general
> "pre-systemd boot took N.M seconds"). I'd love to be proved wrong, of
> course!
>
> On 07/11/2016 03:31 AM, Mateusz Czaplinski wrote:
>> I've read that for detailed boot time instrumentation, one is advised
>> to use 'init=/usr/lib/systemd/systemd-bootchart' kernel param.
>>
>> I've already:
>> - found out that with systemd-230, systemd-bootchart was moved out to
>> a separate project (github.com/systemd/systemd-bootchart);
>> - built a derivation for it and made it to compile successfully;
>> (running systemd-bootchart --help prints help info);
>> - tried to pass it into /etc/nixos/configuration.nix as:
>>
>> kernelParams = [
>> "init=${systemd-bootchart}/lib/systemd/systemd-bootchart"
>> ];
>>
>> - but I'm getting a kernel panic on boot.
>>
>> What should I do? Also, I don't know how to retrieve the exact
>> contents of the panic message from the "previous boot" (i.e. the
>> panicked one), after I hard-reboot and pick a last-working
>> configuration in GRUB menu. Dmesg seems to show only the successful
>> one, journalctl doesn't seem to be aware of the panic either with -b
>> -1.
>>
>> I've also noticed, that /boot/grub/grub.cfg actually contains two
>> init= arguments, as the new one is only appended (the old one is still
>> kept); can this be the reason? If yes, is there some reasonable hack I
>> could try to fix that?
>>
>> Also, I've read that I should maybe pass -i option to bootchart, to
>> inform it what init script it should pass control to. But I don't know
>> how to retrieve the path dynamically in Nix expression? it looks to me
>> it's available only temporarily as a let-expression, which is used in
>> some advanced expression and thus doesn't escape into "global scope".
>> Still, when I tried to hardcode it as:
>> "init=${systemd-bootchart}/.../systemd-bootchart -i
>> /nix/store/.../init", it panicked anyway (that said, in grub.cfg, it
>> seems the spaces are not escaped around -i here; is that ok?), so I
>> assume I haven't even reached this phase yet.
>>
>> I'd be grateful for any help!
>>
>> Thanks & Best Regards,
>> /Mateusz Czapliński.
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>
>
>
> --
> Nikolay.
More information about the nix-dev
mailing list