Re: Load modules in initrd

Andrei Borzenkov <[email protected]> Wed, 19 Jun 2024 14:55:13 +0300
Newsgroups org.kernel.vger.initramfs
Message-ID <[email protected]>
On 19.06.2024 14:51, Carolina Jubran wrote:
> 
> Hello!
> 
> I need to load RDMA modules in initrd, and I have a systemd service for that. However, when we start running in the initrd, the initrd-cleanup.service kills the service.

You already posted this in systemd list and you still failed to explain 
how kernel module is related to user space program.

> The Dracut arrangement only installs the service if the necessary hardware is present.
> I tried to add dependencies to the systemd service "Before=initrd.target" to ensure that the service loads the drivers in initrd.
> Unfortunately, this was inconsistent; sometimes we load in initrd and sometimes we don't.
> 
> Then I discovered that adding a "$SYSTEMCTL -q --root "$initdir" add-wants initrd.target <our-service>" in the module-setup.sh helps with the issue, and the driver consistently runs in initrd.
> My question is, how does "add-wants initrd.target" fit into the picture with the initramfs image and systemd?
> Do I need to make any further changes to my systemd service, or is building the image using dracut sufficient?
> 
> Thank you,
> Carolina Jubran
>