mytechspam (mytechspam) wrote,

using modprobe for module substitution with fallback

Realtek drivers on linux boxes are not perfect - were leading servers to occasional hangs, especially when working in gigabit network. Hetzner's has special Wiki page for it - "The Linux r8169 driver for the Realtek network chips does not always work correctly, even in the newest kernel versions." . So, I was forced to build module from Realtek's sources and load it before/instead of r8169. That shouldn't be hard, even that wiki article has all needed steps. But article suggests to disable r8169 module via blacklisting, but I wanted to provide fallback mode - i.e. imagine you installed new kernel/upgraded old one and server be booted without network as custom module is not compiled for it and new one is blacklisted.
So, I've googled around and found that modprobe.conf(5) with help of modprobe(8), can be set to execute particular command on module load request (install). 
coolcold@server1:~$ cat /etc/modprobe.d/forceinstall.conf
#using forced install for module override:
install r8169 /sbin/modprobe r8168 || /sbin/modprobe -v -i r8169

This conf line tells modprobe what to do on request of loading module r8169 - it will try to load r8168 module, if this fails, tries to load 8169 modules with "-i" switch, which instructs modprobe to ignore install sections within this invocation (so it won't cycle). Therefore, even if module r8168 is missing in system, 8169 will be loaded, and there is not need for blacklisting!

P.S. Hint - don't forget to update-initramfs after editing modprobe related configs.

Tags: hetzner, linux, modprobe, r8168, r8169

  • dd & blocksize

    > root# dd bs=512 skip=19087681 seek=19087681 count=1 if=/dev/sdc of=/dev/sdb > dd: writing `/dev/sdb': Input/output error > 1+0 records in…

  • linux raid & linux kernel

    Debian's 2.6.26 kernel из backports для Etch (по идее в Lenny такая же шняга) тоже не может нормально работать с рейдами, в честь первого воскресенья…

  • linux on desktop

    Линупс к захвату десктопов готов, я щитаю. if a particular user has a GNOME session running that includes gnome-panel, and a md sync_action check on…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your IP address will be recorded