Given user has different modules needed for initrd(stage1) and main system(stage2) which defined like this:
boot.initrd.kernelModules = [
// stage1 modules
];
boot.kernelModules = [
// stage2 modules
];
when running a non-VM host with initrd.systemd.enable = true this is the output of journalctl -u systemd-modules-load --no-pager
Feb 25 21:17:59 jupiter systemd-modules-load[207]: Inserted module 'dm_mod'
Feb 25 21:17:59 jupiter systemd-modules-load[207]: Inserted module 'tpm_crb'
Feb 25 21:17:59 jupiter systemd-modules-load[207]: Inserted module 'tpm_tis'
Feb 25 21:18:00 jupiter systemd-modules-load[207]: Inserted module 'zfs'
Feb 25 21:18:00 jupiter systemd[1]: Finished Load Kernel Modules.
Feb 25 21:18:05 jupiter systemd[1]: systemd-modules-load.service: Deactivated successfully.
Feb 25 21:18:05 jupiter systemd[1]: Stopped Load Kernel Modules.
Feb 25 21:18:08 jupiter systemd-modules-load[1503]: Inserted module 'atkbd'
Feb 25 21:18:08 jupiter systemd-modules-load[1503]: Inserted module 'coretemp'
Feb 25 21:18:08 jupiter systemd-modules-load[1503]: Inserted module 'ib_core'
Feb 25 21:18:08 jupiter systemd-modules-load[1503]: Inserted module 'ib_uverbs'
Feb 25 21:18:08 jupiter systemd-modules-load[1503]: Inserted module 'loop'
Feb 25 21:18:09 jupiter systemd-modules-load[1503]: Inserted module 'mlx5_core'
Feb 25 21:18:09 jupiter systemd-modules-load[1503]: Inserted module 'mlx5_ib'
Feb 25 21:18:09 jupiter systemd-modules-load[1503]: Inserted module 'nct6775'
Feb 25 21:18:09 jupiter systemd-modules-load[1503]: Inserted module 'rdma_cm'
Feb 25 21:18:09 jupiter systemd-modules-load[1503]: Inserted module 'tap'
Feb 25 21:18:09 jupiter systemd-modules-load[1503]: Inserted module 'vhost_net'
Feb 25 21:18:09 jupiter systemd[1]: Finished Load Kernel Modules.
As you can see systemd-modules-load fires two times - one in stage1 another one in stage2
This is the expected behaviour
Now if we take a look at how the VM is booted:
Feb 26 06:17:08 europa systemd-modules-load[86]: Inserted module '9p'
Feb 26 06:17:08 europa systemd-modules-load[86]: Inserted module '9pnet_virtio'
Feb 26 06:17:08 europa systemd-modules-load[86]: Inserted module 'dm_mod'
Feb 26 06:17:08 europa systemd-modules-load[86]: Inserted module 'nvme'
Feb 26 06:17:08 europa systemd-modules-load[86]: Inserted module 'virtio_blk'
Feb 26 06:17:08 europa systemd-modules-load[86]: Inserted module 'virtio_mmio'
Feb 26 06:17:08 europa systemd-modules-load[86]: Inserted module 'virtiofs'
Feb 26 06:17:08 europa systemd[1]: Finished Load Kernel Modules.
We can see that service ran only once. It has missing:
Feb 25 21:18:05 europa systemd[1]: systemd-modules-load.service: Deactivated successfully.
Feb 25 21:18:05 europa systemd[1]: Stopped Load Kernel Modules.
It has never stopped!
The consequence and the bug is that: Stage2 modules aren't loaded at all because stage2 sees systemd-modules-load as active.
Given user has different modules needed for initrd(stage1) and main system(stage2) which defined like this:
when running a non-VM host with
initrd.systemd.enable = truethis is the output ofjournalctl -u systemd-modules-load --no-pagerAs you can see
systemd-modules-loadfires two times - one in stage1 another one in stage2This is the expected behaviour
Now if we take a look at how the VM is booted:
We can see that service ran only once. It has missing:
It has never stopped!
The consequence and the bug is that: Stage2 modules aren't loaded at all because stage2 sees
systemd-modules-loadas active.