What to do if Linux crashes

Today, I found an interesting article on Linuxgem.org and share it with you.

{Via http://blog.upsuper.org.cn/what-to-do-if-linux-crash/}

 

Will Linux crash? I can say with certainty, yes! It is easy to make Linux crash, but the difficulty is how to safely let him get rid of the crash state after crashing. This article describes how to break free from the crash state of Linux.

 

There are many situations in Linux crash, the most common one is caused by high system load. Such as the fork ' introduced last time is this principle, in addition, it can also run programs that consume a lot of memory (such as virtual machines), and it will quickly increase the system load. The stuck caused by the high system load must be solved as soon as possible! It has to be remembered at this point that you can no longer try to rely on anything graphical like Gnome's System Monitor (it's a stupid habit I have left over from Windows...), this will only continue to exacerbate this stuck situation . What to do then?

 

Don't be afraid, Linux does not need a graphical interface at first, because there is a very powerful text interface. Press Ctrl-Alt-F1 (F1-F6 is generally OK), then wait for a while, it will switch to tty, which is the so-called text interface. At this time, you need to log in with a username and password. Note that the keyboard input speed may be slower, but it should still be tolerable. Next, enter top and press Enter after the prompt, and you will see a dynamic table listing the processes that consume the most resources. Watch it refresh once or twice, press q to exit, then type kill, the PID of which you can see in top. It should be a lot faster at this time. If you find that it does not end successfully, enter kill -KILL again, and this time it is basically no problem.

 

In addition to the above situation, some low-level software bugs may also cause some strange crashes. One of my classmates recently injured the ext4 partition because of an inexplicable crash forced to restart. (In the end, sysreccd was repaired, and it seems that the partition table is partially damaged.) According to it, the crash is that the keyboard and mouse do not respond. Generally speaking, the crash caused by high system load will also react on the terrible keyboard. Some people say that if the system crashes until the keyboard does not respond, "the load is infinite", and some people say that this may be caused by the problem of the X Server and the driver. . But let's think about what to do in this situation?

 

OK, this is the method I just learned today, called reisub, which can safely restart the computer in various situations. If you look for it on the keyboard, you can find a key called "Sys Rq", which is usually shared with Prt Sc on the keyboard of the desktop computer, and may be in other positions, such as Delete, on the notebook. Take a desktop computer as an example, to use this method, you need to hold down Alt-Print (Sys Rq), then press the reisub keys in turn, and the system will restart after pressing b.

 

Let's explain this method: In fact, Sys Rq is a thing called system request. When pressing Alt-Print, it is equivalent to holding down the Sys Rq key. Everything entered at this time will be directly processed by the Linux kernel, which can Do many low-level operations. At this time, each letter in reisub is an independent operation, and they represent:

unRaw takes keyboard control back from the X Server

tErminate sends a SIGTERM signal to all processes and lets them deal with the aftermath themselves

kIll sends a SIGKILL signal to all processes, forcing them to shut down immediately

Sync syncs all data to disk

Unmount mounts all partitions in read-only mode

reBoot restart

The sequence of these 6 letters cannot be mistaken. How to remember? Here is a method that I think is better: the word busier (comparative of busy, busier) is reversed.

 

That's basically it, Linux crashes are rare in the first place, and now it can be solved safely, how wonderful~

 

Original: https://linuxtoy.org/archives/what-to-do-if-linux-crash.html

 

Although the Unity desktop crashes. Direct ctrl-alt-f1, switch to tty1, know that the desktop uses tty7, after unity, ubuntu abandoned gnome's gdm and used lightdm, so, in tty1 command line mode, enter the user name password login,

sudo service lightdm stop

 

completion,

sudo service lightdm start

 

Finished, ctrl-alt-f7, the switch will be tty7 graphical interface,

 

 

From: What to do if Linux crashes

 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326891205&siteId=291194637