No operating system is available to ensure 100% reliability. One day, even Linux cannot start. This article provides you with some policies used when the Linux workstation cannot start normally.
No matter how much you like your Linux machine, sometimes you have to restore your system. Yes, even a Linux machine may suffer a system crash: whether it is due to video configuration errors, kernel update errors, or init script configuration errors, this situation is inevitable. I have seen a lot of such cases-even on my own machine, most of them are caused by X configuration errors-which is indeed frustrating.
Use the correct running level
After installing a new Linux system, I immediately took measures to ensure that the disaster would not happen easily. One of the measures is to edit the system running level. The running level tells the system how far it is from the boot process. The running level is divided into six levels:
Level 0: Stop (initdefault is not set)
Level 1: single-user mode
Level 2: multi-user mode, no NFS (same as Level 3, if you do not have a network)
Level 3: Complete Multi-User Mode
Level 4: not used
Level 5: X11
Level 6: restart (initdefault is not set)
The new Linux system almost always uses the runtime Level 5 (X11) by default, indicating that the system will stop at the graphic logon interface after the boot is complete. The system works normally before something (or someone) uses X configuration.
Then you must find a logon method. You can press [Ctrl] [Alt] [F7] to enter a text-based virtual window, but why is it so troublesome? On the contrary, I always change the running level to 3 in the/etc/inittab file. The code you changed is:
Id: 5: initdefault:
It is changed:
Id: 3: initdefault:
When X fails, this is a very simple system recovery method.
Multiple kernels
Another obvious method for disk recovery is to always install a running kernel. I usually work on a kernel updated through yum. Sometimes, some Kernel errors make it impossible for one or more of my machines to start.
To avoid this situation, I always ensure that at least one running kernel is used on the machine. To solve this problem, you must first go to/etc/yum. add plugins = 1 to the conf file, apply the script, name it a n-installonly.py, and save it in the/usr/lib/yum-plugins file. You can update the number of kernels used by the system by modifying the tookeep variable (2 by default.
Knowing that the system has a running kernel, you can perform a security upgrade. If an error occurs in the new kernel, you only need to start the old kernel to solve the problem on the new kernel (whether delete, re-compile or upgrade ).