Magic sysrq key

When I hit a SysRq key combination only the header appears on the console?¶

Sysrq output is subject to the same console loglevel control as all
other console output. This means that if the kernel was booted ‘quiet’
as is common on distro kernels the output may not appear on the actual
console, even though it will appear in the dmesg buffer, and be accessible
via the dmesg command and to the consumers of . As a specific
exception the header line from the sysrq command is passed to all console
consumers as if the current loglevel was maximum. If only the header
is emitted it is almost certain that the kernel loglevel is too low.
Should you require the output on the console channel then you will need
to temporarily up the console loglevel using or:

echo 8 > /proc/sysrq-trigger

How do I enable the magic SysRq key?¶

You need to say “yes” to ‘Magic SysRq key (CONFIG_MAGIC_SYSRQ)’ when
configuring the kernel. When running a kernel with SysRq compiled in,
/proc/sys/kernel/sysrq controls the functions allowed to be invoked via
the SysRq key. The default value in this file is set by the
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE config symbol, which itself defaults
to 1. Here is the list of possible values in /proc/sys/kernel/sysrq:

You can set the value in the file by the following command:

echo "number" >/proc/sys/kernel/sysrq

The number may be written here either as decimal or as hexadecimal
with the 0x prefix. CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE must always be
written in hexadecimal.

Волшебная клавиша SysRq / Printscreen

Select LanguageEnglishGermanFrenchSpanishPortugueseChineseArabicItalianKoreanJapanese

начинающим,
системное

Достаточно редко, когда я провожу над своей системой бесчеловечные ядерные эксперименты, она зависает наглухо — ничто не совершенно в этом мире. Именно для этих целей в ядре Линукс имеется замечательная возможность: Волшебная клавиша SysRq или Magic SysRq Key.Что это такое?Если внимательно посмотреть на клавиатуру, там обнаружится кнопка PrtSc / SysRq. Подавляющее большинство пользователей Windows полагают, что она специально присутствует на клавиатуре для скриншотов. Однако кнопка Magic SysRq Key появилась на клавиатурах задолго до Microsoft.На самом деле эта клавиша — наша единственная прямая связь с ядром, которая работает всегда. При помощи некоторых комбинаций клавиш можно заставить систему аварийно сбросить данные на диски, размонтировать все файловые системы в режим «только-чтение» и перезагрузиться даже при наглухо зависшей системе.

Magic SysRq это комбинация клавиш, напрямую перехватываемая ядром и может быть использована для аварийного выключения. Так как Magic SysRq выполнена как часть драйвера клавиатуры, она гарантировано работает всегда — или почти всегда, если только ядро само по себе работоспособно.Как ей пользоваться?Сначала нужно убедиться, что она включена: в конфиге ядра CONFIG_MAGIC_SYSRQ должно иметь значение Y (по крайней мере в дефолтном ядре Дебиана это так). Дальше применение такое: нажимаем и держим ALT, нажимаем SysRq, отпускаем всё и нажимаем одну из «командных» клавиш — ниже их краткое описание.Командные клавишиНиже перечислены наиболее полезные клавиши, которые могут пригодиться для тех, кто проводит бесчеловечные эксперименты над системой или устанавливает проприетарные драйвера. Чтобы их легче было запомнить, будет написано слово, в котором эта буква есть по смыслу. Всё сказанное ниже актуально по крайней мере для ядер 2.6.20 и выше.Одновременное нажатие клавиш Alt + SysRq + То есть, например, для аварийной синхронизации данных жмём ALT+SysRq + s, далее ALT+SysRq + u и после этого можно жать на ресет или, что тоже самое ALT+SysRq+bСсылкиПомимо документации к ядру, можно почитать об этом тут и здесь.

I want to add SysRQ key events to a module, how does it work?¶

In order to register a basic function with the table, you must first include
the header , this will define everything else you need.
Next, you must create a struct, and populate it with A) the key
handler function you will use, B) a help_msg string, that will print when SysRQ
prints help, and C) an action_msg string, that will print right before your
handler is called. Your handler must conform to the prototype in ‘sysrq.h’.

After the is created, you can call the kernel function
this will
register the operation pointed to by at table key ‘key’,
if that slot in the table is blank. At module unload time, you must call
the function , which
will remove the key op pointed to by ‘op_p’ from the key ‘key’, if and only if
it is currently registered in that slot. This is in case the slot has been
overwritten since you registered it.

The Magic SysRQ system works by registering key operations against a key op
lookup table, which is defined in ‘drivers/tty/sysrq.c’. This key table has
a number of operations registered into it at compile time, but is mutable,
and 2 functions are exported for interface to it:

register_sysrq_key and unregister_sysrq_key.

Of course, never ever leave an invalid pointer in the table. I.e., when
your module that called register_sysrq_key() exits, it must call
unregister_sysrq_key() to clean up the sysrq key table entry that it used.
Null pointers in the table are always safe. 🙂

Okay, so what can I use them for?¶

Well, unraw(r) is very handy when your X server or a svgalib program crashes.

sak(k) (Secure Access Key) is useful when you want to be sure there is no
trojan program running at console which could grab your password
when you would try to login. It will kill all programs on given console,
thus letting you make sure that the login prompt you see is actually
the one from init, not some trojan program.

Important

In its true form it is not a true SAK like the one in a
c2 compliant system, and it should not be mistaken as
such.

It seems others find it useful as (System Attention Key) which is
useful when you want to exit a program that will not let you switch consoles.
(For example, X or a svgalib program.)

is good when you’re unable to shut down. But you should also
and first.

can be used to manually trigger a crashdump when the system is hung.
Note that this just triggers a crash if there is no dump mechanism available.

is great when your system is locked up, it allows you to sync your
disks and will certainly lessen the chance of data loss and fscking. Note
that the sync hasn’t taken place until you see the “OK” and “Done” appear
on the screen. (If the kernel is really in strife, you may not ever get the
OK or Done message…)

is basically useful in the same ways as . I generally
, , then when my system locks. It’s saved
me many a fsck. Again, the unmount (remount read-only) hasn’t taken place until
you see the “OK” and “Done” message appear on the screen.

The loglevels — are useful when your console is being flooded with
kernel messages you do not want to see. Selecting will prevent all but
the most urgent kernel messages from reaching your console. (They will
still be logged if syslogd/klogd are alive, though.)

and are useful if you have some sort of runaway process
you are unable to kill any other way, especially if it’s spawning other
processes.

How do I enable the magic SysRq key?¶

You need to say “yes” to ‘Magic SysRq key (CONFIG_MAGIC_SYSRQ)’ when
configuring the kernel. When running a kernel with SysRq compiled in,
/proc/sys/kernel/sysrq controls the functions allowed to be invoked via
the SysRq key. The default value in this file is set by the
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE config symbol, which itself defaults
to 1. Here is the list of possible values in /proc/sys/kernel/sysrq:

You can set the value in the file by the following command:

echo "number" >/proc/sys/kernel/sysrq

The number may be written here either as decimal or as hexadecimal
with the 0x prefix. CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE must always be
written in hexadecimal.

How do I enable the magic SysRq key?¶

You need to say «yes» to ‘Magic SysRq key (CONFIG_MAGIC_SYSRQ)’ when
configuring the kernel. When running a kernel with SysRq compiled in,
/proc/sys/kernel/sysrq controls the functions allowed to be invoked via
the SysRq key. The default value in this file is set by the
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE config symbol, which itself defaults
to 1. Here is the list of possible values in /proc/sys/kernel/sysrq:

You can set the value in the file by the following command:

echo "number" >/proc/sys/kernel/sysrq

The number may be written here either as decimal or as hexadecimal
with the 0x prefix. CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE must always be
written in hexadecimal.

Okay, so what can I use them for?¶

Well, unraw(r) is very handy when your X server or a svgalib program crashes.

sak(k) (Secure Access Key) is useful when you want to be sure there is no
trojan program running at console which could grab your password
when you would try to login. It will kill all programs on given console,
thus letting you make sure that the login prompt you see is actually
the one from init, not some trojan program.

Important

In its true form it is not a true SAK like the one in a
c2 compliant system, and it should not be mistaken as
such.

It seems others find it useful as (System Attention Key) which is
useful when you want to exit a program that will not let you switch consoles.
(For example, X or a svgalib program.)

is good when you’re unable to shut down. But you should also
and first.

can be used to manually trigger a crashdump when the system is hung.
Note that this just triggers a crash if there is no dump mechanism available.

is great when your system is locked up, it allows you to sync your
disks and will certainly lessen the chance of data loss and fscking. Note
that the sync hasn’t taken place until you see the “OK” and “Done” appear
on the screen. (If the kernel is really in strife, you may not ever get the
OK or Done message…)

is basically useful in the same ways as . I generally
, , then when my system locks. It’s saved
me many a fsck. Again, the unmount (remount read-only) hasn’t taken place until
you see the “OK” and “Done” message appear on the screen.

The loglevels — are useful when your console is being flooded with
kernel messages you do not want to see. Selecting will prevent all but
the most urgent kernel messages from reaching your console. (They will
still be logged if syslogd/klogd are alive, though.)

and are useful if you have some sort of runaway process
you are unable to kill any other way, especially if it’s spawning other
processes.

Включить

Чтобы сделать доступной волшебную комбинацию SysRq, ваше ядро
должно быть скомпилировано с опцией CONFIG_MAGIC_SYSRQ. Большинство
дистрибутивов по умолчанию включают её. Если же это не так, то вам
надо его просто перекомпилировать… 🙂

[Прим.ред. — это автор так шутит. Вряд ли сборку ядра можно
отнести к категории «просто». 😉 Но, как правило, создатели
дистрибутивов включают эту опцию. А теперь то, что касается
собственно пересборки. В настоящий момент Kernel-HOWTO находится на
пересмотре. Этим занимается Kwan Lowe. В дальнейшем документ будет
называться Kernel Rebuild Guide. Более-менее законченный вариант в
настоящий момент доступен по адресу
http://www.digitalhermit.com/~kwan/kernel.html
К этому можно добавить, что Brian Ward, автор оригинального Kernel
HOWTO, планирует опубликовать альтернативную версию этого
документа.]

После того, как закончите с ядром, проверьте — разрешена ли
SysRq по умолчанию.

$ cat /proc/sys/kernel/sysrq
0

Если вы видите 0 — значит не разрешена. Запишите любое ненулевое
число в файл /proc/sys/kernel/sysrq, чтобы разрешить её.

$ echo "1" > /proc/sys/kernel/sysrq

Для того чтобы она всегда была разрешена, добавьте эти строки в
один из ваших инициализационных скриптов (предпочтительно в
rc.local).

#Enable SysRq
echo -e "Enabling SysRq\n"
echo "1" > /proc/sys/kernel/sysrq

Как альтернативный вариант вы можете использовать файл
/etc/sysctl или /etc/sysctl.conf, если такой присутствует в вашем
дистрибутиве (например, у меня в RedHat такой файл есть). Для
включения sysrq добавьте в него следующую строку:

kernel.sysrq = 1

Волшебная комбинация SysRq уникальна. Каждая клавиша при нажатии
или отпускании генерирует код, называемый скан-кодом. Не смотря на
то, что для волшебной комбинации SysRq используется две клавиши
(Alt+SysRq), посылается только один скан-код (0x54,
десятичное 84). Можете проверить это при помощи команды
.

How do I enable the magic SysRq key?¶

You need to say “yes” to ‘Magic SysRq key (CONFIG_MAGIC_SYSRQ)’ when
configuring the kernel. When running a kernel with SysRq compiled in,
/proc/sys/kernel/sysrq controls the functions allowed to be invoked via
the SysRq key. The default value in this file is set by the
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE config symbol, which itself defaults
to 1. Here is the list of possible values in /proc/sys/kernel/sysrq:

You can set the value in the file by the following command:

echo "number" >/proc/sys/kernel/sysrq

The number may be written here either as decimal or as hexadecimal
with the 0x prefix. CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE must always be
written in hexadecimal.

I want to add SysRQ key events to a module, how does it work?¶

In order to register a basic function with the table, you must first include
the header , this will define everything else you need.
Next, you must create a struct, and populate it with A) the key
handler function you will use, B) a help_msg string, that will print when SysRQ
prints help, and C) an action_msg string, that will print right before your
handler is called. Your handler must conform to the prototype in ‘sysrq.h’.

After the is created, you can call the kernel function
this will
register the operation pointed to by at table key ‘key’,
if that slot in the table is blank. At module unload time, you must call
the function , which
will remove the key op pointed to by ‘op_p’ from the key ‘key’, if and only if
it is currently registered in that slot. This is in case the slot has been
overwritten since you registered it.

The Magic SysRQ system works by registering key operations against a key op
lookup table, which is defined in ‘drivers/tty/sysrq.c’. This key table has
a number of operations registered into it at compile time, but is mutable,
and 2 functions are exported for interface to it:

register_sysrq_key and unregister_sysrq_key.

Of course, never ever leave an invalid pointer in the table. I.e., when
your module that called register_sysrq_key() exits, it must call
unregister_sysrq_key() to clean up the sysrq key table entry that it used.
Null pointers in the table are always safe. 🙂

I want to add SysRQ key events to a module, how does it work?¶

In order to register a basic function with the table, you must first include
the header , this will define everything else you need.
Next, you must create a struct, and populate it with A) the key
handler function you will use, B) a help_msg string, that will print when SysRQ
prints help, and C) an action_msg string, that will print right before your
handler is called. Your handler must conform to the prototype in ‘sysrq.h’.

After the is created, you can call the kernel function
this will
register the operation pointed to by at table key ‘key’,
if that slot in the table is blank. At module unload time, you must call
the function , which
will remove the key op pointed to by ‘op_p’ from the key ‘key’, if and only if
it is currently registered in that slot. This is in case the slot has been
overwritten since you registered it.

The Magic SysRQ system works by registering key operations against a key op
lookup table, which is defined in ‘drivers/tty/sysrq.c’. This key table has
a number of operations registered into it at compile time, but is mutable,
and 2 functions are exported for interface to it:

register_sysrq_key and unregister_sysrq_key.

Of course, never ever leave an invalid pointer in the table. I.e., when
your module that called register_sysrq_key() exits, it must call
unregister_sysrq_key() to clean up the sysrq key table entry that it used.
Null pointers in the table are always safe. 🙂

When I hit a SysRq key combination only the header appears on the console?¶

Sysrq output is subject to the same console loglevel control as all
other console output. This means that if the kernel was booted ‘quiet’
as is common on distro kernels the output may not appear on the actual
console, even though it will appear in the dmesg buffer, and be accessible
via the dmesg command and to the consumers of . As a specific
exception the header line from the sysrq command is passed to all console
consumers as if the current loglevel was maximum. If only the header
is emitted it is almost certain that the kernel loglevel is too low.
Should you require the output on the console channel then you will need
to temporarily up the console loglevel using or:

echo 8 > /proc/sysrq-trigger

И как это использовать?

Волшебная SysRq вызывается как < Alt+SysRq > + <
клавиша >. (Напоминаю, что клавиша SysRq также обозначается как
Print Screen). В сочетании с < Alt+SysRq > можно использовать
следующие клавиши:

k: Клавиша безопасного доступа. Она убивает все процессы,
запущенные на текущей виртуальной консоли, так, чтобы никакая
излишне любопытная программа не могла захватить ваши нажатия
клавиш, в то время как Вы печатаете ваш пароль.

u: Попытка отмонтировать корневую файловую систему («/») и
перемонтировать её в режиме только-для-чтения. В
дополнение к экстренному выключению, эта команда может пригодится,
если у вас в Linux только один раздел и необходимо выполнить fsck
или низкоуровневое редактирование файловой системы (например,
восстановление удалённых файлов на файловой системе ext2. Смотрите
Ext2fs
Undeletion Howto (Прим.ред. — чтобы восстановить удалённые
файлы на ФС ext3 смонтируйте её как ext2.)

s: Эта команда сбрасывает содержимое буферов на диск. Это надо
сделать до размонтирования.

b: Производит непосредственную перезагрузку, прямо как кнопка
Reset. Для безопасного выключения необходимо предварительно
сбросить буферы и размонтировать систему.

p: Печатает содержимое регистров процессора.(Прим.перев. — право, мне, как программисту, непонятно —
зачем? Они ведь меняются с бешеной скоростью.)
(Прим.ред. — согласен

Обращаю ваше внимание, что информация
пишется в системные логи.)

m: Отображает информацию о памяти.

t: Отображает информацию о запущенных задачах.

0-9: Устанавливает указанный уровень вывода отладочной
информации для консоли.

e: Посылает сигнал SIGTERM (приказ завершить работу) всем
процессам кроме init.

i: Посылает сигнал SIGKILL(безусловное завершение) всем
процессам кроме init.

l: Посылает сигнал SIGKILL всем процессам, включая init (вы
ничего не сможете сделать после этого).

‘r’ — переключает клавиатуру из режима скан-кодов (raw mode) и
устанавливает в режим XLATE (8-битный ASCII режим) (Прим.перев.
— более подробно о режимах клавиатуры читайте в man kbd_mode или в
FAQ console-tools).

‘h’ — Отображает помощь (на самом деле, любая другая клавиша,
кроме указанных выше, вызовет справку. Но ‘h’ проще запомнить
🙂

When I hit a SysRq key combination only the header appears on the console?¶

Sysrq output is subject to the same console loglevel control as all
other console output. This means that if the kernel was booted ‘quiet’
as is common on distro kernels the output may not appear on the actual
console, even though it will appear in the dmesg buffer, and be accessible
via the dmesg command and to the consumers of . As a specific
exception the header line from the sysrq command is passed to all console
consumers as if the current loglevel was maximum. If only the header
is emitted it is almost certain that the kernel loglevel is too low.
Should you require the output on the console channel then you will need
to temporarily up the console loglevel using or:

echo 8 > /proc/sysrq-trigger

When I hit a SysRq key combination only the header appears on the console?¶

Sysrq output is subject to the same console loglevel control as all
other console output. This means that if the kernel was booted ‘quiet’
as is common on distro kernels the output may not appear on the actual
console, even though it will appear in the dmesg buffer, and be accessible
via the dmesg command and to the consumers of . As a specific
exception the header line from the sysrq command is passed to all console
consumers as if the current loglevel was maximum. If only the header
is emitted it is almost certain that the kernel loglevel is too low.
Should you require the output on the console channel then you will need
to temporarily up the console loglevel using or:

echo 8 > /proc/sysrq-trigger

kptr_restrict¶

This toggle indicates whether restrictions are placed on
exposing kernel addresses via and other interfaces.

When is set to 0 (the default) the address is hashed
before printing.
(This is the equivalent to %p.)

When is set to 1, kernel pointers printed using the
%pK format specifier will be replaced with 0s unless the user has
and effective user and group ids are equal to the real
ids.
This is because %pK checks are done at read() time rather than open()
time, so if permissions are elevated between the open() and the read()
(e.g via a setuid binary) then %pK will not leak kernel pointers to
unprivileged users.
Note, this is a temporary solution only.
The correct long-term solution is to do the permission checks at
open() time.
Consider removing world read permissions from files that use %pK, and
using to protect against uses of %pK in
if leaking kernel pointer values to unprivileged users is a concern.

I want to add SysRQ key events to a module, how does it work?¶

In order to register a basic function with the table, you must first include
the header , this will define everything else you need.
Next, you must create a struct, and populate it with A) the key
handler function you will use, B) a help_msg string, that will print when SysRQ
prints help, and C) an action_msg string, that will print right before your
handler is called. Your handler must conform to the prototype in ‘sysrq.h’.

After the is created, you can call the kernel function
this will
register the operation pointed to by at table key ‘key’,
if that slot in the table is blank. At module unload time, you must call
the function , which
will remove the key op pointed to by ‘op_p’ from the key ‘key’, if and only if
it is currently registered in that slot. This is in case the slot has been
overwritten since you registered it.

The Magic SysRQ system works by registering key operations against a key op
lookup table, which is defined in ‘drivers/tty/sysrq.c’. This key table has
a number of operations registered into it at compile time, but is mutable,
and 2 functions are exported for interface to it:

register_sysrq_key and unregister_sysrq_key.

Of course, never ever leave an invalid pointer in the table. I.e., when
your module that called register_sysrq_key() exits, it must call
unregister_sysrq_key() to clean up the sysrq key table entry that it used.
Null pointers in the table are always safe. 🙂

sched_util_clamp_min_rt_default:¶

By default Linux is tuned for performance. Which means that RT tasks always run
at the highest frequency and most capable (highest capacity) CPU (in
heterogeneous systems).

Uclamp achieves this by setting the requested uclamp.min of all RT tasks to
1024 by default, which effectively boosts the tasks to run at the highest
frequency and biases them to run on the biggest CPU.

This knob allows admins to change the default behavior when uclamp is being
used. In battery powered devices particularly, running at the maximum
capacity and frequency will increase energy consumption and shorten the battery
life.

This knob is only effective for RT tasks which the user hasn’t modified their
requested uclamp.min value via sched_setattr() syscall.

This knob will not escape the range constraint imposed by sched_util_clamp_min
defined above.

For example if

When I hit a SysRq key combination only the header appears on the console?¶

Sysrq output is subject to the same console loglevel control as all
other console output. This means that if the kernel was booted ‘quiet’
as is common on distro kernels the output may not appear on the actual
console, even though it will appear in the dmesg buffer, and be accessible
via the dmesg command and to the consumers of . As a specific
exception the header line from the sysrq command is passed to all console
consumers as if the current loglevel was maximum. If only the header
is emitted it is almost certain that the kernel loglevel is too low.
Should you require the output on the console channel then you will need
to temporarily up the console loglevel using or:

echo 8 > /proc/sysrq-trigger

I want to add SysRQ key events to a module, how does it work?¶

In order to register a basic function with the table, you must first include
the header , this will define everything else you need.
Next, you must create a struct, and populate it with A) the key
handler function you will use, B) a help_msg string, that will print when SysRQ
prints help, and C) an action_msg string, that will print right before your
handler is called. Your handler must conform to the prototype in ‘sysrq.h’.

After the is created, you can call the kernel function
this will
register the operation pointed to by at table key ‘key’,
if that slot in the table is blank. At module unload time, you must call
the function , which
will remove the key op pointed to by ‘op_p’ from the key ‘key’, if and only if
it is currently registered in that slot. This is in case the slot has been
overwritten since you registered it.

The Magic SysRQ system works by registering key operations against a key op
lookup table, which is defined in ‘drivers/tty/sysrq.c’. This key table has
a number of operations registered into it at compile time, but is mutable,
and 2 functions are exported for interface to it:

register_sysrq_key and unregister_sysrq_key.

Of course, never ever leave an invalid pointer in the table. I.e., when
your module that called register_sysrq_key() exits, it must call
unregister_sysrq_key() to clean up the sysrq key table entry that it used.
Null pointers in the table are always safe. 🙂

История

84-я клавиша, SysRq, была добавлена IBM в клавиатуру для IBM PC/AT для того, чтобы можно было вызывать низкоуровневые функции операционной системы без риска конфликта с любым существовавшим программным обеспечением. Было добавлено программное прерывание BIOS номер 0x15, подфункция 0x85, которое сообщало ОС о нажатии или отпускании клавиши SysRq. В отличие от большинства клавиш, нажатие SysRq не добавляло чего-либо в буфер клавиатуры (англ.)русск..

Специальная клавиша была создана, чтобы обойти различные низкоуровневые TSR программы, работающие с клавиатурой в обход ОС, например для реализации горячих клавиш.

Применение

В ОС Windows SysRq, нажатая вместе с Alt (т.е. PrtScr), копирует изображение активного окна в буфер обмена.

Компания Microsoft иногда использовала SysRq для различных отладчиков, как уровня ОС, так и уровня приложения. Некоторые версии отладчика CodeView использовали клавишу для прерывания программы во время исполнения и переключения в отладочный интерфейс. Удаленный отладчик ядра Windows NT использовал последовательность нажатий Ctrl+SysRq, Ctrl+SysRq для включения отладочного режима.

В ПК Hyundai/Hynix Super-16 нажатие Ctrl+SysRq приводит к холодной перезагрузке, в том числе, когда Ctrl+Alt+Del уже не работает.

Во встраиваемых системах изредка SysRq переключает сигнал RESET# в нижний уровень.

Безопасность

Делать доступной волшебную SysRq на работающей машине (сервере)
может быть потенциально опасным. Любой, у кого есть физический
доступ к машине, может «уронить» машину. Также необходимо запретить
SysRq, если другие люди могут удалённо зарегистрироваться на вашей
машине. Сигнал < break >, посланный с удалённой консоли,
будет интерпретирована как < Alt+SysRq >, и последствия могут
быть ужасны. Для получения дополнительной информации, смотрите Remote-Serial-Console-HOWTO.

(Прим.перев. — по адресу
http://www.ibiblio.org/pub/Linux/docs/HOWTO/translations/ru/html/
можно найти переводы на русский язык некоторых HOWTO. К сожалению
самые поздние из них датируются 2000-м годом, хотя большая часть из
них не потеряла своей актуальности и на сегодняшний день.)

watchdog_cpumask¶

This value can be used to control on which cpus the watchdog may run.
The default cpumask is all possible cores, but if is
enabled in the kernel config, and cores are specified with the
boot argument, those cores are excluded by default.
Offline cores can be included in this mask, and if the core is later
brought online, the watchdog will be started based on the mask value.

Typically this value would only be touched in the case
to re-enable cores that by default were not running the watchdog,
if a kernel lockup was suspected on those cores.

The argument value is the standard cpulist format for cpumasks,
so for example to enable the watchdog on cores 0, 2, 3, and 4 you
might say:

How do I enable the magic SysRq key?¶

You need to say “yes” to ‘Magic SysRq key (CONFIG_MAGIC_SYSRQ)’ when
configuring the kernel. When running a kernel with SysRq compiled in,
/proc/sys/kernel/sysrq controls the functions allowed to be invoked via
the SysRq key. The default value in this file is set by the
CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE config symbol, which itself defaults
to 1. Here is the list of possible values in /proc/sys/kernel/sysrq:

You can set the value in the file by the following command:

echo "number" >/proc/sys/kernel/sysrq

The number may be written here either as decimal or as hexadecimal
with the 0x prefix. CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE must always be
written in hexadecimal.

nmi_watchdog¶

This parameter can be used to control the NMI watchdog
(i.e. the hard lockup detector) on x86 systems.

Disable the hard lockup detector.
1 Enable the hard lockup detector.

The hard lockup detector monitors each CPU for its ability to respond to
timer interrupts. The mechanism utilizes CPU performance counter registers
that are programmed to generate Non-Maskable Interrupts (NMIs) periodically
while a CPU is busy. Hence, the alternative name ‘NMI watchdog’.

The NMI watchdog is disabled by default if the kernel is running as a guest
in a KVM virtual machine. This default can be overridden by adding:

nmi_watchdog=1
Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *