18

My server has two 1-Gbit and two 10-Gbit onboard network cards.

I need to disable the 1-Gbit network cards completely, so that ifconfig -a does not show them.

The network cards use different kernel modules. The 10-Gbit use ixgbe, and the 1-Gbit use igb.

01:00.1 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
Subsystem: Dell Ethernet 10G 4P X520/I350 rNDC
Kernel driver in use: ixgbe

05:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
Subsystem: Dell I350 Gigabit Network Connection
Kernel driver in use: igb 

Both ixgbe and igb are compiled statically in the kernel (not as a loadable module). I need to disable the module using the kernel boot parameters.

I have tried appending the following to my kernel, but it has no effect:

igb.blacklist=yes
igb.enable=0
igb.disable=yes

the igb network cards are still showing

How can I disable igb completely ?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Martin Vegter
  • 358
  • 75
  • 236
  • 411

1 Answers1

31

You should be able to blacklist the igb “module”, even when built-in, by blacklisting its initialisation function: add

initcall_blacklist=igb_init_module

to your kernel’s boot parameters.

See How do I disable I2C Designware support when it's not built as a module? for background information. The general recipe here is to look for the module in the kernel source code, and look for functions which have the __init attribute — there should only be one readily identifiable as the main initialisation function (typically referred to in a module_init declaration). Blacklist that, and the driver won’t be initialised.

Stephen Kitt
  • 434,908
  • 4
    For those to whom it matters, the initcall_blacklist parameter appeared in Linux 3.16. – Ruslan Sep 11 '18 at 05:55
  • 1
    is <modulename>_init_module the canonical name for each and everything that can be built as a module? – Bananguin Sep 13 '18 at 11:15
  • 1
    @Bananguin unfortunately not, there are quite a few called ..._init_module or ..._module_init but they don’t all follow those patterns. – Stephen Kitt Sep 13 '18 at 13:30
  • Great answer! I was able to prevent /dev/ramX generation at boot, with brd built-in, via initcall_blacklist=brd_init kernel command-line parameter, taken from: https://github.com/torvalds/linux/blob/master/drivers/block/brd.c With brd.rd_nr=0 there is still /dev/ram0 autogenerated. – MichaIng Nov 06 '22 at 15:10