Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
TetraWiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Linux 101 hacks
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=='''Hack 75. Safe Reboot Of Linux Using Magic SysRq Key'''== The magic SysRq key is a key combination in the Linux kernel which allows the user to perform various low level commands regardless of the systemβs state. It is often used to recover from freezes, or to reboot a computer without corrupting the filesystem. The key combination consists of Alt+SysRq+commandkey. In many systems the SysRq key is the printscreen key. First, you need to enable the SysRq key, as shown below. echo "1" > /proc/sys/kernel/sysrq '''List of SysRq Command Keys''' Following are the command keys available for Alt+SysRq+commandkey. o βkβ β Kills all the process running on the current virtual console. o βsβ β This will attempt to sync all the mounted file system. # βbβ - Immediately reboot the system, without unmounting partitions or syncing. o βeβ β Sends SIGTERM to all process except init. o βmβ β Output current memory information to the console. o βiβ - Send the SIGKILL signal to all processes except init # βrβ - Switch the keyboard from raw mode (the mode used by programs such as X11), to XLATE mode. o βsβ β sync all mounted file system. # βtβ - Output a list of current tasks and their information to the console. o βuβ - Remount all mounted filesystems in readonly mode. o βoβ β Shutdown the system immediately. o βpβ β Print the current registers and flags to the console. # β0-9β² - Sets the console log level, controlling which kernel messages will be printed to your console. o βfβ - Will call oom_kill to kill process which takes more memory. # βhβ β Used to display the help. But any other keys than the above listed will print help. We can also do this by echoing the keys to the /proc/sysrq-trigger file. For example, to re-boot a system you can perform the following. echo "b" > /proc/sysrq-trigger '''Perform a Safe reboot of Linux using Magic SysRq Key''' To perform a safe reboot of a Linux computer which hangs up, do the following. This will avoid the fsck during the next re-booting. i.e Press Alt+SysRq+letter highlighted below. o un'''R'''aw (take control of keyboard back from X11, # t'''E'''rminate (send SIGTERM to all processes, allowing them to terminate gracefully), # '''k'''Ill (send SIGILL to all processes, forcing them to terminate''' '''immediately), o '''S'''ync (flush data to disk), o '''U'''nmount (remount all filesystems read-only), o re'''B'''oot.
Summary:
Please note that all contributions to TetraWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
TetraWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)