RME
Advanced Hacker
Hallo,
Es kann bekanntlich vorkommen dass ein System plötzlich einfriert und nicht mehr auf Tastatur oder Maus reagiert. Dann gibt es leider öfter nur noch die Methode, via Netzschalter "brutal" abzuschalten (oder den Reset-Knopf betätigen). Dies ist "brutal" vor allem weil die Festplatten so nicht ordnungsgemäss zuerst mit "umount" vor möglichem Schaden der Filesysteme geschützt werden.
Eine "Lösung" ist in solchen Fällen (sofern im Kernel implementiert) der "Magic SysRQ Key" -- ich möchte hier kurz darüber berichten und aber gleichzeitig Fragen ob diese Methode unbedenklich ist.
Zuerst die Methode:
Wenn das System eingefroren ist, folgende Tastenkombinationen in der gezeigten Reihenfolge eingeben:
Je nach Tastatur Belegung ist "PrntScreen" == "SysRq" == "Druck/S-Abf"
Oder vielleicht funktioniert (wenn das root-Filesystem eingefroren ist):
Hier noch ein paar Infos.:
176 = 128 + 32 + 16
Vielleichts interessierts? Wäre an Kommentaren (bez. Sicherheit etc. dieser Methode) interresiert.
Gruss,
Roland
Nachtrag: das "interessante" ist ja dass dies funktioniert ohne root-Rechte!!!
Es kann bekanntlich vorkommen dass ein System plötzlich einfriert und nicht mehr auf Tastatur oder Maus reagiert. Dann gibt es leider öfter nur noch die Methode, via Netzschalter "brutal" abzuschalten (oder den Reset-Knopf betätigen). Dies ist "brutal" vor allem weil die Festplatten so nicht ordnungsgemäss zuerst mit "umount" vor möglichem Schaden der Filesysteme geschützt werden.
Eine "Lösung" ist in solchen Fällen (sofern im Kernel implementiert) der "Magic SysRQ Key" -- ich möchte hier kurz darüber berichten und aber gleichzeitig Fragen ob diese Methode unbedenklich ist.
Zuerst die Methode:
Wenn das System eingefroren ist, folgende Tastenkombinationen in der gezeigten Reihenfolge eingeben:
Code:
Alt+PrntScreen+s
Alt+PrntScreen+u
Alt+PrntScreen+b
Oder vielleicht funktioniert (wenn das root-Filesystem eingefroren ist):
Code:
Alt+PrntScreen+j
oder (die zweite Variante):s = sync alle Filesysteme
u = remount alle Filesysteme read-only (nur lesen)
b = reboot
Die erste Methode habe ich getestet... es scheint zu funktionieren. In der "/var/log/messages" Datei fand ich dann die (vermutlich relevanten) Zeilen:j = taut (unfreeze) ein eingefronenes Filesystem auf (mit "ioctl(fd, FITHAW, 0);")
Code:
# cat /var/log/messages
...
Dec 8 16:28:52 linux-ddia kernel: [ 6971.982345] SysRq : Emergency Sync
Dec 8 16:28:52 linux-ddia kernel: [ 6971.982696] Emergency Sync complete
Dec 8 16:28:58 linux-ddia kernel: [ 6977.150284] SysRq : Emergency Remount R/O
...
Code:
> cat /etc/sysconfig/sysctl
...
...
## Path: System/Kernel
## Description:
## Type: string
#
# Magic SysRq Keys enable some control over the system even if it
# crashes (e.g. during kernel debugging).
#
# Possible values:
# - no: disable sysrq completely
# - yes: enable all functions of sysrq
# - bitmask of allowed sysrq functions:
# 2 - enable control of console logging level
# 4 - enable control of keyboard (SAK, unraw)
# 8 - enable debugging dumps of processes etc.
# 16 - enable sync command
# 32 - enable remount read-only
# 64 - enable signalling of processes (term, kill, oom-kill)
# 128 - allow reboot/poweroff
# 256 - allow nicing of all RT tasks
#
# For further information see /usr/src/linux/Documentation/sysrq.txt
#
ENABLE_SYSRQ="176"
>
Code:
> cat /proc/sys/kernel/sysrq
176
>
Code:
> cat /usr/src/linux/Documentation/sysrq.txt
(...Auszug...)
* What is the magic SysRq key?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is a 'magical' key combo you can hit which the kernel will respond to
regardless of whatever else it is doing, unless it is completely locked up.
'b' - Will immediately reboot the system without syncing or unmounting your disks.
'j' - Forcibly "Just thaw it" - filesystems frozen by the FIFREEZE ioctl.
'o' - Will shut your system off (if configured and supported).
's' - Will attempt to sync all mounted filesystems.
't' - Will dump a list of current tasks and their information to your console.
'u' - Will attempt to remount all mounted filesystems read-only.
re'B'oot is good when you're unable to shut down. But you should also 'S'ync
and 'U'mount first.
"'J'ust thaw it" is useful if your system becomes unresponsive due to a frozen
(probably root) filesystem via the FIFREEZE ioctl.
>
Gruss,
Roland
Nachtrag: das "interessante" ist ja dass dies funktioniert ohne root-Rechte!!!