commit 15bd74a905f25da3fc6e773b0e8e1bd88e09c49f Author: Stephen Wadeley swadeley@redhat.com Date: Thu Oct 23 21:41:18 2014 +0200
Update: Persistent Module Loading
Thank you David Shea
en-US/Working_with_Kernel_Modules.xml | 36 +++++++++++---------------------- 1 files changed, 12 insertions(+), 24 deletions(-) --- diff --git a/en-US/Working_with_Kernel_Modules.xml b/en-US/Working_with_Kernel_Modules.xml index cbabb95..ad41096 100644 --- a/en-US/Working_with_Kernel_Modules.xml +++ b/en-US/Working_with_Kernel_Modules.xml @@ -459,32 +459,20 @@ rmmod /lib/modules/2.6.32-71.el6.x86_64/kernel/lib/crc-itu-t.ko</screen> <tertiary><filename class="directory">/etc/sysconfig/modules/</filename></tertiary> </indexterm> <para>As shown in <xref - linkend="ex-Listing_information_about_a_kernel_module_with_lsmod"/>, many kernel modules are loaded automatically at boot time. You can specify additional modules to be loaded by creating a new <filename><replaceable>file_name</replaceable>.modules</filename> file in the <filename class="directory">/etc/sysconfig/modules/</filename> directory, where <replaceable>file_name</replaceable> is any descriptive name of your choice. Your <filename><replaceable>file_name</replaceable>.modules</filename> files are treated by the system startup scripts as shell scripts, and as such should begin with an <firstterm>interpreter directive</firstterm> (also called a <quote>bang line</quote>) as their first line:</para> - <programlisting language="Bash">#!/bin/sh</programlisting> - <para>Additionally, the <filename><replaceable>file_name</replaceable>.modules</filename> file should be executable. You can make it executable by running:</para> - <screen>modules]# <command>chmod +x <replaceable>file_name</replaceable>.modules</command> - </screen> + linkend="ex-Listing_information_about_a_kernel_module_with_lsmod"/>, many kernel modules are loaded automatically at boot time. You can specify additional modules to be loaded by the <systemitem class="daemon">systemd-modules-load.service</systemitem> daemon by creating a <filename><replaceable>program</replaceable>.conf</filename> file in the <filename class="directory">/etc/modules-load.d/</filename> directory, where <replaceable>program</replaceable> is any descriptive name of your choice. The files in <filename class="directory">/etc/modules-load.d/</filename> are text files that list the modules to be loaded, one per line.</para> <example - id="ex-bluez-uinput.modules"> - <title>/etc/sysconfig/modules/bluez-uinput.modules</title> - <para>The following <filename>bluez-uinput.modules</filename> script loads the <systemitem class="resource">uinput</systemitem> module:</para> - <programlisting language="Bash">#!/bin/sh - -if [ ! -c /dev/input/uinput ] ; then - exec /sbin/modprobe uinput >/dev/null 2>&1 -fi</programlisting> - <para>The <literal>if</literal>-conditional statement on the third line ensures that the <filename>/dev/input/uinput</filename> file does <emphasis>not</emphasis> already exist (the <literal>!</literal> symbol negates the condition), and, if that is the case, loads the <systemitem - class="resource">uinput</systemitem> module by calling <command>exec /sbin/modprobe uinput</command>. Note that the <systemitem - class="resource">uinput</systemitem> module creates the <filename>/dev/input/uinput</filename> file, so testing to see if that file exists serves as verification of whether the <systemitem - class="resource">uinput</systemitem> module is loaded into the kernel.</para> - <para>The following <command>>/dev/null 2>&1</command> clause at the end of that line redirects any output to <filename>/dev/null</filename> so that the <command>modprobe</command> command remains quiet.</para> + id="ex-A_Text_File_to_Load_a_Module"> + <title>A Text File to Load a Module</title> + <para> + To create a file to load the <filename>virtio-net.ko</filename> module, create a file <filename>/etc/modules-load.d/virtio-net.conf</filename> with the following content: + </para> + <screen># Load virtio-net.ko at boot +virtio-net</screen> </example> - <!-- silas: most modules are autoloaded these days... - <note - id="note-No_Need_to_Load_Network_and_SCSI_Modules"> - <title>Note: Do Not Load Network and SCSI Modules</title> - <para>Networking and SCSI modules do not generally need to be manually loaded as they have their own particular loading mechanisms.</para> - </note>--> + <para> + See the <filename>modules-load.d(5)</filename> and <filename>systemd-modules-load.service(8)</filename> man pages for more information. + </para> + </section>
<section