How do I permanently load a kernel module?

Radu Maris

I have a Compaq Presario CQ-61 320SQ, I am using Ubuntu 10.04 because after update to 10.10 my mouse and touchpad won't work, network won't work, sound won't work ... (I managed to fix most of them after almost a month of googling, but not all, my 2 Desktops have no problem with 10.10) so I decided to switch back to 10.04, where I have a problem:

My broadband speed is very low beacause of the kernel module r8169, I downloaded the good module r8101 and every time the computer boots have a rc.local entry to fix this.

Question:
Can I load the modul permanently from a specific location. I heard about /etc/modules but there I need the module name, but I have to load it from a specific path (where is the default path for that) ?

Thank you.

So I studied the script:

It creates the file r8101.ko in /lib/modules/`uname -r`/kernel/drivers/net so I think as long as nobody will delete that file, and I don't update the kernel, maybe adding r8108 to /etc/modules will work, and add r8169 to blacklist ... I will give it a try.

EDIT2:
So I added r8101 to /etc/modules and blacklist r8169 to /etc/modprobe.d/blacklist.conf. It still uses the old module.:

radu@adu:~$ lsmod | grep r8
r8101                  67626  0 
r8169                  34108  0 
mii                     4381  1 r8169

EDIT: The module is loaded using this script that came with it.:

#!/bin/sh

# invoke insmod with all arguments we got
# and use a pathname, as insmod doesn't look in . by default

TARGET_PATH=/lib/modules/`uname -r`/kernel/drivers/net
echo
echo "Check old driver and unload it." 
check=`lsmod | grep r8169`
if [ "$check" != "" ]; then
        echo "rmmod r8169"
        /sbin/rmmod r8169
fi

check=`lsmod | grep r8101`
if [ "$check" != "" ]; then
        echo "rmmod r8101"
        /sbin/rmmod r8101
fi

echo "Build the module and install"
echo "-------------------------------" >> log.txt
date 1>>log.txt
make all 1>>log.txt || exit 1
module=`ls src/*.ko`
module=${module#src/}
module=${module%.ko}

if [ "$module" == "" ]; then
    echo "No driver exists!!!"
    exit 1
elif [ "$module" != "r8169" ]; then
    if test -e $TARGET_PATH/r8169.ko ; then
        echo "Backup r8169.ko"
        if test -e $TARGET_PATH/r8169.bak ; then
            i=0
            while test -e $TARGET_PATH/r8169.bak$i
            do
                i=$(($i+1))
            done
            echo "rename r8169.ko to r8169.bak$i"
            mv $TARGET_PATH/r8169.ko $TARGET_PATH/r8169.bak$i
        else
            echo "rename r8169.ko to r8169.bak"
            mv $TARGET_PATH/r8169.ko $TARGET_PATH/r8169.bak
        fi
    fi
fi

echo "Depending module. Please wait."
depmod -a
echo "load module $module"
modprobe $module

echo "Completed."
exit 0
Radu Maris

So to gather all the data to an answer, here it is:

  1. After the first compile of the new module, I had the module file r8101.ko in /lib/modules/$(uname -r)/kernel/drivers/net.

  2. I added r8101 to /etc/modules and blacklist r8169 to /etc/modprobe.d/blacklist.conf but I was still booting to the old module.

  3. Then I run sudo update-initramfs -u and then after restart the new module was loaded as expected (thanks to @papukaija comment).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I permanently load a kernel module?

From Dev

How do I load a kernel module later in the boot sequence?

From Dev

How do I load the tp_smapi kernel module on a Lenovo Easypad?

From Dev

how do I include the qcserial module in the kernel?

From Dev

How do I disable a kernel module persistently?

From Dev

How do I build the iptables kernel module for a loaded kernel?

From Dev

How do I load a module to PulseAudio server?

From Dev

How do I load a module to PulseAudio server?

From Dev

How do I install a kernel module in an LXC guest machine?

From Dev

How do I directly access reserved memory with a kernel module?

From Dev

How do I build a single in-tree kernel module?

From Dev

How do I build a single in-tree kernel module?

From Dev

How do I install a kernel module in an LXC guest machine?

From Dev

How do I debug a kernel module in which a NULL pointer appears?

From Dev

Ubuntu 19.10 boots into GRUB and I have to manually load the kernel. How do I have it load automatically?

From Dev

How do I understand if an USB Ethernet adapter is compatible with a certain kernel version to use it to load kernel/filesystem?

From Dev

How do I add a kernel module not compiled in my current kernel in linux

From Java

How do I install a library permanently in Colab?

From Dev

How do I disable network manager permanently?

From Dev

How do I disable network manager permanently?

From Dev

How do I permanently set the affinity of a process?

From Dev

How do I permanently change window titles?

From Dev

How do I permanently disable swap on archlinux?

From Dev

How do I permanently change a vector in R?

From Dev

How do I permanently add an environment variable?

From Dev

HOW do I load a Javascript call in a Joomla module BACKEND?

From Dev

how do i load modules and files in the intern config module?

From Dev

How do I load module from the project in a test script?

From Dev

How do I adapt a kernel module to get past `no symbol version for module_layout`?

Related Related

  1. 1

    How do I permanently load a kernel module?

  2. 2

    How do I load a kernel module later in the boot sequence?

  3. 3

    How do I load the tp_smapi kernel module on a Lenovo Easypad?

  4. 4

    how do I include the qcserial module in the kernel?

  5. 5

    How do I disable a kernel module persistently?

  6. 6

    How do I build the iptables kernel module for a loaded kernel?

  7. 7

    How do I load a module to PulseAudio server?

  8. 8

    How do I load a module to PulseAudio server?

  9. 9

    How do I install a kernel module in an LXC guest machine?

  10. 10

    How do I directly access reserved memory with a kernel module?

  11. 11

    How do I build a single in-tree kernel module?

  12. 12

    How do I build a single in-tree kernel module?

  13. 13

    How do I install a kernel module in an LXC guest machine?

  14. 14

    How do I debug a kernel module in which a NULL pointer appears?

  15. 15

    Ubuntu 19.10 boots into GRUB and I have to manually load the kernel. How do I have it load automatically?

  16. 16

    How do I understand if an USB Ethernet adapter is compatible with a certain kernel version to use it to load kernel/filesystem?

  17. 17

    How do I add a kernel module not compiled in my current kernel in linux

  18. 18

    How do I install a library permanently in Colab?

  19. 19

    How do I disable network manager permanently?

  20. 20

    How do I disable network manager permanently?

  21. 21

    How do I permanently set the affinity of a process?

  22. 22

    How do I permanently change window titles?

  23. 23

    How do I permanently disable swap on archlinux?

  24. 24

    How do I permanently change a vector in R?

  25. 25

    How do I permanently add an environment variable?

  26. 26

    HOW do I load a Javascript call in a Joomla module BACKEND?

  27. 27

    how do i load modules and files in the intern config module?

  28. 28

    How do I load module from the project in a test script?

  29. 29

    How do I adapt a kernel module to get past `no symbol version for module_layout`?

HotTag

Archive