Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

modprobe

Load or unload kernel modules, with their dependencies and the settings from /etc/modprobe.d/.

Niveau
RHCSA-examen
Groep
Kernel en hardware
Root nodig
Ja
Pakket
kmod

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

modprobe NAME loads a module and everything it needs; modprobe -r NAME removes it and unused dependencies. Parameters can be given on the command line (modprobe loop max_part=8) or in /etc/modprobe.d/*.conf with options. In the same folder blacklist and install … /bin/false stop modules from loading.

Modules that must load at boot go in /etc/modules-load.d/*.conf.

Zo schrijf je het

modprobe [OPTION]... MODULE [PARAMETER=VALUE]...
modprobe -r [OPTION]... MODULE...
modprobe -c

Opties 20

Meest gebruikt

-r, --remove
Unload the module (and unused dependencies).
-a, --all
Load all modules named on the command line.
-n, --dry-run, --show
Do everything except load/unload.
-v, --verbose
Show what is done.
-q, --quiet
No error if the module is not found.
-c, --showconfig
Show the full configuration (options, blacklists, aliases).
--show-depends
List the files that would be loaded.
-b, --use-blacklist
Also apply blacklists when loading by name.
-i, --ignore-install, --ignore-remove
Ignore install/remove commands from the config.
-f, --force
Ignore version checks (dangerous).
--force-vermagic, --force-modversion
Ignore one kind of version check.
--first-time
Fail if already loaded (or not loaded with -r).
-R, --resolve-alias
Print the module name of an alias.
-C, --config FILE
Use another config file or folder.
-d, --dirname DIR
Root folder for modules.
-S, --set-version VERSION
Use modules of another kernel version.
-w, --wait MS
With -r: wait for the module to be unused.
--dump-modversions
Show the version info of a module file.
-s, --syslog
Errors to syslog.
-V, --version
Show the version.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1Load a module

    modprobe vfat
    lsmod | grep vfat

    fat is loaded too (dependency).

  2. 2Unload it

    modprobe -r vfat

    Fails if it is in use.

  3. 3Load with a parameter

    modprobe loop max_part=8

    Only until the module is unloaded or reboot.

  4. 4Parameter for good

    echo "options loop max_part=8" > /etc/modprobe.d/loop.conf

    Used every time the module loads.

  5. 5Load at boot

    echo vfat > /etc/modules-load.d/vfat.conf

    systemd-modules-load reads this folder.

  6. 6Block a module (hardening)

    printf 'blacklist usb-storage\ninstall usb-storage /bin/false\n' > /etc/modprobe.d/no-usb-storage.conf

    blacklist stops auto-loading; install /bin/false stops modprobe too.

  7. 7Test what would happen

    modprobe -nv vfat
    insmod /lib/modules/…/fat.ko.xz
    insmod /lib/modules/…/vfat.ko.xz

    No change.

  8. 8Show the active configuration

    modprobe -c | grep -E '^(options|blacklist)'

    All options and blacklists from all files.

  9. 9Which module serves an alias

    modprobe -R pci:v00008086d000010D3sv*sd*bc*sc*i*

    Hardware ID to module name.

  10. 10Rebuild the initramfs after changes for early modules

    dracut -f

    Blacklists of storage drivers must be in the initramfs too.

Bestanden

/etc/modprobe.d/*.conf
options, blacklist, install, alias lines.
/etc/modules-load.d/*.conf
Modules to load at boot.
/lib/modules/$(uname -r)/
The module files.

Exitcodes

0 :: Done. 1 :: Error.