CN104077196A - Linux boot failure recovering method and device - Google Patents

Linux boot failure recovering method and device Download PDF

Info

Publication number
CN104077196A
CN104077196A CN201410313042.0A CN201410313042A CN104077196A CN 104077196 A CN104077196 A CN 104077196A CN 201410313042 A CN201410313042 A CN 201410313042A CN 104077196 A CN104077196 A CN 104077196A
Authority
CN
China
Prior art keywords
grub
configuration file
linux
core
determines
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201410313042.0A
Other languages
Chinese (zh)
Inventor
杨磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Beijing Electronic Information Industry Co Ltd
Original Assignee
Inspur Beijing Electronic Information Industry Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Beijing Electronic Information Industry Co Ltd filed Critical Inspur Beijing Electronic Information Industry Co Ltd
Priority to CN201410313042.0A priority Critical patent/CN104077196A/en
Publication of CN104077196A publication Critical patent/CN104077196A/en
Pending legal-status Critical Current

Links

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses a Linux boot failure recovering method and device and relates to the technical field of computers. The Linux boot failure recovering method includes that when the Linux fails to boot, a built-in core of a multi-boot manager (GRUB) checks equipment or content of a file system according to a 1s command sent by a user to determine the position of a GRUB configuration file; editing the GRUB configuration file; recovering the normal guide according to the edited GRUB configuration file. According to the technical scheme of the Linux boot failure recovering method and device, a GRUB 2 is used for controlling the process of the computer from a BIOS or EFI to the inner core, and the user can control the guide process.

Description

A kind of Linux guides failed restoration methods and device
Technical field
The present invention relates to field of computer technology, relate in particular to a kind of Linux and guide failed restoration methods and device.
Background technology
In user's production environment, linux system occupies larger proportion at present, when Linux likely cannot guide after execution kernel upgrading, replacing disk, experience computer virus or other system change, obliterated data will be paid huge cost: the cost that business loss, production efficiency reduction and increase re-create data even can cause the bankruptcy of enterprise.
Summary of the invention
Technical matters to be solved by this invention is to provide a kind of Linux to guide failed restoration methods and device, to solve the problem that guidance system efficiency is low, reliability is low.
In order to solve the problems of the technologies described above, the invention discloses a kind of Linux and guide failed restoration methods, the method comprises:
In the time that Linux guides unsuccessfully, the built-in core of multiboot manager (GRUB), according to equipment or the content of Client-initiated ls order viewing files system, is determined GRUB configuration file position;
Described GRUB configuration file is edited;
Recover normal boot according to the GRUB configuration file after editor.
Alternatively, in said method, the built-in core of GRUB according to the equipment of Client-initiated ls order viewing files system or the process of content is:
Core is carried out described ls order, shows the detectable all disks of GRUB, subregion.
Alternatively, in said method, determine that GRUB configuration file position refers to:
In the detectable all disks of GRUB that show at described Shell, subregion, determine GRUB config directory according to user instruction.
Alternatively, in said method, described GRUB configuration file is edited, is recovered normal boot according to the GRUB configuration file after editor and refer to:
Determine behind GRUB configuration file position, reset prefix and root environmental variance;
Described GRUB reads the prefix and the root environmental variance that reset, determines the accurate location of GRUB configuration file, reads GRUB configuration file from this accurate location, realizes normal boot.
The invention also discloses a kind of Linux and guide failed recovery device, this device comprises:
The built-in core of multiboot manager (GRUB), in the time that Linux guides unsuccessfully, according to equipment or the content of Client-initiated ls order viewing files system, determines GRUB configuration file position;
Editing and processing module, edits described GRUB configuration file;
GRUB bootstrap module, recovers normal boot according to the GRUB configuration file after editor.
Alternatively, in said apparatus, the built-in core of described GRUB refers to according to equipment or the content of Client-initiated ls order viewing files system:
The built-in core of described GRUB, carries out described ls order, shows the detectable all disks of GRUB, subregion.
Alternatively, in said apparatus, determine that GRUB configuration file position refers to:
The built-in core of described GRUB, in the detectable all disks of shown GRUB, subregion, determines GRUB config directory according to user instruction.
Alternatively, in said apparatus, described editing and processing module, determines behind GRUB configuration file position, resets prefix and root environmental variance;
Described GRUB bootstrap module, reads the prefix and the root environmental variance that reset, determines the accurate location of GRUB configuration file, reads GRUB configuration file from this accurate location, realizes normal boot.
When present techniques scheme cannot guide after Linux computing machine is being carried out kernel upgrading, replacing disk, experience computer virus or other system change, control the process from the BIOS of computing machine or EFI to kernel by GRUB2 (Grand Unified Bootloader), it provides complicated integration of user interaction functionality, for user provides the ability of controlling bootup process, can configure and adjust boot options by editor, or use built-in shell that system is recovered from guide failed problem.
Brief description of the drawings
Fig. 1 is the inventive method schematic flow sheet.
Embodiment
For making the object, technical solutions and advantages of the present invention clearer, below in connection with accompanying drawing, technical solution of the present invention is described in further detail.It should be noted that, in the situation that not conflicting, the feature in the application's embodiment and embodiment can combine arbitrarily mutually.
Embodiment 1
At present, Linux boot is used Grand Unified Bootloader (hereinafter to be referred as GRUB, multiboot manager) to control the process from the firmware of computing machine to kernel.
Bootup process on the computing machine of use basic input/output (BIOS) all relates to the code that is stored in each position on disk.These positions comprise Main Boot Record (Master Boot Record, MBR), the informal disk sector of distributing and the boot sector (also referred to as partition boot record [Partition Boot Record, PBR]) of subregion.These records can be rewritten by other Boot loaders, by virus or because misuse dd supervisor is damaged.
That newer computing machine uses is Extensible Firmware Interface (Extensible Firmware Interface, EFI) instead of BIOS (use basic input/output).In these systems, GRUB code is not stored in MBR, PBR or the informal disk sector of distributing.They are arranged in the upper EFI Boot loader file with .efi extension name in EFI system partitioning (ESP), ESP is a subregion that conventionally appears at disk and start and have file allocation table (File Allocation Table, FAT) form.EFI system is not vulnerable to the destruction with the rudimentary Boot loader of BIOS system same type.
Except BIOS or EFI boot files, the traditional file in also depend on/boot/grub of GRUB2.These files comprise file system driver, video driver, font and GRUB configuration file (grub.cfg).Because these files are arranged in normal Linux file system, so the vectoring phase must comprise at least one basic Linux file system driver in early days.If these files are damaged, GRUB may normally start, but cannot start your operating system; Or GRUB may start and only show a grub> prompt.
Based on above-mentioned analysis, present inventor proposes, the position of built-in core (shell) orientation direction file that can be by GRUB2, then carry out vectoring computer quickly and efficiently by editor's configuration file, to improve the security of availability and data of system.Particularly, the present embodiment provides a kind of Linux to guide failed restoration methods, as shown in Figure 1, comprises following operation:
In the time that Linux guides unsuccessfully, the built-in shell of GRUB2, according to equipment or the content of Client-initiated ls order viewing files system, determines GRUB configuration file position;
Described GRUB configuration file is edited;
Recover normal boot according to the GRUB configuration file after editor.
Wherein, while using the shell of GRUB2, the order of can be in shell keying in key entry and Bash or other Linux Text Modes shell is similarly ordered.
Particularly, can enter this shell from GRUB master menu, now user can press c.Also can enter this shell from GRUB editing machine, user can press Ctrl-c or F2.Certainly in the situation that GRUB is abnormal, also can automatically enter shell.
In the present embodiment, GRUB2shell supports series of orders, and the order of bootup process that wherein drives for Control-Menu in many orders and grub.cfg is similar or be equal to.If be familiar with GRUB2 configuration file format, can in shell, key in order and carry out vectoring computer.As following table 1 is conventional in this respect order.
Table 1 is conventional GRUB2 order line order
When GRUB cannot read configuration file and cause guiding, first, the subregion of GRUB must identification to be installed, this point can complete by ls order.If be not with any option, ls can show the detectable disk of GRUB and subregion in the time using this order.Preferably, the title that user can designated equipment and an ending slash (/), to check the content of particular zones, as follows.
Example in foregoing has shown a computing machine with single disk (hd0), and this disk comprises 5 globally unique identifiers (GUID) partition tables (GPT) subregion.The content of (hd0, gpt5) is a Linux/boot subregion, comprises a GRUB config directory (grub/).May need to check the content of other subregions, then just can find the Linux/boot subregion needing.If system is not used independent/boot subregion, must search Linux guiding (/) subregion.Particularly, search procedure is triggered by user, and namely, shells shows after the detectable all disks of GRUB, subregion, therefrom determines GRUB config directory (being GRUB configuration file position) according to user instruction.
Behind identification GRUB configuration file position, after being edited, GRUB configuration file gets final product normal boot.Particularly, prefix (prefix) can be set and according to (root) environmental variance, thereby notice GRUB finds configuration file wherein.These variablees are identified respectively the catalogue at grub.cfg place and the subregion at its place:
From here, can load normal module and start it and recall GRUB menu:
Finally carry out, reboot, restarting rear system can normal boot.
In addition, be also noted that the computing machine for configuration file locality specific, the process of recovering guiding after it guides is unsuccessfully editor's configuration file.
At present, Grub2 comprises several parts below:
/ boot/grub/grub.cfg file
/ etc/grub.d/ file
/ etc/default/grub file
Grub.cfg comprises global option and the guidance code (stanza) specific to operating system or kernel.
The boot options of GRUB2 has defined each operating system or kernel.These guidance code joints are usually located at the latter half of grub.cfg file.The example GRUB2 code joint that is guiding Linux as follows.
When boot partition changes, after kernel upgrading, system guides unsuccessfully, can be according to the following option of actual conditions amendment.
Insmod load driver module.
Initialized ram disk is read in set root identification from subregion.
Linux identifies linux kernel, and the option that passes to it is set.
Initrd identifies an initialized ram disk.
Embodiment 2
The present embodiment provides a kind of Linux to guide failed recovery device, can realize the method for above-described embodiment 1, and this device at least comprises following each several part.
The built-in core of multiboot manager (GRUB), in the time that Linux guides unsuccessfully, according to equipment or the content of Client-initiated ls order viewing files system, determines GRUB configuration file position;
Wherein, the built-in core of GRUB refers to according to equipment or the content of Client-initiated ls order viewing files system:
The built-in core of GRUB, carries out described ls order, shows the detectable all disks of GRUB, subregion.
The built-in core of GRUB determines that GRUB configuration file position refers to, in the detectable all disks of shown GRUB, subregion, determines GRUB config directory according to user instruction.
Editing and processing module, edits GRUB configuration file, recovers normal boot according to the GRUB configuration file after editor;
GRUB bootstrap module, recovers normal boot according to the GRUB configuration file after editor.
Particularly, editing and processing module, determines behind GRUB configuration file position, resets prefix and root environmental variance;
GRUB bootstrap module, reads the prefix and the root environmental variance that reset, determines the accurate location of GRUB configuration file, reads GRUB configuration file from this accurate location, realizes normal boot.
Other concrete operations of said apparatus can, referring to the corresponding contents of above-described embodiment 1, not repeat them here.
Can find out from above-described embodiment, present techniques scheme is recovered linux guiding quickly and efficiently, thereby improves the availability of system and the security of data.
One of ordinary skill in the art will appreciate that all or part of step in said method can carry out instruction related hardware by program and complete, described program can be stored in computer-readable recording medium, as ROM (read-only memory), disk or CD etc.Alternatively, all or part of step of above-described embodiment also can realize with one or more integrated circuit.Correspondingly, the each module/unit in above-described embodiment can adopt the form of hardware to realize, and also can adopt the form of software function module to realize.The application is not restricted to the combination of the hardware and software of any particular form.
The above, be only preferred embodiments of the present invention, is not intended to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any amendment of making, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.

Claims (8)

1. Linux guides a failed restoration methods, it is characterized in that, the method comprises:
In the time that Linux guides unsuccessfully, the built-in core of multiboot manager (GRUB), according to equipment or the content of Client-initiated ls order viewing files system, is determined GRUB configuration file position;
Described GRUB configuration file is edited;
Recover normal boot according to the GRUB configuration file after editor.
2. the method for claim 1, is characterized in that, the built-in core of GRUB according to the equipment of Client-initiated ls order viewing files system or the process of content is:
Core is carried out described ls order, shows the detectable all disks of GRUB, subregion.
3. method as claimed in claim 2, is characterized in that, determines that GRUB configuration file position refers to:
In the detectable all disks of GRUB that show at described Shell, subregion, determine GRUB config directory according to user instruction.
4. the method as described in claims 1 to 3 any one, is characterized in that, described GRUB configuration file is edited, and recovers normal boot refer to according to the GRUB configuration file after editor:
Determine behind GRUB configuration file position, reset prefix and root environmental variance;
Described GRUB reads the prefix and the root environmental variance that reset, determines the accurate location of GRUB configuration file, reads GRUB configuration file from this accurate location, realizes normal boot.
5. Linux guides a failed recovery device, it is characterized in that, this device comprises:
The built-in core of multiboot manager (GRUB), in the time that Linux guides unsuccessfully, according to equipment or the content of Client-initiated ls order viewing files system, determines GRUB configuration file position;
Editing and processing module, edits described GRUB configuration file;
GRUB bootstrap module, recovers normal boot according to the GRUB configuration file after editor.
6. device as claimed in claim 5, is characterized in that, the built-in core of described GRUB refers to according to equipment or the content of Client-initiated ls order viewing files system:
The built-in core of described GRUB, carries out described ls order, shows the detectable all disks of GRUB, subregion.
7. device as claimed in claim 6, is characterized in that, determines that GRUB configuration file position refers to:
The built-in core of described GRUB, in the detectable all disks of shown GRUB, subregion, determines GRUB config directory according to user instruction.
8. the device as described in claim 5 to 7 any one, is characterized in that,
Described editing and processing module, determines behind GRUB configuration file position, resets prefix and root environmental variance;
Described GRUB bootstrap module, reads the prefix and the root environmental variance that reset, determines the accurate location of GRUB configuration file, reads GRUB configuration file from this accurate location, realizes normal boot.
CN201410313042.0A 2014-07-02 2014-07-02 Linux boot failure recovering method and device Pending CN104077196A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410313042.0A CN104077196A (en) 2014-07-02 2014-07-02 Linux boot failure recovering method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410313042.0A CN104077196A (en) 2014-07-02 2014-07-02 Linux boot failure recovering method and device

Publications (1)

Publication Number Publication Date
CN104077196A true CN104077196A (en) 2014-10-01

Family

ID=51598465

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410313042.0A Pending CN104077196A (en) 2014-07-02 2014-07-02 Linux boot failure recovering method and device

Country Status (1)

Country Link
CN (1) CN104077196A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106020914A (en) * 2016-06-07 2016-10-12 浪潮电子信息产业股份有限公司 Method for regulating multi-controller drive loading sequence under RedHat7
CN106126303A (en) * 2016-07-01 2016-11-16 合信息技术(北京)有限公司 The installation method of (SuSE) Linux OS, Apparatus and system
CN109254915A (en) * 2018-08-29 2019-01-22 郑州云海信息技术有限公司 A kind of localization method and system based on Linux problem breakpoint
CN110018928A (en) * 2019-04-03 2019-07-16 中电科技(北京)有限公司 System backup and restoring method based on firmware
CN110879765A (en) * 2019-11-15 2020-03-13 飞天诚信科技股份有限公司 Method and device for avoiding terminal abnormity

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张小刚: "Linux中GRUB引导故障的修复", 《HTTP://BLOG.SINA.COM.CN/S/BLOG_70C9C4B40101952S.HTML》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106020914A (en) * 2016-06-07 2016-10-12 浪潮电子信息产业股份有限公司 Method for regulating multi-controller drive loading sequence under RedHat7
CN106126303A (en) * 2016-07-01 2016-11-16 合信息技术(北京)有限公司 The installation method of (SuSE) Linux OS, Apparatus and system
CN109254915A (en) * 2018-08-29 2019-01-22 郑州云海信息技术有限公司 A kind of localization method and system based on Linux problem breakpoint
CN110018928A (en) * 2019-04-03 2019-07-16 中电科技(北京)有限公司 System backup and restoring method based on firmware
CN110018928B (en) * 2019-04-03 2024-04-30 昆仑太科(北京)技术股份有限公司 Firmware-based system backup and restore method
CN110879765A (en) * 2019-11-15 2020-03-13 飞天诚信科技股份有限公司 Method and device for avoiding terminal abnormity
CN110879765B (en) * 2019-11-15 2022-01-14 飞天诚信科技股份有限公司 Method and device for avoiding terminal abnormity

Similar Documents

Publication Publication Date Title
US8751783B2 (en) Booting computing devices with EFI aware operating systems
US20060224794A1 (en) Using USB memory device to recover operating system
JP5757509B2 (en) System reset
EP3769224B1 (en) Configurable recovery states
CN104077196A (en) Linux boot failure recovering method and device
US9983791B2 (en) System management controller and method of configuration file backup and recovery
JP6861886B2 (en) Systems and methods for customized operating system conversion
CN105138431A (en) Linux system back-up and restoring method
CN111258666A (en) Reading method and device of computer file, computer system and storage medium
US8375198B2 (en) Boot system and method having a BIOS that reads an operating system from first storage device via an input/output chip based on detecting a temperature of a second storage device
US9852029B2 (en) Managing a computing system crash
KR20180023575A (en) Firmware auto updating method and computer readable recording medium writing firmware auto updating method
US10564894B2 (en) Free space pass-through
US8762699B1 (en) System, apparatus, and method for initiating a reboot of a personal computer system by pressing a button on an attached storage device and causing the operating system on the attached storage device to be booted
US20190138407A1 (en) Systems and methods of deploying an operating system from a resilient virtual drive
US20060069902A1 (en) Method for recovering operating system and user data executed in a computer and its recovery system thereof
CN104778048A (en) Method and device for installing and setting up server web environment on the basis of Linux system
CN100504787C (en) Virtual executing method for installing software, and system
KR102423056B1 (en) Method and system for swapping booting disk
CN104102555A (en) Open-source data backup and recovering method
US11500646B1 (en) Tracking heterogeneous operating system installation status during a manufacturing process
US11775315B2 (en) BIOS code to store operating systems on computer-readable media
Halsey Startup and Repair Troubleshooting
Clark et al. Installing an Operating System
Baldwin The Missing Theory

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20141001