Linux/Kernel/Module: Unterschied zwischen den Versionen
Keine Bearbeitungszusammenfassung |
Keine Bearbeitungszusammenfassung |
||
Zeile 9: | Zeile 9: | ||
Here are a list of useful device driver related commands | Here are a list of useful device driver related commands | ||
== Blockieren des Ladens von Linux-Kernel-Modulen == | |||
Deaktivieren Sie das automatische Laden von Linux-Kernel-Treibermodulen. Beachten Sie, dass dieses Verfahren nicht verhindert, dass ein anderer Prozess während des Bootens oder der Laufzeit ein zusätzliches Modul anfordert. | |||
; Warnungen | |||
# Wie in den Kommentar-Headern in <code>/etc/modprobe.d/blacklist.conf</code> erwähnt, hat das Hinzufügen von Modulen dort <code>...does not affect autoloading of modules;by the Linux kernel.</code>; das bedeutet, dass man eine Fake-Installation durchführen muss, um einen Treiber wie ''ipv6'' auf die Blacklist zu setzen. | |||
# (Verschieben Sie <code>/etc/modprobe.conf</code>, falls vorhanden, da es alles in <code>/etc/modprobe.d/*</code> ersetzt (außer Sie fügen <code>include /etc/modprobe.d</code> hinzu). | |||
# Die Module, die in <code>/etc/initramfs-tools/modules</code> aufgelistet sind, unterliegen nicht den Blacklists, also kommentieren Sie diese zuerst aus. | |||
; Howto | |||
# Erstellen Sie eine Datei '<code>/etc/modprobe.d/<modulename>.conf</code>', die '<code>blacklist <modulename></code>' enthält. | |||
# Führen Sie '<code>depmod -ae</code>' als root aus | |||
# Erstellen Sie Ihre initrd mit <code>'update-initramfs -u'</code> neu | |||
; Beispiele | |||
root@host:/etc/modprobe.d# ls -altr | |||
insgesamt 72 | |||
-rw-r--r-- 1 root root 363 Sep 24 19:57 pnp-hotplug | |||
-rw-r--r-- 1 root root 284 Sep 24 19:57 display_class | |||
drwxr-xr-x 2 root root 16 Oct 28 21:38 arch | |||
lrwxrwx 1 root root 9 Oct 28 21:38 arch-aliases -> arch/i386 | |||
-rw-r--r-- 1 root root 1405 Oct 29 09:46 blacklist.conf | |||
-rw-r--r-- 1 root root 18 Oct 29 13:34 eth1394.conf | |||
-rw-r--r-- 1 root root 15 Oct 29 14:49 irda.conf | |||
-rw-r--r-- 1 root root 20 Oct 29 16:10 irtty_sir.conf | |||
-rw-r--r-- 1 root root 18 Oct 29 16:10 sir_dev.conf | |||
-rw-r--r-- 1 root root 19 Oct 29 16:10 nsc_ircc.conf | |||
-rw-r--r-- 1 root root 4360 Oct 29 16:21 aliases | |||
drwxr-xr-x 3 root root 4096 Oct 29 16:24 . | |||
-rw-r--r-- 1 root root 15 Oct 29 16:24 ipv6.conf | |||
drwxr-xr-x 47 root root 12288 Oct 29 16:25 .. | |||
root@host:/etc/modprobe.d# | |||
cat eth1394.conf | |||
irda.conf irtty_sir.conf sir_dev.conf nsc_ircc.conf ipv6.conf | |||
blacklist eth1394 | |||
blacklist irda | |||
blacklist irtty_sir | |||
blacklist sir_dev | |||
blacklist nsc_ircc | |||
blacklist ipv6 | |||
; Nachtrag | |||
Manchmal muss man mehrere Module deaktivieren, um das gewünschte zu erhalten: irda ist so ein Beispiel. | |||
* In dem obigen Beispiel mussten irtty_sir, sir_dev und nsc_ircc alle deaktiviert werden, um irda zu deaktivieren. | |||
* Wenn Sie so etwas vermuten, führen Sie <code>lsmod</code> aus und finden Sie die Module, die dasjenige verwenden, das Sie deaktivieren wollen. | |||
=== Blacklist durch Fake-Installation === | |||
Nehmen wir an, Sie wollen ''Modulname'' mit einer ''Fake-Installation'' deaktivieren. | |||
# Erstellen Sie eine Datei namens '<code>/etc/modprobe.d/<modulename>.conf</code>', die '<code>install <modulename> /bin/true</code>' enthält. | |||
# Neustart. | |||
Diese Prozedur verhindert das Laden des Moduls ''Modulname'' zur Laufzeit. | |||
# https://wiki.debian.org/KernelModuleBlacklisting | |||
[[Kategorie:Linux/Kernel]] | [[Kategorie:Linux/Kernel]] |
Version vom 26. April 2025, 20:44 Uhr
- Unter einem Kernelmodul versteht man einen Teil bzw. eine Erweiterung des Kernels.
- So sind z. B. alle Hardwaretreiber (z. B. WLAN-Karte, Soundkarte...) als Modul angelegt
- Linux device driver commands

Linux device drivers are essential in-kernel software modules that enable Linux OS to communicate with hardware peripherals
Maintaining correct and up-to-date device drivers is crucial for ensuring hardware compatibility and optimal hardware performance
Here are a list of useful device driver related commands
Blockieren des Ladens von Linux-Kernel-Modulen
Deaktivieren Sie das automatische Laden von Linux-Kernel-Treibermodulen. Beachten Sie, dass dieses Verfahren nicht verhindert, dass ein anderer Prozess während des Bootens oder der Laufzeit ein zusätzliches Modul anfordert.
- Warnungen
- Wie in den Kommentar-Headern in
/etc/modprobe.d/blacklist.conf
erwähnt, hat das Hinzufügen von Modulen dort...does not affect autoloading of modules;by the Linux kernel.
; das bedeutet, dass man eine Fake-Installation durchführen muss, um einen Treiber wie ipv6 auf die Blacklist zu setzen. - (Verschieben Sie
/etc/modprobe.conf
, falls vorhanden, da es alles in/etc/modprobe.d/*
ersetzt (außer Sie fügeninclude /etc/modprobe.d
hinzu). - Die Module, die in
/etc/initramfs-tools/modules
aufgelistet sind, unterliegen nicht den Blacklists, also kommentieren Sie diese zuerst aus.
- Howto
- Erstellen Sie eine Datei '
/etc/modprobe.d/<modulename>.conf
', die 'blacklist <modulename>
' enthält. - Führen Sie '
depmod -ae
' als root aus - Erstellen Sie Ihre initrd mit
'update-initramfs -u'
neu
- Beispiele
root@host:/etc/modprobe.d# ls -altr insgesamt 72 -rw-r--r-- 1 root root 363 Sep 24 19:57 pnp-hotplug -rw-r--r-- 1 root root 284 Sep 24 19:57 display_class drwxr-xr-x 2 root root 16 Oct 28 21:38 arch lrwxrwx 1 root root 9 Oct 28 21:38 arch-aliases -> arch/i386 -rw-r--r-- 1 root root 1405 Oct 29 09:46 blacklist.conf -rw-r--r-- 1 root root 18 Oct 29 13:34 eth1394.conf -rw-r--r-- 1 root root 15 Oct 29 14:49 irda.conf -rw-r--r-- 1 root root 20 Oct 29 16:10 irtty_sir.conf -rw-r--r-- 1 root root 18 Oct 29 16:10 sir_dev.conf -rw-r--r-- 1 root root 19 Oct 29 16:10 nsc_ircc.conf -rw-r--r-- 1 root root 4360 Oct 29 16:21 aliases drwxr-xr-x 3 root root 4096 Oct 29 16:24 . -rw-r--r-- 1 root root 15 Oct 29 16:24 ipv6.conf drwxr-xr-x 47 root root 12288 Oct 29 16:25 ..
root@host:/etc/modprobe.d# cat eth1394.conf irda.conf irtty_sir.conf sir_dev.conf nsc_ircc.conf ipv6.conf blacklist eth1394 blacklist irda blacklist irtty_sir blacklist sir_dev blacklist nsc_ircc blacklist ipv6
- Nachtrag
Manchmal muss man mehrere Module deaktivieren, um das gewünschte zu erhalten: irda ist so ein Beispiel.
- In dem obigen Beispiel mussten irtty_sir, sir_dev und nsc_ircc alle deaktiviert werden, um irda zu deaktivieren.
- Wenn Sie so etwas vermuten, führen Sie
lsmod
aus und finden Sie die Module, die dasjenige verwenden, das Sie deaktivieren wollen.
Blacklist durch Fake-Installation
Nehmen wir an, Sie wollen Modulname mit einer Fake-Installation deaktivieren.
- Erstellen Sie eine Datei namens '
/etc/modprobe.d/<modulename>.conf
', die 'install <modulename> /bin/true
' enthält. - Neustart.
Diese Prozedur verhindert das Laden des Moduls Modulname zur Laufzeit.