Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
| Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
|
lpi1:kernel [2013/12/10 20:36] ingo_wichmann [Debian] |
lpi1:kernel [2024/09/18 15:25] (aktuell) |
||
|---|---|---|---|
| Zeile 7: | Zeile 7: | ||
| lspci | lspci | ||
| lspci -v | lspci -v | ||
| + | lspci -vv -nn # mit ids | ||
| ===== SCSI ===== | ===== SCSI ===== | ||
| lsscsi | lsscsi | ||
| Zeile 16: | Zeile 17: | ||
| ==== Kernel Meldungen anzeigen ==== | ==== Kernel Meldungen anzeigen ==== | ||
| dmesg | dmesg | ||
| + | fortlaufend, mit Uhrzeit: | ||
| + | dmesg -wT | ||
| ==== Kernel Module anzeigen ==== | ==== Kernel Module anzeigen ==== | ||
| Zeile 32: | Zeile 35: | ||
| modprobe -r dummy | modprobe -r dummy | ||
| - | Wenn das nicht geht, weil das Modul in Benutzung ist, dann kann man | + | Wenn das nicht geht, weil das Modul in Benutzung ist, dann kann man versuchen: |
| - | rmmod -w dummy | + | |
| - | + | ||
| - | (( wenn auch das nicht geht, kann man noch | + | |
| rmmod -f dummy | rmmod -f dummy | ||
| - | probieren.)) | + | |
| ===== Konfigurations-Dateien ===== | ===== Konfigurations-Dateien ===== | ||
| ==== Module nicht automatisch laden ==== | ==== Module nicht automatisch laden ==== | ||
| - | Beispiel: automatisches laden des Moduls //ipv6// verhindern | + | Beispiel: automatisches laden des Moduls //ip_tables// verhindern |
| - | ''/etc/modprobe.conf'' : | + | <file txt /etc/modprobe.d/notip_tables.conf> |
| - | <file>alias ipv6 off</file> | + | blacklist ip_tables |
| + | </file> | ||
| + | |||
| + | ==== Laden des Moduls blockieren ==== | ||
| + | <file txt /etc/modprobe.d/nodummy.conf> | ||
| + | alias dummy off | ||
| + | </file> | ||
| + | oder | ||
| + | <file txt /etc/modprobe.d/nodummy.conf> | ||
| + | install dummy /bin/false | ||
| + | </file> | ||
| ==== Module beim Starten laden ==== | ==== Module beim Starten laden ==== | ||
| Zeile 67: | Zeile 77: | ||
| === dauerhaft === | === dauerhaft === | ||
| - | ''/etc/modprobe.d/dummy_params'' : | + | ''/etc/modprobe.d/z_dummy_params.conf'' : |
| (( veraltet: | (( veraltet: | ||
| - | ''/etc/modprobe.conf'' : | + | ''/etc/modprobe.conf'' |
| + | |||
| + | https://www.debian.org/releases/stable/amd64/release-notes/ch-information.de.html | ||
| + | |||
| + | |||
| + | Admins who were depending on different values will need to ensure they are set in the correct way to take precedence. A file in /etc/modprobe.d will override one with the same name under /lib/modprobe.d, but the names are processed in alphabetical order, so /lib/modprobe.d/systemd.conf follows and overrides (for instance) /etc/modprobe.d/dummy.conf. Make sure that any local configuration file has a name that sorts after „systemd.conf“, such as „/etc/modprobe.d/zz-local.conf“. | ||
| )) | )) | ||
| <file>options dummy numdummies=2</file> | <file>options dummy numdummies=2</file> | ||
| Zeile 141: | Zeile 156: | ||
| * http://wiki.centos.org/HowTos/BuildingKernelModules | * http://wiki.centos.org/HowTos/BuildingKernelModules | ||
| - | ===== Eigenes Kernel-Modul schreiben ===== | + | ====== Kernel kompilieren ====== |
| - | Keine Angst, nur ein ganz einfaches "Hello World" Beispiel ... | + | [[lpi2::kernel_kompilieren]] |
| - | ==== Debian ==== | + | |
| - | + | ||
| - | cd | + | |
| - | aptitude install linux-source-xxx | + | |
| - | tar xjf /usr/src/linux-source-xxx | + | |
| - | mkdir hello | + | |
| - | vi hello.c | + | |
| - | <file> | + | |
| - | #include <linux/init.h> | + | |
| - | #include <linux/module.h> | + | |
| - | #include <linux/kernel.h> | + | |
| - | + | ||
| - | static int hello_init(void) | + | |
| - | { | + | |
| - | printk(KERN_ALERT "Hello World!\n"); | + | |
| - | return 0; | + | |
| - | } | + | |
| - | + | ||
| - | static void hello_exit(void) | + | |
| - | { | + | |
| - | printk(KERN_ALERT "Good bye world!\n"); | + | |
| - | } | + | |
| - | + | ||
| - | module_init(hello_init); | + | |
| - | module_exit(hello_exit); | + | |
| - | + | ||
| - | + | ||
| - | MODULE_LICENSE("GPL"); | + | |
| - | MODULE_AUTHOR("me"); | + | |
| - | </file> | + | |
| - | + | ||
| - | vi Makefile | + | |
| - | <file> | + | |
| - | obj-m := hello.o | + | |
| - | </file> | + | |
| - | make -C ../linux-source-2.6.18/ SUBDIRS=$PWD modules | + | |
| ====== Neuen Kernel installieren ====== | ====== Neuen Kernel installieren ====== | ||
| Zeile 191: | Zeile 170: | ||
| Mögliche Einstellungen sind in der Kerneldokumentation in der Datei ''[[http://kernel.org/doc/Documentation/filesystems/proc.txt|Documentation/filesystems/proc.txt]]'' beschrieben. Hier ein paar Beispiele: | Mögliche Einstellungen sind in der Kerneldokumentation in der Datei ''[[http://kernel.org/doc/Documentation/filesystems/proc.txt|Documentation/filesystems/proc.txt]]'' beschrieben. Hier ein paar Beispiele: | ||
| - | Auf sehr hoch belasteten Servern kann es Sinn machen, die Anzahl der gleichzeitig geöffneten Dateien zu erhöhen: | + | === Maximale PID === |
| - | ''/etc/sysctl.conf'' : | + | Maximale PID anzeigen: |
| - | <file> | + | sysctl kernel.pid_max |
| - | fs.file-max = 16384 | + | |
| - | kernel.threads-max = 2048 | + | Aktuelle PID ermitteln: |
| + | cat & | ||
| + | kill 19477 | ||
| + | |||
| + | Maximale PID ändern (kleiner als die grade ermittelte): | ||
| + | sysctl kernel.pid_max=18000 | ||
| + | cat & | ||
| + | kill %1 | ||
| + | |||
| + | === IPv4-Pingantworten ausschalten === | ||
| + | (( Defaults in ''/usr/lib/sysctl.d/*'' (CentOS 7) )) | ||
| + | |||
| + | <file txt /etc/sysctl.conf> | ||
| + | net.ipv4.icmp_echo_ignore_all=1 | ||
| </file> | </file> | ||
| sysctl -p | sysctl -p | ||
| - | Wenn das System nicht mehr reagiert ( z.B. überhohe Last, X Absturz ) gibt es als letzte Rettung oft nur die "magischen" Tastenkombinationen aus ALTGr + SysRq + Buchstabe ((Die vollständige Liste der Befehle steht in der Kerneldokumentation in der Datei ''[[http://kernel.org/doc/Documentation/sysrq.txt|Documentation/sysrq.txt]]'' )): | + | oder |
| + | <file txt /etc/sysctl.d/test.conf> | ||
| + | net.ipv4.icmp_echo_ignore_all=1 | ||
| + | </file> | ||
| + | |||
| + | sysctl -p /etc/sysctl.d/test.conf | ||
| + | |||
| + | Testen: | ||
| + | ping localhost | ||
| + | |||
| + | ===== sysrq ===== | ||
| + | Wenn das System nicht mehr reagiert ( z.B. überhohe Last, X Absturz ) gibt es als letzte Rettung oft nur die "magischen" Tastenkombinationen aus ALTGr + SysRq + Buchstabe. Wobei "SysRq" die "Druck"-, bzw. "S-Abf"-Taste meint.((Die vollständige Liste der Befehle steht in der Kerneldokumentation in der Datei ''[[https://www.kernel.org/doc/Documentation/admin-guide/sysrq.rst|Documentation/sysrq.txt]]'' )): | ||
| + | |||
| + | | Buchstabe | Funktion | | | ||
| + | |h|Hilfe zu den SysRq Keys anzeigen|help | | ||
| + | |e|Allen Prozessen ( außer init ) das Signal TERM schicken| tErm| | ||
| + | |i|Allen Prozessen ( außer init ) das Signal KILL schicken| kIll| | ||
| + | |s|Alle gemounteten Dateisysteme syncen| Sync| | ||
| + | |u|Alle Dateisysteme umounten| Umount| | ||
| + | |b|System _sofort_ rebooten| reBoot| | ||
| + | |o|System _sofort_ ausschalten| powerOff| | ||
| + | |k|Alle Prozesse dieses Terminals killen| KillTTY| | ||
| - | | Buchstabe | Funktion | | + | * //Eselsbrücken: BUSTIER// <- (dann allerdings von Hinten nach Vorne) |
| - | |h|Hilfe zu den SysRq Keys anzeigen| | + | * //SUB// - hektisches Notaus |
| - | |e|Allen Prozessen ( außer init ) das Signal TERM schicken| | + | * ''K'' ist sehr nützlich, um die grafische Oberfläche zu beenden. (Ersatz für Ctrl+Alt+Backspace) |
| - | |i|Allen Prozessen ( außer init ) das Signal KILL schicken| | + | |
| - | |s|Alle gemounteten Dateisysteme syncen| | + | |
| - | |u|Alle Dateisysteme umounten| | + | |
| - | |b|System _sofort_ rebooten| | + | |
| - | |o|System _sofort_ ausschalten| | + | |
| sysctl -w 'kernel.sysrq=1' | sysctl -w 'kernel.sysrq=1' | ||
| Zeile 216: | Zeile 224: | ||
| Diese Einstellungen rebootfest machen: | Diese Einstellungen rebootfest machen: | ||
| - | ''/etc/sysctl.conf'' : | + | ''/etc/sysctl.d/kernel.conf'' : |
| <file> | <file> | ||
| kernel.sysrq = 1 | kernel.sysrq = 1 | ||