Method, device and equipment for recovering operating system based on baseboard management controller and medium
By monitoring and analyzing the operating system startup information flow through the baseboard management controller, the system automatically identifies emergency modes and executes recovery commands, solving the problem of reliance on manual intervention in existing technologies. This enables automated repair of server operating system failures, improving system response speed and operational efficiency.
Patent Information
- Application Number
- CN202611673413.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-27
- Publication Date
- 2026-11-27
AI Technical Summary
Existing technologies rely on manual intervention when handling emergency modes of server operating systems, resulting in response delays, dependence on the experience of maintenance personnel, low efficiency, and difficulty in achieving automated repair in unattended scenarios.
By monitoring the operating system startup information stream output from the host serial port through the baseboard management controller, and utilizing the preset emergency mode feature library and fault rule library, the system automatically identifies emergency modes and executes corresponding recovery commands, thereby achieving fully automated diagnosis and repair of operating system faults.
It enables automatic discovery, automatic diagnosis, and automatic recovery in the emergency mode of the operating system, shortening the system fault recovery time and improving the automation level and reliability of system operation and maintenance.
Smart Images

Figure CN123178162A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automated operation and maintenance technology, and in particular to an operating system recovery method, apparatus, device and medium based on a baseboard management controller. Background Technology
[0002] The Linux operating system is widely used in servers, data centers, and cloud computing platforms due to its open-source, stable, and efficient characteristics. However, during system startup or operation, it may fail to boot normally due to problems such as file system corruption, critical service failure, driver malfunction, or insufficient disk space, thus entering Emergency Mode. In this mode, the system typically only provides a limited root shell environment for administrators to perform manual repairs.
[0003] Traditional methods for handling system emergency modes heavily rely on the intervention of operations and maintenance (O&M) personnel. These personnel need to connect to the server via serial port, KVM over IP, or the Baseboard Management Controller (BMC)'s Serial Over LAN (SOL) function, view the error messages displayed on the screen, diagnose the cause of the fault based on their experience, and manually execute corresponding repair commands (such as fsck disk repair, journalctl to view logs, clean up disk space, restart services, etc.). This approach has the following significant drawbacks: Response delay: There is a time lag between the occurrence of a fault and its discovery by humans, making it impossible to handle the problem immediately and resulting in prolonged business interruption.
[0004] Highly dependent on personnel: Processing efficiency and quality are highly dependent on the experience level of maintenance personnel. Insufficient experience may lead to misoperation and exacerbate system failures.
[0005] Inefficient: Manual operation is time-consuming and labor-intensive, especially in large-scale server clusters, and cannot achieve batch automated processing, resulting in high operation and maintenance costs.
[0006] Availability challenges: For unattended remote data centers or edge computing nodes, timely human intervention is difficult to achieve.
[0007] The baseboard management controller is an independent management chip on modern server motherboards. It has its own processor, memory, and network interface, and is independent of the host operating system (it can work even when the host is powered off). Local area network serial port redirection is an important function provided by the baseboard management controller. It can redirect the output of the host serial port (such as ttyS0) to the network, allowing remote viewing and capture of the host's BIOS (Basic Input / Output System) boot process, operating system startup logs, and console information in emergency mode.
[0008] However, the LAN serial port redirection function of the current baseboard management controller is mainly used to passively view logs, lacking the ability to actively analyze log content and automate operations based on analysis results.
[0009] It is evident that how to achieve automatic identification and recovery of system emergency modes, reduce the heavy reliance on personnel experience in the operation and maintenance process, and shorten the mean time to recovery (MTTR) from entering emergency mode to returning to normal operation is a problem that needs to be solved by those skilled in the art. Summary of the Invention
[0010] The purpose of this invention is to provide an operating system recovery method, apparatus, device, and medium based on a baseboard management controller. This method leverages the hardware characteristics of the baseboard management controller, which are independent of the host operating system, to capture and analyze operating system startup information in real time through LAN serial port redirection. It automatically identifies emergency modes and accurately matches preset fault solutions, ultimately automatically executing recovery commands. This achieves full automation of the "discovery, diagnosis, and repair" process for operating system faults, significantly shortening system recovery time and improving system reliability and operational efficiency. The specific solution is as follows: In a first aspect, the present invention discloses an operating system recovery method based on a baseboard management controller, comprising: The system monitors and acquires the operating system startup information stream output from the host serial port through the baseboard management controller, and matches the operating system startup information stream with the preset emergency mode feature library. If the match is successful, the operating system is determined to have entered emergency mode, and the diagnostic recovery engine in the baseboard management controller is triggered. The diagnostic recovery engine matches the characteristic information in the operating system startup information stream with the fault characteristics in the preset fault rule base, and determines the cause of the fault based on the matching results. The baseboard management controller sends command-line instructions from the recovery plan corresponding to the fault cause to the host terminal of the operating system, so that the host terminal can execute the command-line instructions to perform recovery. After executing the command line instructions, the host terminal is restarted by sending a restart command based on the baseboard management controller. Then, the process jumps back to the step of listening to and obtaining the operating system startup information stream output by the host serial port through the baseboard management controller. If the operating system is heard to enter the login interface normally, the operating system is determined to have been successfully restored.
[0011] Optionally, the operating system startup information stream is matched against a preset emergency mode signature database, including: Match keywords or regular expressions in the operating system startup information stream with a preset emergency mode feature library; the preset emergency mode feature library contains at least one keyword or regular expression used to determine whether the operating system has entered emergency mode. Accordingly, after matching the operating system startup information stream with the preset emergency mode signature database, it also includes: If the match fails, the process will redirect to the step of listening to and obtaining the operating system startup information stream output by the host serial port through the baseboard management controller.
[0012] Optionally, the diagnostic recovery engine matches the characteristic information in the operating system startup information stream with the fault characteristics in a preset fault rule base, and determines the cause of the fault based on the matching results, including: The diagnostic recovery engine obtains characteristic information from the operating system's boot information stream; The feature information is matched sequentially with the fault features in the preset fault rule base; The preset fault rule base contains at least one fault rule; each fault rule is a rule composed of fault feature fields and recovery schemes; the fault feature fields contain regular expressions or keywords used to match fault causes; the recovery schemes contain one or more command line instructions based on sequential execution corresponding to the fault feature fields. If a match is successful, the matched fault rule will be identified as the cause of the fault.
[0013] Optionally, after the diagnostic recovery engine matches the characteristic information in the operating system boot information stream with the fault characteristics in the preset fault rule base, it also includes: If no fault rule is matched, a non-match alarm is generated.
[0014] Optionally, the baseboard management controller sends command-line instructions from the recovery plan corresponding to the fault cause to the host terminal of the operating system, including: The baseboard management controller sends command-line instructions to the host terminal of the operating system based on the local area network serial port redirection function; wherein, the command-line instructions are sent to the serial port receive buffer of the host terminal one character or one line at a time based on simulated keyboard input. After sending a command-line instruction, wait for the host terminal to return the execution result of the command-line instruction; The decision to send the next command-line instruction is based on the execution result.
[0015] Optionally, after the step of restarting the host terminal based on the baseboard management controller sending a restart command and then jumping back to the step of listening to and obtaining the operating system startup information stream output by the host serial port through the baseboard management controller, the method further includes: If the operating system is detected to have re-entered emergency mode, an operation is triggered to match the operating system startup information stream with the preset emergency mode signature database. If the number of times the emergency mode is entered equal to the preset threshold and the operating system fails to recover successfully, the operation will stop, a manual intervention alarm will be generated directly, and the manual intervention alarm will be sent to the remote management platform through the baseboard management controller.
[0016] Optionally, the operating system recovery method based on the baseboard management controller further includes: Record key events during the operating system recovery process in real time; key events include emergency mode trigger time, matched fault characteristics, executed command line instructions, command execution results, and results after the host terminal restarts; Key events are displayed through the web management interface of the baseboard management controller; Alternatively, critical events can be sent to a remote management platform via a simple network management protocol trap.
[0017] Secondly, the present invention discloses an operating system recovery device based on a baseboard management controller, comprising: The first matching module is used to listen to and obtain the operating system startup information stream output by the host serial port through the baseboard management controller, and match the operating system startup information stream with the preset emergency mode feature library. The diagnostic recovery engine trigger module is used to determine that the operating system has entered emergency mode if a match is successful, and to trigger the diagnostic recovery engine in the baseboard management controller. The second matching module is used to match the feature information in the operating system startup information stream with the fault features in the preset fault rule base through the diagnostic recovery engine, and determine the cause of the fault based on the matching result. The repair module is used to send command-line instructions from the recovery plan corresponding to the cause of the fault to the host terminal of the operating system through the baseboard management controller, so that the host terminal can execute the command-line instructions to perform recovery; The recovery result determination module is used to restart the host terminal by sending a restart command based on the baseboard management controller after the command line instruction is executed, and then jump back to the step of listening to and obtaining the operating system startup information stream output by the host serial port through the baseboard management controller. If the operating system is heard to enter the login interface normally, the operating system is determined to have been successfully restored.
[0018] Thirdly, the present invention discloses an electronic device, comprising: Memory, used to store computer programs; A processor for executing computer programs to implement the steps of the operating system recovery method based on the aforementioned baseboard management controller.
[0019] Fourthly, the present invention discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the aforementioned operating system recovery method based on a baseboard management controller.
[0020] This invention first uses a baseboard management controller to monitor and acquire the operating system startup information stream output from the host serial port, and then matches the operating system startup information stream with a preset emergency mode feature library. If the match is successful, the operating system is determined to have entered emergency mode, and the diagnostic recovery engine in the baseboard management controller is triggered. The diagnostic recovery engine matches the feature information in the operating system startup information stream with the fault features in a preset fault rule library, and determines the cause of the fault based on the matching result. The baseboard management controller sends the command line instructions in the recovery plan corresponding to the fault cause to the host terminal of the operating system, so that the host terminal can execute the command line instructions to perform recovery. After the command line instructions are executed, a restart command is sent based on the baseboard management controller to restart the host terminal, and the process jumps back to the step of monitoring and acquiring the operating system startup information stream output from the host serial port through the baseboard management controller. If the operating system is detected to have entered the login interface normally, the operating system recovery is determined to be successful.
[0021] Beneficial effects: This invention monitors the operating system startup information stream output by the host serial port through the baseboard management controller and matches it with a preset emergency mode feature library. After determining that the operating system has entered emergency mode, it triggers the diagnostic recovery engine, matches the feature information in the startup information stream with a preset fault rule library to determine the cause of the fault, and then sends the command line instructions in the corresponding repair plan to the host terminal through the baseboard management controller to perform recovery. After the repair is completed, a restart command is sent to restart the host terminal and re-monitor the startup information stream until the operating system enters the login interface normally. This realizes automatic discovery, automatic diagnosis and automatic recovery of the operating system in emergency mode without manual intervention, effectively shortening the system fault recovery time and improving the automation level and reliability of system operation and maintenance. Attached Figure Description
[0022] To more clearly illustrate the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 An operating system recovery method based on a baseboard management controller is provided as an embodiment of the present invention; Figure 2 An operating system recovery device based on a baseboard management controller is provided as an embodiment of the present invention; Figure 3 An electronic device provided as an embodiment of the present invention. Detailed Implementation
[0024] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present invention.
[0025] The terms "comprising" and "having," and any variations thereof, in the specification and accompanying drawings of this invention are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may include steps or units not listed.
[0026] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0027] In some technologies, handling operating system emergency modes heavily relies on maintenance personnel passively viewing logs and manually entering repair commands via LAN serial port redirection. This approach suffers from issues such as response delays, reliance on personnel experience, low efficiency, and difficulty in timely intervention in unattended scenarios. To address these technical problems, this invention discloses an operating system recovery method, apparatus, device, and medium based on a baseboard management controller. This method leverages the baseboard management controller's hardware characteristics, which are independent of the host operating system, to capture and analyze operating system startup information in real time via LAN serial port redirection. It automatically identifies emergency modes, accurately matches preset fault solutions, and ultimately automatically executes recovery commands. This achieves full automation of the "discovery, diagnosis, and repair" process for operating system faults, significantly shortening system recovery time and improving system reliability and operational efficiency.
[0028] See Figure 1 As shown, this application discloses an operating system recovery method based on a baseboard management controller, including: Step S11: Listen to and obtain the operating system startup information stream output by the host serial port through the baseboard management controller, and match the operating system startup information stream with the preset emergency mode feature library.
[0029] In this embodiment of the invention, the Baseboard Management Controller (BMC) is an independent management chip integrated on the server motherboard. It has a processor, memory, and network interface independent of the host. Its power supply and operation are independent of the host's operating system, and it can still function normally even when the host is powered off or the operating system crashes. It is the core hardware foundation for automatic monitoring and recovery of the system in emergency mode. The Baseboard Management Controller's Local Area Network Serial Port Redirection (SOL) function can redirect the output of the host serial port (e.g., ttyS0) to the network, enabling the Baseboard Management Controller to capture the host's BIOS boot process, operating system boot logs, and console information in emergency mode, among other operating system boot information streams, in real time.
[0030] In one feasible implementation, an information capture module can be integrated into the firmware of the baseboard management controller. After the server is powered on, the information capture module starts to continuously listen to the output information of the host serial port through the local area network serial port redirection channel, and sends the captured operating system startup information stream to the pattern recognition module in real time.
[0031] There are several possible implementations for acquiring and segmenting the operating system startup information stream: As one optional implementation, the information capture module can read the serial port output line by line, using a newline character as the end marker for each line of information stream, and treating each complete line of text as a matching unit. Another optional implementation is to set up a sliding window buffer, matching the most recently received character stream of a preset length (e.g., 4KB) as a whole to avoid missed matches caused by key features being truncated by newline characters. Yet another optional implementation is to combine the above two methods, i.e., first matching line by line, and then backtracking the sliding window to perform a whole-system match when the line-by-line matching result is uncertain. This application does not limit the specific segmentation method of the operating system startup information stream.
[0032] After obtaining the operating system boot information stream, it is matched with a preset emergency mode feature database. In the embodiment of the present invention, the preset emergency mode feature database is integrated in the firmware of the baseboard management controller, and includes at least one keyword or regular expression for determining whether the operating system enters the emergency mode. Specifically, the keyword or regular expression in the operating system boot information stream is matched with the preset emergency mode feature database. Examples of keywords include "Entering emergency mode", "journalctl", " / dev / mapper / xxx", etc.; an example of a regular expression is (Entering emergency mode|emergency mode), which can be compatible with emergency mode prompts in both English and Chinese language environments.
[0033] Emergency mode matching can be implemented in multiple ways: as an optional implementation, exact keyword matching can be used, that is, to determine whether the information stream text contains a certain keyword string in the feature database; as another optional implementation, regular expression pattern matching can be used to adapt to situations where the same meaning has multiple expressions (case differences, multiple languages, attached path parameters, etc.); as yet another optional implementation, hit weights or combination logic can also be configured for different keywords or regular expressions (for example, only when both "emergency mode" and "root shell" are hit, it is determined that the emergency mode is entered), to further reduce the false positive rate.
[0034] In this way, the present invention performs active programmatic parsing and matching on the captured information stream on the baseboard management controller side, upgrading "passive forwarding" to "active perception". It can be inferred that since the baseboard management controller has a processor, memory, and network interface independent of the host, its operation does not depend on the power supply and operating status of the host operating system. Therefore, when the host operating system crashes due to file system corruption, critical service failure, etc., or even cannot start and enters the emergency mode, the baseboard management controller can still work continuously and capture the serial port information stream; further, information capture can be continued at the moment when the host needs recovery most (that is, the moment when a fault occurs), and will not fail together with the host operating system like a monitoring agent (Agent) running inside the host operating system; it can be seen that the present invention improves the availability of monitoring capabilities from "depending on the survival of the host operating system" to "independent of the survival of the host operating system", fundamentally solving the problem that "monitoring fails when the host fails" in traditional host-based monitoring tools, and providing an information source that remains valid at the time of failure for subsequent automatic diagnosis and recovery.
[0035] Step S12: If the matching is successful, it is determined that the operating system has entered the emergency mode, and the diagnostic recovery engine in the baseboard management controller is triggered.
[0036] In this embodiment of the invention, after matching the operating system startup information stream with the preset emergency mode feature library, if no match is found, the process jumps back to the step of listening to and obtaining the operating system startup information stream output by the host serial port through the baseboard management controller. That is, it returns to step S11 to continue listening, forming a continuous polling of the host serial port output.
[0037] If a match is successful, that is, once the content in the information stream is identified as matching the emergency mode characteristics, the diagnostic recovery engine is immediately triggered.
[0038] In this way, since emergency modes are usually accompanied by stable and identifiable characteristic strings in the serial port output (such as "Entering emergency mode..."), the determination can be completed the instant the feature appears through feature matching, without waiting for manual discovery. This reduces the time delay from "fault occurrence to identification" from the traditional "manual inspection interval" (which may be several minutes to several hours) to the order of "information flow arrives and a match is completed" (usually milliseconds to seconds). If a match is not found, the system immediately returns to the listening state to form continuous polling, ensuring the continuity of monitoring and preventing the omission of subsequent emergency mode characteristics.
[0039] Step S13: The diagnostic recovery engine matches the feature information in the operating system startup information stream with the fault features in the preset fault rule base, and determines the cause of the fault based on the matching result.
[0040] In this embodiment of the invention, feature information in the operating system startup information stream is obtained through a diagnostic recovery engine; the feature information is then matched sequentially with fault features in a preset fault rule base; wherein, the preset fault rule base contains at least one fault rule; each fault rule is a rule composed of a fault feature field and a recovery plan; wherein, the fault feature field contains a regular expression or keyword for matching fault causes; the recovery plan contains one or more command line instructions based on sequential execution corresponding to the fault feature field; if a match is successful, the matched fault rule is determined as the fault cause.
[0041] The diagnostic recovery engine, integrated into the firmware of the baseboard management controller, is the core processing unit of this solution. After being triggered, the diagnostic recovery engine, through its internal scheme matching unit, continues to acquire (i.e., read) feature information from the operating system boot information stream from the information capture module, and then sequentially matches this feature information with fault features in a preset fault rule base. It is important to emphasize that there is bidirectional data interaction between the diagnostic recovery engine and the information capture module: after being triggered by the pattern recognition module, the diagnostic recovery engine needs to further acquire the subsequent information stream following the emergency mode prompt from the information capture module for fault root cause matching. This bidirectional data interaction is crucial for achieving fully automated diagnostics.
[0042] Specifically, examples of fault characteristic fields include " / dev / sda1: UNEXPECTED INCONSISTENCY", "Failed to mount / home", "Volume group 'vg0' not found", and "Starting timeout". Examples of recovery plans include: for file system errors, the recovery plan is yes|fsck / dev / sda1; for insufficient disk space, the recovery plan is echo 'find / var / log -name " .log" -mtime +7 –delete'.
[0043] There are several ways to match the root cause of a fault: One optional approach is to iteratively match the feature information in the information stream against each fault feature in the fault rule base, returning the result upon a match, following the order in the rule base. Another optional approach is to assign a priority to each fault rule and match them from highest to lowest priority, prioritizing more specific and safer rules when multiple rules might match simultaneously. Yet another optional approach is to support matching multiple fault rules in a single information stream, merging the recovery solutions corresponding to these rules into a longer command sequence based on their dependencies and executing them sequentially. If a match is successful, the matched fault rule is identified as the cause of the fault.
[0044] Furthermore, after the diagnostic recovery engine matches the feature information in the operating system startup information stream with the fault features in the preset fault rule base, a non-matching alarm is generated if no fault rule is found. As an optional implementation, the non-matching alarm can carry the original information stream segment that triggered the alarm, allowing maintenance personnel to add or modify fault rules based on this, thereby continuously enriching the fault rule base.
[0045] It should be noted that the fault rule base is a predefined, extensible set of fault-solution mappings, supporting the addition or modification of fault types and corresponding repair commands. When a new fault scenario occurs, simply adding a "fault feature field - recovery solution" rule to the rule base is sufficient to adapt to the scenario, without needing to modify the matching logic of the diagnostic recovery engine.
[0046] In this way, since the fault rule base explicitly binds "fault characteristics" with "recovery solutions," once a fault characteristic is matched from the information flow, the corresponding repair command sequence can be obtained deterministically. This avoids misjudgments and erroneous operations caused by insufficient experience in manual judgment, improving the accuracy and consistency of diagnosis. Because the rule base is scalable and adding new rules does not affect existing matching logic, the system's coverage of fault scenarios can continue to grow with the accumulation of operational experience. Moreover, the same rule can be deployed to all nodes in the cluster, achieving "one-time configuration, batch adaptation," solving the problem that traditional methods cannot process similar faults in batches. When no match is found, an alarm carrying information flow fragments is generated, which not only ensures that unknown faults can be reported in a timely manner to introduce manual intervention, but also provides a data source for the iterative expansion of the rule base, forming a positive cycle of self-improvement of the rule base.
[0047] Step S14: Send the command line instructions in the recovery plan corresponding to the fault cause to the host terminal of the operating system through the baseboard management controller, so that the host terminal can execute the command line instructions to perform recovery.
[0048] In this embodiment, the issuance of command-line instructions is also accomplished using the local area network serial port redirection function of the baseboard management controller. Specifically, the baseboard management controller sends command-line instructions to the host terminal of the operating system based on the local area network serial port redirection function; wherein, the command-line instructions are sent to the serial port receive buffer of the host terminal character by character or line by line based on simulated keyboard input. That is to say, the command execution unit in the diagnostic recovery engine simulates the manual keyboard input operation of the administrator on the serial port terminal, "typing" the commands in the recovery plan into the host's serial port character by character or line by line, which is equivalent to the administrator sitting in front of the terminal and manually entering commands.
[0049] There are several ways to send command-line instructions: As an optional approach, one can send the command string character by character, writing it into the serial port receive buffer one character at a time and appending a newline character to the end to trigger command execution. This method is more reliable for scenarios where the host serial port receive buffer is small or sensitive to the input rate. Another optional approach is to send the command line by line, writing a complete command as a single line, which is more efficient. Yet another optional approach is to insert an appropriate time interval (such as tens of milliseconds) between two adjacent characters or two adjacent lines of commands to adapt to the serial port processing speed of different hosts and avoid character loss due to sending too quickly.
[0050] Furthermore, after sending a command-line instruction, the system waits for the host terminal to return the execution result. Based on the result, it determines whether to continue sending the next command-line instruction. As an optional implementation, the system can determine whether the previous command has been completed and whether it was executed successfully by matching the shell prompt (such as "#" or "$"), the command's return code, or key output in the serial port echo. If the previous command was executed successfully, the system continues sending the next command; if it fails, the system stops sending subsequent commands and switches to an alarm or attempts to match other rules.
[0051] In this way, since the command issuance reuses the existing LAN serial port redirection channel of the baseboard management controller, there is no need to deploy any agent inside the host operating system or rely on the host network. Therefore, commands can still be issued even in emergency mode where the host operating system only provides a limited root shell, ensuring the availability of the recovery channel during a failure. Secondly, the serial control logic of "sending one command, waiting for the execution result, and then deciding whether to send the next command" ensures that the execution of the command sequence has strict timing guarantees and error detection capabilities. The next command is only sent after the previous command has been confirmed to have been executed successfully, avoiding secondary failures caused by command disorder or the execution of subsequent commands before the preceding command has been completed.
[0052] Step S15: After executing the command line instruction, the host terminal is restarted by sending a restart command based on the baseboard management controller, and then jumps back to the step of listening to and obtaining the operating system startup information stream output by the host serial port through the baseboard management controller. If the operating system is heard to enter the login interface normally, it is determined that the operating system has been successfully restored.
[0053] In this embodiment of the invention, after executing the command-line instructions in the recovery scheme, the command execution unit automatically sends a reboot command (such as reboot) to the host terminal through the local area network serial port redirection channel, causing the host operating system to restart. After rebooting, the system returns to step S11, and the baseboard management controller continues to monitor the reboot process and startup information flow of the host serial port. If the startup log shows that the operating system successfully enters the login interface (e.g., the login prompt "login:" or graphical login-related information is captured), it is determined that the operating system recovery is successful, and the process ends.
[0054] Furthermore, after the step of restarting the host terminal by sending a restart command based on the baseboard management controller and jumping back to listening to and obtaining the operating system startup information stream output by the host serial port, the process also includes: if the operating system is detected to have entered emergency mode again, an operation is triggered to match the operating system startup information stream with the preset emergency mode feature library, that is, to repeat step S12 and its subsequent steps, and to try to match other fault rules; if the number of times the emergency mode is entered is equal to the preset threshold number of times and the operating system still fails to recover successfully, the operation is stopped, a manual intervention alarm is directly generated, and the manual intervention alarm is sent to the remote management platform through the baseboard management controller.
[0055] The above-mentioned restart verification and retry logic can be implemented in several ways: as an optional implementation, the preset threshold number of times can be flexibly configured according to the fault type and business importance (such as setting it to 2 or 3 times); as another optional implementation, when entering emergency mode multiple times, different fault rules can be tried to match and execute each time (for example, using fsck to repair the first time, and trying other more thorough repair solutions when entering again) to improve the recovery success rate; as yet another optional implementation, the same rule can also be used to retry before the threshold is reached, which is suitable for scenarios where the first repair fails to take effect due to occasional reasons.
[0056] In this way, on the one hand, after restarting, the system re-enters the information flow monitoring and determines whether it can enter the login interface normally, so that the recovery result can be automatically verified by the system without the need for manual login confirmation, thus solving the problem of "difficulty in verifying results" after traditional manual repair; on the other hand, by setting a threshold number of times to enter emergency mode and automatically reporting a manual intervention alarm after multiple failures, the system not only strives to achieve closed-loop self-healing for faults that can be automatically recovered (and can switch different rules in multiple attempts to improve the success rate), but also avoids getting stuck in an infinite retry loop for faults that cannot be automatically recovered, thus achieving "self-healing if it can be self-healed, and timely alarm if it cannot be self-healed".
[0057] Furthermore, during the aforementioned operating system recovery process, this embodiment of the invention also records key events in real time during the operating system recovery process; key events include the emergency mode trigger time, the matched fault characteristics, the executed command line instructions, the command execution results, and the results after the host terminal restarts. The recording, display, and reporting of the aforementioned key events can be accomplished by the log and report module integrated into the baseboard management controller firmware.
[0058] The display and reporting of key events can be implemented in multiple ways: As an optional implementation manner, the key events are displayed through the Web (World Wide Web) management interface of the baseboard management controller, so that operation and maintenance personnel can log in to the Web interface of the baseboard management controller to view the complete automatic recovery process record; As another optional implementation manner, the key events are sent to the remote management platform through the Simple Network Management Protocol (SNMP) trap method, so as to aggregate, monitor and alarm the recovery events of large-scale server clusters on the centralized management platform; the above two methods can be used alternatively or simultaneously.
[0059] Since key events such as "emergency mode trigger time, matched fault feature, executed command, command result, restart verification result" are recorded completely and structurally, the entire process of each automatic recovery can be fully traced, solving the problem of "untraceable process" in traditional manual repair; At the same time, through the Web interface display and SNMP trap reporting, operation and maintenance personnel can not only view details at the single-machine level, but also perform centralized monitoring of the entire cluster at the management platform level, so that they can timely intervene in faults that cannot be automatically repaired and are reported as alarms.
[0060] Beneficial effects: The present invention monitors the operating system startup information stream output from the host serial port through the baseboard management controller and matches it with the preset emergency mode feature database. After determining that the operating system has entered the emergency mode, it triggers the diagnostic recovery engine, matches the feature information in the startup information stream with the preset fault rule database to determine the cause of the fault, and then sends command line instructions in the corresponding repair scheme to the host terminal through the baseboard management controller to perform recovery. After the repair is completed, it sends a restart command to restart the host terminal and re-monitors the startup information stream until the operating system normally enters the login interface, thereby realizing automatic discovery, automatic diagnosis and automatic recovery in the emergency mode of the operating system without manual intervention, effectively shortening the system fault recovery time, and improving the automation level and reliability of system operation and maintenance.
[0061] To more clearly illustrate the technical solutions of the embodiments of the present application, a specific implementation process of the above operating system recovery method is described below by taking the emergency mode caused by "file system inconsistency" as an example.
[0062] System configuration: Pre-configure in the firmware of the baseboard management controller: (1) a preset emergency mode feature database, which contains a regular expression pattern (Entering emergency mode|emergency mode); (2) a preset fault rule database, which contains a fault rule, and the fault feature field of the fault rule is (UNEXPECTED INCONSISTENCY|fsck. If the error message indicates that the error has occurred, the corresponding recovery method is to execute the two command-line instructions in sequence: yes | fsck -y / dev / sda1 and reboot.
[0063] Fault occurred: During the startup of the host system, a power failure caused inconsistencies in the file system of the / dev / sda1 partition, resulting in a startup failure. The system entered emergency mode and output information such as " / dev / sda1: UNEXPECTED INCONSISTENCY; RUNfsck MANUALLY" and "Entering emergency mode..." to the serial port.
[0064] The automatic recovery process is as follows: (1) The information capture module of the baseboard management controller transmits the above operating system startup information flow to the pattern recognition module through the local area network serial port redirection channel; (2) The pattern recognition module matches the information flow with the preset emergency mode feature library, identifies the keyword "Entering emergency mode", determines that the operating system has entered emergency mode, and immediately activates the diagnostic recovery engine; (3) The scheme matching unit in the diagnostic recovery engine continues to acquire and analyze the information flow, and quickly matches the fault feature "UNEXPECTED INCONSISTENCY", and determines the fault rule hit as the cause of the fault; (4) The command execution unit then executes the preset recovery scheme in sequence through the local area network serial port redirection channel in the manner of simulating keyboard input: first, send the command yes | fsck -y / dev / sda1 to the host terminal, which automatically repairs the problem partition; after waiting for the fsck command to finish executing and return the result, send the command reboot to restart the system.
[0065] Result verification: After the system restarted, the baseboard management controller continued to monitor the boot information stream of the host serial port. Since the file system had been repaired, the boot was successful this time, the emergency mode prompt no longer appeared, and the operating system was detected to be entering the login screen normally, indicating that the operating system recovery was successful. At the same time, the log and report module generated a log: "[Time] Emergency mode was detected due to file system inconsistency ( / dev / sda1). fsck repair was automatically performed and the system was restarted. The system recovery was successful."
[0066] It should be noted that the aforementioned file system inconsistency is merely an exemplary failure scenario. The operating system recovery method of this embodiment is also applicable to many other common emergency mode scenarios, and each scenario can be adapted by configuring corresponding "fault characteristic field - recovery scheme" rules in the fault rule base, as shown in the following example: Scenario 1 (Insufficient Disk Space): When the serial port information stream displays characteristics such as "No space left on device", the fault characteristic field can be configured as "(No space left on device)", and the corresponding recovery solution is "find / var / log -name " `.log" -mtime +7 -delete` (cleans up log files older than 7 days to free up disk space) followed by reboot; Scenario 2 (Critical partition mount failure): When the information stream shows characteristics such as "Failed to mount / home", the fault characteristic field can be configured as (Failed to mount / home). The corresponding recovery solution is to perform file system check and repair commands on the storage device corresponding to / home and then perform reboot. Scenario 3 (Logical Volume Group Loss): When the information stream shows characteristics such as "Volume group 'vg0' not found", the fault characteristic field can be configured as (Volume group). If the volume group is not found, the corresponding recovery solution is to execute the volume group scan and activation command (such as vgscan, vgchange -ay) and then execute reboot. Scenario 4 (Service Startup Timeout): When the information stream contains features such as "Starting timeout", the fault feature field can be configured as (Starting timeout). The corresponding recovery solution is to disable or restart the corresponding timeout service and then perform reboot.
[0067] See Figure 2 As shown, this application discloses an operating system recovery device based on a baseboard management controller, comprising: The first matching module 11 is used to listen to and obtain the operating system startup information stream output by the host serial port through the baseboard management controller, and match the operating system startup information stream with the preset emergency mode feature library. The diagnostic recovery engine trigger module 12 is used to determine that the operating system has entered emergency mode if the match is successful, and to trigger the diagnostic recovery engine in the baseboard management controller. The second matching module 13 is used to match the feature information in the operating system startup information stream with the fault features in the preset fault rule base through the diagnostic recovery engine, and determine the cause of the fault based on the matching result. Repair module 14 is used to send command line instructions from the recovery plan corresponding to the fault cause to the host terminal of the operating system through the baseboard management controller, so that the host terminal can execute the command line instructions to perform recovery; The recovery result determination module 15 is used to restart the host terminal by sending a restart command based on the baseboard management controller after executing the command line instruction, and jump back to the step of listening to and obtaining the operating system startup information stream output by the host serial port through the baseboard management controller. If the operating system is heard to enter the login interface normally, the operating system is determined to be successfully restored.
[0068] Since the embodiments of the device part correspond to the embodiments described above, please refer to the embodiments described in the method part for the embodiments of the device part, and will not be repeated here.
[0069] Beneficial effects: This invention monitors the operating system startup information stream output by the host serial port through the baseboard management controller and matches it with a preset emergency mode feature library. After determining that the operating system has entered emergency mode, it triggers the diagnostic recovery engine, matches the feature information in the startup information stream with a preset fault rule library to determine the cause of the fault, and then sends the command line instructions in the corresponding repair plan to the host terminal through the baseboard management controller to perform recovery. After the repair is completed, a restart command is sent to restart the host terminal and re-monitor the startup information stream until the operating system enters the login interface normally. This realizes automatic discovery, automatic diagnosis and automatic recovery of the operating system in emergency mode without manual intervention, effectively shortening the system fault recovery time and improving the automation level and reliability of system operation and maintenance.
[0070] Furthermore, embodiments of the present invention also disclose an electronic device, Figure 3 This is a structural diagram of an electronic device according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of the invention. Specifically, the electronic device may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the operating system recovery method based on the baseboard management controller disclosed in any of the foregoing embodiments. Furthermore, the electronic device in this embodiment may specifically be an electronic computer.
[0071] In this embodiment, the power supply 23 is used to provide operating voltage for various hardware devices on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this invention, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0072] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0073] The operating system 221 is used to manage and control various hardware devices on the electronic device and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the operating system recovery method based on the baseboard management controller executed by the electronic device as disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program capable of performing other specific tasks.
[0074] Furthermore, the present invention also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned operating system recovery method based on a baseboard management controller. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0075] Furthermore, this application also discloses a computer program product, including a computer program / instructions; wherein, when the computer program / instructions are executed by a processor, they implement the aforementioned operating system recovery method based on a baseboard management controller. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0076] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0077] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0078] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0079] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0080] The technical solution provided by the present invention has been described in detail above. Specific examples have been used to illustrate the principle and implementation of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core idea of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation and application scope based on the idea of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for restoring an operating system based on a baseboard management controller, characterized in that, include: The system monitors and acquires the operating system startup information stream output from the host serial port through the baseboard management controller, and matches the operating system startup information stream with a preset emergency mode feature library; If the match is successful, the operating system is determined to have entered emergency mode, and the diagnostic recovery engine in the baseboard management controller is triggered. The diagnostic recovery engine matches the feature information in the operating system startup information stream with the fault features in the preset fault rule base, and determines the cause of the fault based on the matching result. The baseboard management controller sends command-line instructions from the recovery plan corresponding to the cause of the fault to the host terminal of the operating system, so that the host terminal can execute the command-line instructions to perform recovery; After executing the command line instruction, the host terminal is restarted by sending a restart command based on the baseboard management controller, and then jumps back to the step of listening to and obtaining the operating system startup information stream output by the host serial port through the baseboard management controller. If the operating system is heard to enter the login interface normally, it is determined that the operating system has been successfully restored.
2. The operating system recovery method based on the baseboard management controller according to claim 1, characterized in that, The step of matching the operating system startup information stream with a preset emergency mode feature library includes: The keywords or regular expressions in the operating system startup information stream are matched with the preset emergency mode feature library; the preset emergency mode feature library contains at least one keyword or regular expression used to determine whether the operating system has entered emergency mode. Accordingly, after matching the operating system startup information stream with a preset emergency mode feature library, the process further includes: If the match fails, the process will jump back to the step of listening to and obtaining the operating system startup information stream output by the host serial port through the baseboard management controller.
3. The operating system recovery method based on the baseboard management controller according to claim 1, characterized in that, The step of matching the feature information in the operating system startup information stream with the fault features in the preset fault rule base through the diagnostic recovery engine, and determining the cause of the fault based on the matching result, includes: The diagnostic recovery engine obtains characteristic information from the operating system startup information stream; The feature information is matched sequentially with the fault features in the preset fault rule base; The preset fault rule base contains at least one fault rule; each fault rule is a rule composed of a fault feature field and a recovery plan; wherein the fault feature field contains a regular expression or keyword for matching fault causes; and the recovery plan contains one or more command line instructions based on sequential execution corresponding to the fault feature field. If a match is successful, the matched fault rule will be identified as the cause of the fault.
4. The operating system recovery method based on the baseboard management controller according to claim 1, characterized in that, After the diagnostic recovery engine matches the feature information in the operating system startup information stream with the fault features in the preset fault rule base, the process further includes: If no fault rule is matched, a non-match alarm is generated.
5. The operating system recovery method based on the baseboard management controller according to claim 1, characterized in that, The step of sending command-line instructions from the recovery plan corresponding to the fault cause to the host terminal of the operating system via the baseboard management controller includes: The baseboard management controller sends the command line instructions to the host terminal of the operating system based on the local area network serial port redirection function; wherein, the command line instructions are sent to the serial port receive buffer of the host terminal character by character or line by line based on simulated keyboard input. After sending a command line instruction, wait for the host terminal to return the execution result of the command line instruction; Based on the execution result, determine whether to continue sending the next command line instruction.
6. The operating system recovery method based on the baseboard management controller according to claim 1, characterized in that, After the step of restarting the host terminal by sending a restart command based on the baseboard management controller and then jumping back to the step of listening to and obtaining the operating system startup information stream output by the host serial port through the baseboard management controller, the method further includes: If the operating system is detected to have re-entered emergency mode, the operation of matching the operating system startup information stream with a preset emergency mode feature library is triggered. If the number of times the emergency mode is entered equal to the preset threshold number and the operating system fails to recover successfully, the operation will stop, a manual intervention alarm will be generated directly, and the manual intervention alarm will be sent to the remote management platform through the baseboard management controller.
7. The operating system recovery method based on a baseboard management controller according to any one of claims 1 to 6, characterized in that, Also includes: Real-time recording of key events during the operating system recovery process; The key events include the emergency mode trigger time, the matched fault characteristics, the executed command line instructions, the command execution results, and the results after the host terminal is restarted; The key events are displayed through the web management interface of the baseboard management controller; Alternatively, the critical events can be sent to the remote management platform via a Simple Network Management Protocol (SMLP) trap.
8. An operating system recovery device based on a baseboard management controller, characterized in that, include: The first matching module is used to listen to and obtain the operating system startup information stream output by the host serial port through the baseboard management controller, and match the operating system startup information stream with a preset emergency mode feature library. The diagnostic recovery engine trigger module is used to determine that the operating system has entered emergency mode if a match is successful, and to trigger the diagnostic recovery engine in the baseboard management controller. The second matching module is used to match the feature information in the operating system startup information stream with the fault features in the preset fault rule base through the diagnostic recovery engine, and determine the cause of the fault based on the matching result. The repair module is used to send command-line instructions from the recovery plan corresponding to the cause of the fault to the host terminal of the operating system through the baseboard management controller, so that the host terminal can execute the command-line instructions to perform recovery; The recovery result determination module is used to restart the host terminal by sending a restart command based on the baseboard management controller after executing the command line instruction, and then jump back to the step of listening to and obtaining the operating system startup information stream output by the host serial port through the baseboard management controller. If the operating system is found to have entered the login interface normally, the operating system is determined to have recovered successfully.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing a computer program to implement the steps of the operating system recovery method based on a baseboard management controller as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, A computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the operating system recovery method based on a baseboard management controller as described in any one of claims 1 to 7.
