What should I do when the Ubuntu system crashes?

Source: Internet
Author: User
What if the Ubuntu system crashes? Here are some solutions: temporarily enable the shortcut key sudosuecho1/proc/sys/kernel/sysrq for long-term use and editing/etc/sysctl. conf sets kernel. sysrq1 if X is dead, LeftAlt + SysRq + R takes the keyboard from X and LeftAlt + SysRq + K restarts X if

What if the Ubuntu system crashes? Here are some solutions:

Temporarily enable shortcuts

Sudo su
Echo "1">/proc/sys/kernel/sysrq

Edit long-term use
/Etc/sysctl. conf
Set

Kernel. sysrq = 1

If X is dead
Left Alt + SysRq + R take the keyboard from X
Left Alt + SysRq + K restart X

For other reasons, such as the debug
Use an invincible "REISUB"
Tip: "Reboot Even If System Utterly Broken"
Left Alt + SysRq + R take the keyboard from X
Left Alt + SysRq + E terminate all processes
Left Alt + SysRq + I force stop all processes
Left Alt + SysRq + S sync hard disk data
Left Alt + SysRq + U unmount and read-only mount all file systems.
Left Alt + SysRq + B restart

The magic keys for Linux are listed below. I believe it is more convenient for you to understand and use them.

My computer crashes from time to time after I switched to the open-source a card driver. The phenomenon is: suddenly, the entire screen is frozen, the mouse cannot be moved, and almost all the buttons are invalid, ctrl + alt + F1 and ctrl + alt + backspace are invalid. This usually occurs when there is an irregular window, such as the transparent text of gnome-osd, but it is not very certain, and the probability of occurrence is not high, it usually takes a few days. I think, to solve it completely, we can only wait for the improvement of the driver.

However, if the power is forcibly pressed every time a crash occurs, it is still a bit heartache. Fortunately, there are still some ways, because the driver is actually just a program. at this time, even if the driver dies, the mouse and keyboard cannot be moved, the Linux kernel is still running normally (if I open sshd, other machines can still use ssh ). Moreover, the kernel can still handle some keyboard events, such as the MagicSystem Request Key.

The following buttons are generally not recommended unless ctrl + alt + F1 is invalid.

The premise of using Magic SysRqkey is that the CONFIG_MAGIC_SYSRQ kernel option is turned on and not disabled in/proc/sys/kernel/sysrq, that is, when the file is cat, the value is 1 (or some other non-0 values ). In fact, these two conditions are met in general linux distributions. The following describes the specific functions of several keys. SysRq refers to the "Print Screen" key in the upper right corner.

ALT-SysRq-B immediately restarts the system without uninstalling partitions and synchronizing files.
ALT-SysRq-c can call the kexec kernel function to restart and generate a crashdump.
ALT-SysRq-d shows all the "locks". if X is enabled, it is estimated that no "locks" are displayed.
ALT-SysRq-e sends SIGTERM signals to all processes except init, and can try to end all processes normally.
ALT-SysRq-f calls the oom_kill function to kill processes that occupy a large amount of memory.
ALT-SysRq-g kernel debugging related (as if the new kernel is gone ?).
ALT-SysRq-h shows the help of other keys. Similarly, if X is enabled, it is estimated that no help is displayed.
ALT-SysRq-I sends a SIGKILL signal to all processes except init.
ALT-SysRq-k ends all processes of the current virtual terminal.
ALT-SysRq-l displays stack trace information for all active CPUs.
ALT-SysRq-m shows the memory status.
ALT-SysRq-n
If ALT-SysRq-o is possible, shut down.
ALT-SysRq-p displays the current register status and flag bit.
ALT-SysRq-r disable the raw mode of the keyboard.
ALT-SysRq-s synchronizes data in the memory to the hard disk.
ALT-SysRq-t: displays information about the current task.
ALT-SysRq-u re-mount all partitions in read-only mode.
ALT-SysRq-v
ALT-SysRq-w: displays non-interrupted tasks
ALT-SysRq-x
ALT-SysRq-z
ALT-SysRq-numeric key adjustment log output level

In addition to physical buttons, in fact, you can also write the value of a key to the/proc/sysrq-trigger file with the root permission (this file is a strange file that can only be written but not read, haha), such

Echo t>/proc/sysrq-trigger

To trigger the Magic SysRq key.

The above content can be found in the kernel source code Documentation/sysrq.txt

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.