Artix Linux Forum

Artix Linux => Installation / Migration / Configuration => Topic started by: brandflake11 on 01 December 2020, 18:18:57

Title: Load Kernel Modules at Boot
Post by: brandflake11 on 01 December 2020, 18:18:57
Hello all,
Where do I put a file to load a kernel module, or list of kernel modules, at boot? Is it /etc/modprobe.d/?

Thank you for any help!
Title: Re: Load Kernel Modules at Boot
Post by: alium on 01 December 2020, 19:19:36
Hello all,
Where do I put a file to load a kernel module, or list of kernel modules, at boot? Is it /etc/modprobe.d/?

Thank you for any help!


wiki.archlinux.org still working ;-)
why you not ask there? https://wiki.archlinux.org/index.php/Kernel_module (ignoring the part about systemd)

necessary modules for boot you can add in to /etc/mkinitcpio.conf too  https://wiki.archlinux.org/index.php/Mkinitcpio
Title: Re: Load Kernel Modules at Boot
Post by: brandflake11 on 01 December 2020, 21:23:43

wiki.archlinux.org still working ;-)
why you not ask there? https://wiki.archlinux.org/index.php/Kernel_module (ignoring the part about systemd)

necessary modules for boot you can add in to /etc/mkinitcpio.conf too  https://wiki.archlinux.org/index.php/Mkinitcpio

Well, I didn't know if it was any different than Arch Linux, since it seems that kernel modules with Arch Linux tends to be linked to systemd (that's what it looked like on the kernel module archwiki page I have looked at, but maybe not enough...), but I don't know enough to tell if it is or not. I appreciate your help. :) Thanks for the link on mkinitcpio, I didn't know about it. I'll look into this and post here if I run into any problems. :)

EDIT: I guess my real question then, is if putting a file like /etc/modules-load.d/virtio-net.conf with the module I want to load in it will work on Artix, since I don't have systemd.
Title: Re: Load Kernel Modules at Boot
Post by: alium on 01 December 2020, 21:55:17
it will works, if you put it in /etc/modprobe.d/ https://wiki.archlinux.org/index.php/Kernel_module#Using_files_in_/etc/modprobe.d/

EDIT: seems, modprobe.d can not load module without one of a parameter (install/blackist/alias/options)
Title: Re: Load Kernel Modules at Boot
Post by: brandflake11 on 01 December 2020, 22:03:50
Thanks Alium, I appreciate your help. This is why I wanted to clarify, as it doesn't say you can put modules there, but module settings.
Title: Re: Load Kernel Modules at Boot
Post by: alium on 01 December 2020, 22:15:31
what works (tested by myself) is puting your module for automaticaly load in /etc/conf.d/modules

Code: [Select]
[picasso alois]# cat /etc/conf.d/modules 
# Linux users can define a list of modules for a specific kernel version,
# a released kernel version, a main kernel version or all kernel versions.
# The most specific versioned variable will take precedence.
# FreeBSD users can only use the modules="foo bar" setting.
modules="virtio_net"

after reboot i can see:
Code: [Select]
[picasso alois]# lsmod | grep virti
virtio_net             61440  0
net_failover           20480  1 virtio_net
Title: Re: Load Kernel Modules at Boot
Post by: Dudemanguy on 01 December 2020, 23:50:28
Well, I didn't know if it was any different than Arch Linux, since it seems that kernel modules with Arch Linux tends to be linked to systemd (that's what it looked like on the kernel module archwiki page I have looked at, but maybe not enough...), but I don't know enough to tell if it is or not. I appreciate your help. :) Thanks for the link on mkinitcpio, I didn't know about it. I'll look into this and post here if I run into any problems. :)

EDIT: I guess my real question then, is if putting a file like /etc/modules-load.d/virtio-net.conf with the module I want to load in it will work on Artix, since I don't have systemd.

Actually every init on artix should support /etc/modules-load.d/*.conf so that should actually work. You can set modules in mkinitcpio as well if you want though.
Title: Re: Load Kernel Modules at Boot
Post by: alium on 02 December 2020, 06:52:43
That not works for me, etc/modules-load.d not exist ,  and if I create it, system ignored it
Title: Re: Load Kernel Modules at Boot
Post by: Dudemanguy on 02 December 2020, 15:08:21
Hmm, maybe I spoke too soon. runit and s6 run modules-load on boot which is a script that takes care of this. I assumed openrc did as well but I guess not?
Title: Re: Load Kernel Modules at Boot
Post by: artoo on 02 December 2020, 16:17:38
Hmm, maybe I spoke too soon. runit and s6 run modules-load on boot which is a script that takes care of this. I assumed openrc did as well but I guess not?

Openrc modules service will use /usr/lib/modules-load.d or /run/modules-load.d or /etc/modules-load.d if it contains *.conf files.
Title: Re: Load Kernel Modules at Boot
Post by: kiblaster on 29 January 2023, 21:25:02
How do I load them on dinit?
I tried /etc/modules and /etc/conf.d/modules, I had to create the files.
Title: Re: Load Kernel Modules at Boot
Post by: davmac on 30 January 2023, 01:08:12
How do I load them on dinit?
I tried /etc/modules and /etc/conf.d/modules, I had to create the files.

The modules service runs /usr/bin/modules-load which I assume is the same as for s6 and runit. It looks for *.conf files in each of /etc/modules-load.d, /run/modules-load.d, and /usr/lib/modules-load.d