Systemd-boot and dracut

Over the weekend I switched my PC over to systemd-boot and dracut, replacing grub and mkinicpio.

Thanks to @dalto tutorial ([Tutorial] Convert to systemd-boot) the migration to systemd-boot was working like a charm.

Everything is working fine. I have hooks implemented for pacman to automatically create initrd and systemd-boot conf files. My hooks make use of kernel-install from systemd.

Now I am wondering what the best way is to manage the kernel commandline. dracut offers a kernel_cmdline option. But this is somehow not taken over by kernel_install when it creates the *.conf files for systemd-boot.

So what is the dracut kernel_cmdline option good for? Does anybody know?

1 Like

I haven’t tried dracut on Arch yet but by default kernel-install first looks at /etc/kernel/cmdline and if it is not present uses the command line from the running system.

So, you could either just let it use the running commandline and change that when you want changes or you could set your kernel options in /etc/kernel/cmdline. I do the latter because that way the kernel options will be correctly generated in a chroot.

This is how I do it as well. I had no choice because this is how kernel-install with systemd-boot works. But that then means that I do not have to give another kernel commandline with dracut I assume.

Correct. kernel-install is probably using that to explicitly set the commandline in dracut.

You can see what it is doing exactly by reading the scripts in /usr/lib/kernel/install.d/

And, by the way, dracut is coming with plugins for systemd-boot resp. kernel-install:

# ls /usr/lib/kernel/install.d
50-depmod.install  50-dracut.install  51-dracut-rescue.install  90-loaderentry.install

Very nice! It automatically creates the initrd when kernel-install is executed.