[Nix-dev] How to plug systemd-bootchart into kernel args?

Nikolay Amiantov ab at fmap.me
Mon Jul 11 02:40:19 CEST 2016


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