A kernel crash information processing method, system, device and computer medium
By collecting and transmitting crash information to the target device after the Linux system kernel crashes, the problem of kernel crash information not being able to be obtained in time is solved, and more efficient information processing is achieved.
Patent Information
- Application Number
- CN202111197558.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-14
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2041-10-14
AI Technical Summary
After the existing Linux system kernel crashes, the crash information cannot be transmitted in time, resulting in users being unable to handle it in time.
After the kernel crashes, it first collects crash information and transmits it to the target device, then restarts and uses pre-built-in network tools and kdump services to transmit information.
Improves the efficiency of kernel crash information processing, allowing the target device to be notified of the crash before the kernel restarts.
Smart Images

Figure CN114020501B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of server, more particularly, to a kernel crash information processing method, system, device and computer medium. BACKGROUND
[0002] At present, during the running of the linux system, the kernel may crash due to faults. After the kernel of the existing linux system crashes, it will restart, so that the user cannot obtain the kernel crash information in time, which affects the user's processing of the kernel.
[0003] To sum up, how to improve the processing efficiency of the kernel crash information is a problem to be solved by the person skilled in the art. SUMMARY
[0004] The present application aims to provide a kernel crash information processing method which can solve the technical problem of how to improve the processing efficiency of the kernel crash information to some extent. The present application also provides a kernel crash information processing system, device and computer readable storage medium.
[0005] In order to achieve the above-mentioned purpose, the present application provides the following technical scheme:
[0006] A kernel crash information processing method applied to a kernel, comprising:
[0007] determining whether the kernel crashes;
[0008] if yes, collecting crash information and transmitting the crash information to a target device;
[0009] controlling the kernel to restart.
[0010] Preferably, the step of transmitting the crash information to the target device comprises:
[0011] transmitting the crash information to the target device based on a pre-built network tool.
[0012] Preferably, the step of collecting crash information comprises:
[0013] collecting the crash information based on a kdump service.
[0014] Preferably, before the step of transmitting the crash information to the target device based on the pre-built network tool, the method further comprises:
[0015] building the network tool in the kdump service.
[0016] Preferably, the step of transmitting the crash information to the target device comprises:
[0017] transmitting the crash information to a user client.
[0018] Preferably, the transmitting the crash information to the target device comprises:
[0019] transmitting the crash information to a preset server.
[0020] Preferably, before the transmitting the crash information to the target device, the method further comprises:
[0021] transmitting information representing that the kernel has crashed to the target device.
[0022] A kernel crash information processing system applied to a kernel, comprising:
[0023] a first judging module, configured to judge whether the kernel has crashed; if yes, collect crash information and transmit the crash information to a target device;
[0024] a first control module, configured to control the kernel to restart.
[0025] A kernel crash processing device, comprising:
[0026] a memory, configured to store a computer program;
[0027] a processor, configured to execute the computer program to implement the steps of the kernel crash processing method.
[0028] A computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the kernel crash processing method.
[0029] The kernel crash information processing method provided in the application is applied to a kernel, judges whether the kernel has crashed; if yes, collects crash information, transmits the crash information to a target device, and controls the kernel to restart. In the application, after the kernel determines that the kernel has crashed, the kernel collects crash information, transmits the crash information to a target device, and then restarts. In this way, a user of the target device can know the crash information of the kernel before the kernel restarts, the efficiency of the target device in acquiring the crash information is improved, and the processing efficiency of the kernel crash information is improved. The kernel crash information processing system, the device, and the computer readable storage medium provided in the application also solve the corresponding technical problems. BRIEF DESCRIPTION OF DRAWINGS
[0030] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required by the embodiments or prior art description. Obviously, the drawings in the following description are only a part of the present application, and for those skilled in the art, other drawings can be obtained based on the provided drawings without creative labor.
[0031] Figure 1 A flow chart of a kernel crash information processing method provided by an embodiment of the present application;
[0032] Figure 2 A structural schematic diagram of a kernel crash processing device provided by an embodiment of the present application;
[0033] Figure 3 A structural schematic diagram of a kernel crash processing device provided by an embodiment of the present application;
[0034] Figure 4 Another structural schematic diagram of a kernel crash processing device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0035] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0036] Please refer to Figure 1 , Figure 1 A flow chart of a kernel crash information processing method provided by an embodiment of the present application.
[0037] The kernel crash information processing method provided by an embodiment of the present application is applied to a kernel, and can include the following steps.
[0038] Step S101: judging whether a crash occurs in itself or not; if yes, executing step S102.
[0039] Step S102: collecting crash information and transmitting the crash information to a target device.
[0040] Step S103: controlling to restart itself.
[0041] In actual application, the kernel can first determine whether a crash occurs, and if so, collect the crash information, transmit the crash information to the target device, and then control the kernel to restart. It should be noted that the kernel can transmit the collected crash information to the target device while collecting the crash information, or can transmit all the collected crash information to the target device after collecting all the crash information, and the present application does not make a specific limitation here.
[0042] It should be noted that the type of the target device can be determined according to actual needs, for example, the target device can be a user client, a preset server, etc.
[0043] The present application provides a kernel crash information processing method, which is applied to a kernel, determines whether a crash occurs, collects crash information if a crash occurs, transmits the crash information to a target device, and controls the kernel to restart. In the present application, after determining that a crash occurs, the kernel first collects the crash information, transmits the crash information to the target device, and then restarts. In this way, the user of the target device can obtain the kernel crash information before the kernel restarts, which improves the efficiency of the target device in obtaining the crash information, and further improves the processing efficiency of the kernel crash information.
[0044] In the kernel crash information processing method provided by the present application, during the process of transmitting the crash information to the target device, it is considered that the kernel may not be able to call the existing network after a crash occurs. Therefore, in order to ensure that the kernel can transmit the crash information to the target device, a network tool can be pre-embedded in the kernel, and the crash information can be transmitted to the target device based on the pre-embedded network tool.
[0045] In a specific application scenario, the kernel can collect crash information based on a kdump service during the process of collecting the crash information. Correspondingly, before transmitting the crash information to the target device based on the pre-embedded network tool, the network tool can also be embedded in the kdump service.
[0046] Specifically, the network tool is built in the process of the kdump service, and the install_items += " / usr / sbin / ip / usr / sbin / dhclient / usr / bin / ping" configuration mode is used to modify / etc / dracut.conf, to add necessary network tools to the initrd; / lib / kdump / kdump-lib-initramfs.sh is modified to add dhclient eth0 to enable the network function of the captured kernel; then / lib / kdump / kdump-lib-initramfs.sh is modified to add the scp file to the target device; then the initrd used by the captured kernel is regenerated through kdumpctl rebuild; finally, the kdump mechanism is restarted through kdumpctl restart to apply the modification, so that the network tool in the kdump service takes effect.
[0047] In the kernel crash information processing method provided by the embodiment of the present application, the kernel can also transmit information indicating that the kernel crashes to the target device before transmitting the crash information to the target device, so that the target device can learn the information indicating that the kernel crashes as soon as possible.
[0048] Please refer to Figure 2 , Figure 2 The structure diagram of the kernel crash information processing system provided by the embodiment of the present application is shown.
[0049] The kernel crash information processing system provided by the embodiment of the present application is applied to a kernel and can include:
[0050] The first judging module 101 is configured to judge whether the kernel crashes or not, and if yes, collect the crash information and transmit the crash information to the target device.
[0051] The first control module 102 is configured to control the kernel to restart.
[0052] The kernel crash information processing system provided by the embodiment of the present application is applied to a kernel, and the first judging module can include:
[0053] The first transmission unit is configured to transmit the crash information to the target device based on the pre-built network tool.
[0054] The kernel crash information processing system provided by the embodiment of the present application is applied to a kernel, and the first judging module can include:
[0055] The first collection unit is configured to collect the crash information based on the kdump service.
[0056] The kernel crash information processing system provided by the embodiment of the present application is applied to a kernel, and can further comprise:
[0057] The built-in module is used for built-in network tools in the kdump service before the first judging module transmits the crash information to the target device based on the pre-built network tools.
[0058] The kernel crash information processing system provided by the embodiment of the present application is applied to a kernel, and the first judging module can comprise:
[0059] The second transmission unit is used for transmitting the crash information to the user client.
[0060] The kernel crash information processing system provided by the embodiment of the present application is applied to a kernel, and the first judging module can comprise:
[0061] The third transmission unit is used for transmitting the crash information to the preset server.
[0062] The kernel crash information processing system provided by the embodiment of the present application is applied to a kernel, and can further comprise:
[0063] The first transmission module is used for transmitting the information indicating that the kernel crashes to the target device before the first judging module transmits the crash information to the target device.
[0064] The present application further provides a kernel crash processing device and a computer readable storage medium, both of which have the corresponding effects of the kernel crash processing method provided by the embodiment of the present application. Please refer to Figure 3 , Figure 3 The structure diagram of the kernel crash processing device provided by the embodiment of the present application is shown.
[0065] The kernel crash processing device provided by the embodiment of the present application comprises a memory 201 and a processor 202, the memory 201 stores a computer program, and the processor 202 implements the following steps when executing the computer program:
[0066] Judging whether the kernel itself crashes or not;
[0067] If yes, collecting the crash information and transmitting the crash information to the target device;
[0068] Controlling the kernel to restart.
[0069] The kernel crash processing device provided by the embodiment of the present application comprises a memory 201 and a processor 202, the memory 201 stores a computer program, and the processor 202 implements the following steps when executing the computer program: transmitting the crash information to the target device based on the pre-built network tools.
[0070] The embodiment of the present application provides a kernel crash processing device, which comprises a memory 201 and a processor 202, the memory 201 stores a computer program, and the processor 202 implements the following steps when executing the computer program: collecting crash information based on a kdump service.
[0071] The embodiment of the present application provides a kernel crash processing device, which comprises a memory 201 and a processor 202, the memory 201 stores a computer program, and the processor 202 implements the following steps when executing the computer program: based on a pre-built network tool, embedding the network tool in the kdump service before transmitting the crash information to a target device.
[0072] The embodiment of the present application provides a kernel crash processing device, which comprises a memory 201 and a processor 202, the memory 201 stores a computer program, and the processor 202 implements the following steps when executing the computer program: transmitting the crash information to a user client.
[0073] The embodiment of the present application provides a kernel crash processing device, which comprises a memory 201 and a processor 202, the memory 201 stores a computer program, and the processor 202 implements the following steps when executing the computer program: transmitting the crash information to a preset server.
[0074] The embodiment of the present application provides a kernel crash processing device, which comprises a memory 201 and a processor 202, the memory 201 stores a computer program, and the processor 202 implements the following steps when executing the computer program: before transmitting the crash information to a target device, transmitting information representing that the kernel crashes to the target device.
[0075] Please refer to Figure 4 In another kernel crash processing device provided by the embodiment of the present application, an input port 203 connected with the processor 202, a display unit 204 connected with the processor 202, and a communication module 205 connected with the processor 202 can be further included, the input port 203 is used for transmitting an external input command to the processor 202, the display unit 204 is used for displaying a processing result of the processor 202 to the outside world, and the communication module 205 is used for realizing communication between the kernel crash processing device and the outside world. The display unit 204 can be a display panel, a laser scanning display or the like; and the communication mode adopted by the communication module 205 includes but is not limited to a mobile high-definition link technology (HML), a universal serial bus (USB), a high-definition multimedia interface (HDMI), a wireless connection, a wireless fidelity technology (WiFi), a Bluetooth communication technology, a low-power Bluetooth communication technology, and a communication technology based on IEEE 802.11s.
[0076] The embodiment of the present application provides a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the following steps:
[0077] determining whether a crash occurs in the system;
[0078] if yes, collecting the crash information and transmitting the crash information to a target device;
[0079] controlling the system to restart.
[0080] The computer readable storage medium provided by the embodiment of the present application stores a computer program, and the computer program is executed by a processor to implement the following steps: transmitting the crash information to a target device based on a pre-built network tool.
[0081] The computer readable storage medium provided by the embodiment of the present application stores a computer program, and the computer program is executed by a processor to implement the following steps: collecting the crash information based on a kdump service.
[0082] The computer readable storage medium provided by the embodiment of the present application stores a computer program, and the computer program is executed by a processor to implement the following steps: embedding the network tool in the kdump service before transmitting the crash information to the target device based on the pre-built network tool.
[0083] The computer readable storage medium provided by the embodiment of the present application stores a computer program, and the computer program is executed by a processor to implement the following steps: transmitting the crash information to a user client.
[0084] The computer readable storage medium provided by the embodiment of the present application stores a computer program, and the computer program is executed by a processor to implement the following steps: transmitting the crash information to a preset server.
[0085] The computer readable storage medium provided by the embodiment of the present application stores a computer program, and the computer program is executed by a processor to implement the following steps: transmitting the information indicating that the kernel crashes to the target device before transmitting the crash information to the target device.
[0086] The computer readable storage medium involved in the present application includes a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the technical field.
[0087] The related parts of the kernel crash information processing system, device and computer readable storage medium provided in the embodiments of the present application are described in detail in the corresponding parts of the kernel crash information processing method provided by the embodiments of the present application, which will not be described here. In addition, the parts of the above technical solutions provided by the embodiments of the present application that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail, so as not to be too verbose.
[0088] It should also be noted that, in this document, relational terms such as first and second and the like can be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element preceded by "comprises a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus that comprises the recited element.
[0089] The above description of disclosed embodiments enables a person skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A kernel crash information processing method, characterized in that: Applied to the kernel, including: Determine whether a crash has occurred; If so, collecting crash information and transmitting the crash information to the target device; Controls its own restart; The transmitting the crash information to the target device includes: Transmitting the crash information to the target device based on a pre-built-in network tool; The collecting of crash information includes: Collect the crash information based on the kdump service; Before transmitting the crash information to the target device based on the pre-built-in network tool, the method further includes: Embedding the network tool in the kdump service; To integrate the network tool into the kdump service, use the install_items + = " / usr / sbin / ip / usr / sbin / dhclient / usr / bin / ping" configuration method and modify / etc / dracut.conf to add the network tool to the initrd. Modify / lib / kdump / kdump-lib-initramfs.sh to add dhclient eth0 to enable the capture kernel's network function. Modify / lib / kdump / kdump-lib-initramfs.sh to add the scp file to the target device. Rebuild the initrd used by the capture kernel using the kdumpctl rebuild command. Restart the kdump mechanism using the kdumpctl restart command to apply the changes and make the network tool in the kdump service take effect.
2. The method according to claim 1, characterized in that The transmitting the crash information to the target device includes: Transmit the crash information to the user client.
3. The method according to claim 1, characterized in that The transmitting the crash information to the target device includes: The crash information is transmitted to a preset server.
4. The method according to any one of claims 1 to 3, characterized in that Before transmitting the crash information to the target device, the method further includes: Transmitting information indicating that the kernel has crashed to the target device.
5. A kernel crash information processing system, characterized in that: Applied to the kernel, including: A first determination module is configured to determine whether the module itself has crashed; if so, collect crash information and transmit the crash information to a target device; A first control module, configured to control its own restart; The first judgment module includes: A first transmission unit, configured to transmit the crash information to the target device based on a pre-built-in network tool; The first judgment module includes: A first collecting unit, configured to collect the crash information based on a kdump service; Among them, also include: A built-in module, configured to embed a pre-built-in network tool in the kdump service before the first judgment module transmits the crash information to the target device based on the pre-built-in network tool; To integrate network tools into the kdump service, use the install_items + = " / usr / sbin / ip / usr / sbin / dhclient / usr / bin / ping" configuration method and modify / etc / dracut.conf to add the necessary network tools to the initrd. Modify / lib / kdump / kdump-lib-initramfs.sh to add dhclient eth0 to enable the capture kernel's network function. Modify / lib / kdump / kdump-lib-initramfs.sh to add the scp file to the target device. Rebuild the initrd used by the capture kernel using the kdumpctl rebuild command. Restart the kdump mechanism using the kdumpctl restart command to apply the changes and make the network tools in the kdump service take effect.
6. A kernel crash processing device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the kernel crash processing method according to any one of claims 1 to 4 when executing the computer program.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the kernel crash processing method according to any one of claims 1 to 4.
Citation Information
Patent Citations
System crash information remote transmitting method and network device
CN105389227A
Method for collecting information when RHEL operating system has no response
CN106776090A