CN102419710B - Method for repairing Grub boot loader based on Anaconda - Google Patents

Method for repairing Grub boot loader based on Anaconda Download PDF

Info

Publication number
CN102419710B
CN102419710B CN201010294581.6A CN201010294581A CN102419710B CN 102419710 B CN102419710 B CN 102419710B CN 201010294581 A CN201010294581 A CN 201010294581A CN 102419710 B CN102419710 B CN 102419710B
Authority
CN
China
Prior art keywords
boot loader
grub
grub boot
repairing
configuration
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.)
Active
Application number
CN201010294581.6A
Other languages
Chinese (zh)
Other versions
CN102419710A (en
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.)
China Standard Software Co Ltd
Original Assignee
China Standard Software 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 China Standard Software Co Ltd filed Critical China Standard Software Co Ltd
Priority to CN201010294581.6A priority Critical patent/CN102419710B/en
Publication of CN102419710A publication Critical patent/CN102419710A/en
Application granted granted Critical
Publication of CN102419710B publication Critical patent/CN102419710B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention relates to a method for repairing a Grub boot loader based on Anaconda installation program. In the invention, by abandoning the traditional method for repairing the Grub boot loader through a grubinstall command, the repairing of the Grub boot loader is realized by adding corresponding function module to the Anaconda installation program. In addition, according to the invention, an encryption function to the Grub boot loader is realized, kernel parameters are transmitted, and an installation position of the Grub boot loader can be customized. The method mainly comprises three steps of registering, configuring and repairing, and overcomes the defects of the prior art that the repairing of the Grub boot loader is incomplete, the operation steps are complicated, the requirements on the capability of an executor are high, an operation interface is unfriendly, and the like.

Description

Repair the method for Grub Boot loader based on Anaconda
Technical field
The present invention relates to a kind of method of the Grub of reparation Boot loader, under especially a kind of linux system, repair the method for Grub Boot loader based on Anaconda.
Background technology
Conventionally user installation (SuSE) Linux OS is all that Grub is arranged on MBR, but, for various reasons, Windows operating system is for example installed on the machine that Linux is installed again or cleans data because of maloperation, may remove the data of MBR, thereby cause linux system cannot find Grub cannot start mounted linux system.
Main solution has following three kinds of modes at present:
1) Linux environment Live CD repairs Grub
At present the (SuSE) Linux OS of main flow all provides Live CD as Ubuntu and Fedora series, and the environment providing by Live CD can utilize the order of repairing boot to repair it, and its concrete operations flow process as shown in Figure 1;
2) Linux environment rescue pattern is repaired Grub
When such as RHEL5 optical disk start-up, provide rescue pattern to be used for repairing the mistake of installation system, same this pattern also can be repaired Grub Boot loader, and its specific works flow process is as shown in Figure 2;
3) Windows environment grub4dos instrument is repaired Grub
Under Windows environment, can utilize grub4dos instrument to enter Grub environment, repair Grub by related command and parameter, its concrete operations flow process as shown in Figure 3.
Generally the solution of application is exactly above three kinds of modes at present.The principle that above three kinds of modes are repaired Grub Boot loader is all the same, and by operation, external command---grubinstall realizes, and all has a common problem: ease for use is poor.Aspect ease for use, there is following problem in above three kinds of solutions:
1) repair Grub Boot loader imperfection
Prior art scheme only provides basic repair to Grub Boot loader, has only completed to repair can guide operating system afterwards, lacks the function that realizes self-defined Grub Boot loader by Transfer Parameters.
2) operation steps complexity
Can find out by above operational flowchart, the reparation that completes Grub Boot loader at least needs 5 complicated steps, and almost each step needs to input number order and parameter, input when inaccurate and also may need restarting systems, bring unnecessary trouble.
3) higher to implementer's Capability Requirement
Above scheme require implementer to linux system and Grub working machine be shaped with deep enter understanding can implement, and for general Linux user, this repair mode is a kind of challenge.
4) operation interface is unfriendly
Existing several solution is not that a unified software or step are repaired Grub, therefore the software interface of neither one the whole series is for user interactions.User can only pass through editor's configuration file, and by carrying out and repair order in the mode of order line in terminal, brings very large inconvenience for repairing to operate.
5) can not encrypt Grub Boot loader
Existing solution is not provided as the method that Grub Boot loader is encrypted, and has potential safety hazard the system of having relatively high expectations for safety coefficient.
6) can not transmit kernel parameter for Grub Boot loader
Existing solution can not be transmitted kernel parameter, the kernel parameter guiding according to the preference of oneself or demand self-defining operation system cannot meet user-initiated actions system time.
7) installation site that can not self-defined Grub Boot loader
Existing solution can not self-defined Grub Boot loader installation site.Existing settling mode can only be installed to MBR by Grub Boot loader, does not support to be installed to other subregion.Can not meet the demand of User Defined installation site.
The explanation of nouns of the relevant technical terms the present invention relates to:
Grub:GNU GRUB(is called for short " GRUB ") be a multiple operating system start-up routine from GNU project.GRUB is the realizations that start standard more, and it allows user can in computing machine, have multiple operating system simultaneously, and in the time of computer starting, selects to wish the operating system of operation.GRUB can be used for selecting the different kernels on operating system partition, also can be used for transmitting start-up parameter to these kernels.
MBR: full name is Master Boot Record, the i.e. Main Boot Record of hard disk.
Live CD: can directly guide the CD into available linux system.
The reparation pattern of the rescue pattern of Linux: Linux, can be directly starts from boot media, enters reparation and installed the repairing environment of (SuSE) Linux OS.
Grub4dos:grub4dos is outstanding two (many) systems guiding softwares, uses GRUB4DOS can guide very easily various operating system, such as DOS, Windows, Linux etc.
Anaconda installation procedure: Anaconda is the installation administration formula of Red Hat Linux and Fedora.It is write as with Python and C language, is write as with the PyGTK of figure and the python-newt interface of word.It can be used for Auto-mounting configuration, makes the user can be with minimum supervision operation.
Summary of the invention
The invention provides the different another kind of recovery technique of a kind of and existing Grub Boot loader recovery technique, Grub Boot loader is repaired in the use grubinstall order that is abandoning tradition, but the routine interface providing by python routine call Anaconda is realized the reparation to Grub Boot loader.
The present invention is dissolved into the new method of repairing Grub Boot loader in Linux installation procedure Anaconda, set it as some steps of installation process, for user provides the friendly interactive interface of operation and succinct easy-to-use operation steps, make user can fast, accurately repair Grub Boot loader.
The technical solution used in the present invention is: the program of repairing " Grub Boot loader " is realized as a functional module of (SuSE) Linux OS Anaconda installation procedure.The realization of this method comprises the following steps:
1) step of repairing " Grub Boot loader " is registered to Anaconda installation procedure (step S1): the execution sequence that each step of " Grub Boot loader " is repaired in definition has played the effect of allocating task and guide in whole process.
2) realize and repair class step (step S2), realize the program class of reparations " Grub Boot loader ": definition start Anaconda installation procedure until repair " Grub Boot loader " complete required experience in steps with some initialization definitions.
3) the program class configuration step of reparation " Grub Boot loader ", comprises basic configuration (step S3a) and advanced configuration (step S3b).Wherein, basic configuration option (step S3a) comprises the label of Grub Boot loader, and the password of Grub Boot loader is set; Advanced configuration option (step S3b) comprises the installation site of Grub Boot loader, whether uses LBA32, and inputs the interface of kernel parameter for user.
4) carry out the program class (step S5) of repairing " Grub Boot loader ", complete repair: the Grub Boot loader configuring is arranged on to the position of appointment, completes the repair to impaired " Grub Boot loader ".
5) exit installation procedure (step S6): the careful follow-up of repairing Grub Boot loader.
The invention provides a kind of robotization and repair the method for Grub Boot loader, overcome that prior art is repaired Grub Boot loader operation steps complexity, high to implementer's Capability Requirement, operation interface is unfriendly, cannot encrypt Grub Boot loader, cannot for Grub transmission kernel parameter, cannot self-defined Grub Boot loader installation site etc. defect, realize a kind of method of more easy-to-use, reparation Grub Boot loader that function is more perfect.
The present invention is compared with prior art having very large improvement aspect ease for use and interactivity, be mainly reflected in the following aspects:
1) with respect to the complex operations of prior art, the present invention provides a unified instrument for repairing Grub Boot loader, is integrated in operating system installation step by it;
2) prior art of comparing does not provide interactive interface, and the present invention provides a friendly graphical human-computer interaction interface for repairing Grub Boot loader, user-friendly;
3) compare and prior art, the method for reparation Grub Boot loader provided by the invention more succinctly, more easy to operate, only need through selecting repair, configure, determine three steps;
4) compare and prior art, the easier left-hand seat of method provided by the invention, requires lowlyer to implementing personnel's technical experience, the invention provides default option, even if also can complete the repair of Grub Boot loader without any configuration;
5) with respect to prior art; the present invention has done further perfect to the method for repairing " Grub Boot loader "; realize the advanced configuration of Grub Boot loader, comprise the encipherment protection to Grub Boot loader, the installation site of Grub Boot loader being transmitted to kernel parameter and self-defined Grub Boot loader.Wherein encrypt Boot loader and can be encrypted protection to operating system, prevent from not allowing the people who starts the operating system illegally to start system; Grub Boot loader is transmitted to kernel parameter and can realize the self-defined mode that system starts, the detailed information while starting system, shielding harness startup as graphics mode etc.; The installation site of self-defined Grub boot can self-definedly be installed to Grub Boot loader on MBR or subregion head.
Accompanying drawing explanation
Fig. 1 is that existing Linux environment Live CD repairs Grub process flow diagram;
Fig. 2 is that existing Linux environment rescue pattern is repaired Grub process flow diagram;
Fig. 3 is that existing Windows environment grub4dos instrument is repaired Grub process flow diagram;
Fig. 4 is that the present invention repairs Grub Boot loader process flow diagram;
Fig. 5 is for encrypting Grub Boot loader process flow diagram;
Fig. 6 is for transmitting Grub Boot loader kernel parameter process flow diagram;
Fig. 7 is self-defined Grub Boot loader installation site process flow diagram.
Embodiment
In order to make the technology used in the present invention, means and advantage thereof, now lift preferred embodiment and coordinate the accompanying drawing to describe in detail as after, this,, only for explanation, is not subject to the restriction of following embodiment in patented claim.
The present invention is take (SuSE) Linux OS installation procedure Anaconda as basis, and the method for repairing Grub Boot loader is incorporated into and is realized in Anaconda mechanism.Interactive interface of the present invention comprises graphical interfaces and two kinds of modes of textual interface, corresponds respectively to figure Installation Modes and the character Installation Modes of Anaconda installation procedure.Specific embodiment of the invention process comprises the following steps:
1) step of repairing Grub Boot loader is registered to Anaconda installation procedure (step S1)
This step is to realize the prerequisite of repairing Grub loading boot in installation process, and it has defined the execution sequence of repairing each step of Grub Boot loader, has played the effect of allocating task and guide in whole process.
In Anaconda program, there is individual dispatch.py file, this file is realized the scheduling and controlling to installation steps, it has the data structure installSteps of a list type, this data structure definition all installation steps of installation procedure, all installation steps all have to register into installSteps and could in installation process, be scheduled and carry out.The step that Grub Boot loader is repaired in registration is that the form that institute that repair process is comprised defines with installSteps in steps adds in installSteps list, installSteps list comprises front end procedure and rear end step, wherein front end procedure is visual providing and the step of user interactions, rear end step refers to the step at running background, not with user interactions.Registered Grub boot and repaired after step, these steps have just possessed the pacing items of being dispatched and carrying out by Anaconda installation procedure.
2) realize and repair class step (step S2), the program class of repairing Grub Boot loader
Repair Grub Boot loader class and inherited the BaseInstallClass class in installclass.py file, this class definition basic installation class.Repaired the class definition of Grub Boot loader and started Anaconda program until repair guide required experience in steps with some initialization definitions.These work are mainly done by its member function setSteps, and the interface function setStepList of this function call dispatch realizes this function.
This step also can realize it by other method, for example, realize by the interface function setStepList that creates function call dispatch, or call in other way dispatch interface function setSteplist and realize.
3) to repairing the program class configuration of " Grub Boot loader ", comprise basic configuration (step S3a) and advanced configuration (step S3b)
Basic configuration option (step S3a) comprises the label of Grub Boot loader, and the password of Grub Boot loader is set; Advanced configuration option (step S3b) comprises the installation site of Grub Boot loader, whether uses LBA32, and inputs the interface of kernel parameter for user.User selects whether to carry out advanced configuration (step S4) in basic configuration, if advanced configuration switch opens enters advanced configuration option, otherwise skips advanced configuration.
The option that the program class of Grub Boot loader is repaired in configuration is and the part of user interactions, in Anaconda installation procedure, to comprise graphical interfaces and two kinds of patterns of textual interface with the interface of user interactions.Therefore the enforcement of configuration Grub Boot loader interactive interface need to realize graphic model interface and character pattern interface.Embodiment is to create respectively graphical interfaces configuration class and textual interface configuration class.Patterned basic configuration class and advanced configuration class are inherited InstallWindow class, and realize the interface of its parent.In graphical configuration class, realize patterned interactive interface with GTK programming, user's basic configuration option and advanced configuration option are provided, comprise Grub boot label, password setting, boot installation site, whether use the control such as LBA32 and kernel parameter and explanation; Programme and realize textual interface with snap, for user provides basic configuration option and advanced configuration option, identical character control and explanation under realization and graphical pattern.Complete after configuration user, each option is associated with to corresponding with it Grub correlation parameter, be Grub Boot loader parameters value, complete the work of reparation " Grub Boot loader ".
Wherein, the present invention has realized Grub Boot loader and has encrypted, transmitted for Grub Boot loader the functions such as kernel parameter, self-defined Grub Boot loader installation site.The present invention enumerates following specific implementation:
Encrypt Grub Boot loader as shown in Figure 5: first realize the user interactions interface (step S311) that Grub Boot loader is encrypted.Rear end program is obtained after encrypted ones (step S312), for bootloader object arranges encrypted ones value (step S313), and encrypted ones is write to configuration file (step S314).After the reparation of Grub Boot loader completes, restart system, Grub can Automatically invoked program require input Grub password.
Transmit Grub Boot loader kernel parameter as shown in Figure 6: the interface (step S321) that provides user to input in advanced configuration step, input self-defining kernel parameter for user.Rear end program receives the kernel parameter (step S322) of user's input, and formats kernel parameter (step S323).Bootloader object has the attribute args of kernel parameter, by kernel parameter assignment to args attribute (step S324).In the time repairing Grub Boot loader, these kernel parameters are written to the configuration file grub.conf(step S325 of Grub Boot loader).In the time that user uses Grub Boot loader guidance system, system can guide in the mode with kernel parameter like this.
Self-defined Grub Boot loader installation site is as shown in Figure 7: the user interface (step S331) of selecting installation site is provided, comprises first sector that is installed to MBR or is installed to boot partition.Rear end program is obtained positional information (step S332), and installation site setup of attribute value (step S333) to bootloader object, after carry out and install while repairing Grub Boot loader, installation procedure can, according to this property value, be installed to Grub Boot loader the position (step S334) of appointment.
4) carry out Grub Boot loader (step S5) is installed, complete repair
The enforcement of this function is completed by these installation steps of instbootloader, it calls the writeBootloader interface of bootloader.py, according to the configuration parameter that Grub Boot loader is installed, the Grub Boot loader configuring is arranged on to the position of appointment, completes the configuration effort to impaired Grub Boot loader.
5) exit installation procedure (step S6)
Complete and repair Grub Boot loader backed off after random installation procedure, this step is the careful follow-up of repairing Grub Boot loader, according to the style of Anaconda installation system and upgrade-system, repair Boot loader and also designed the option of repairing the successful backed off after random Anaconda installation procedure of guiding or restarting system, offer the interactive interface that user exits Anaconda installation procedure, and this interactive interface comprises two kinds of graphic model and character patterns.

Claims (9)

1. the method for the reparation Grub Boot loader based on Anaconda installation procedure under a linux system, it is characterized in that, the routine interface providing by python routine call Anaconda installation procedure, and the program of " Grub Boot loader " of repairing is as a functional module of Anaconda installation procedure, realize the reparation to " Grub Boot loader ", described method specifically comprises the following steps:
1) step is repaired in registration, and the step of repairing " Grub Boot loader " is registered in Anaconda installation procedure;
2) realize repair function, realize the program class of a reparation " Grub Boot loader ";
3) configuration step, carries out configuration to the program class of repairing " Grub Boot loader ", comprises basic configuration and advanced configuration;
4) execution step, carries out the program class of repairing " Grub Boot loader ", completes repair.
2. the method for claim 1, it is characterized in that, described step 1) be by repair " Grub Boot loader " comprise institute in steps with installSteps define form add in installSteps list, installSteps list comprises front end procedure and rear end step, wherein front end procedure provides and the step of user interactions for visual, rear end step refers to the step at running background, not with user interactions.
3. the method for claim 1, it is characterized in that, described step 2) be the interface function setStepList that is called dispatch by member function setSteps, or realize definition and start Anaconda installation procedure until repair institute that " Grub Boot loader " complete required experience in steps and initialization definitions by creating the interface function setStepList of function call dispatch.
4. the method for claim 1, is characterized in that, described step 3) comprises that creating respectively graphical interfaces configures class and textual interface configuration class, for user provides basic configuration option and advanced configuration option.
5. method as claimed in claim 4, is characterized in that, described basic configuration option comprises the label of Grub Boot loader, and the password of Grub Boot loader is set; Described advanced configuration option comprises the installation site that Grub Boot loader is set, and whether uses LBA32, and inputs the interface of kernel parameter for user; User can select whether carry out advanced configuration in basic configuration option, if advanced configuration switch opens enters advanced configuration option, otherwise skips advanced configuration.
6. method as claimed in claim 5, is characterized in that:
The concrete grammar of the password of the described Grub of setting Boot loader comprises: first realize the user interactions interface that Grub Boot loader is encrypted, obtain encrypted ones by rear end program, for bootloader object arranges encrypted ones value, and encrypted ones is write to configuration file;
The interface that the described user of confession inputs kernel parameter can supply user input self-defining kernel parameter, and rear end program receives the kernel parameter of user's input, and formats this kernel parameter; Bootloader object has the attribute args of kernel parameter, and these kernel parameter assignment, to args attribute, in the time repairing " Grub Boot loader ", are written to these kernel parameters to the configuration file of " Grub Boot loader ";
The concrete grammar of the installation site of the described Grub of setting Boot loader comprises: the user interface of selecting installation site is provided, comprise first sector that is installed to MBR or is installed to boot partition, obtain positional information by rear end program, and installation site setup of attribute value to bootloader object, carry out repair " Grub Boot loader " and program class process in, repair procedure, according to this property value, is installed to Grub Boot loader the position of appointment.
7. method as claimed in claim 4, it is characterized in that, described step 3) completes after configuration user, each config option is associated with to the Grub correlation parameter corresponding with each config option, be Grub Boot loader parameters value, complete the configuration effort of the program class to repairing " Grub Boot loader ".
8. the method for claim 1, it is characterized in that, described step 4) is the writeBootloader interface by instbootloader function call bootloader.py, the position that according to the configuration parameter of the program class of reparation " Grub Boot loader ", " the Grub Boot loader " configuring is arranged on to appointment, completes the repair to impaired " Grub Boot loader ".
9. the method for claim 1, is characterized in that, described method has also been included in the step of reparation " Grub Boot loader " backed off after random Anaconda installation procedure.
CN201010294581.6A 2010-09-28 2010-09-28 Method for repairing Grub boot loader based on Anaconda Active CN102419710B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010294581.6A CN102419710B (en) 2010-09-28 2010-09-28 Method for repairing Grub boot loader based on Anaconda

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010294581.6A CN102419710B (en) 2010-09-28 2010-09-28 Method for repairing Grub boot loader based on Anaconda

Publications (2)

Publication Number Publication Date
CN102419710A CN102419710A (en) 2012-04-18
CN102419710B true CN102419710B (en) 2014-05-28

Family

ID=45944131

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010294581.6A Active CN102419710B (en) 2010-09-28 2010-09-28 Method for repairing Grub boot loader based on Anaconda

Country Status (1)

Country Link
CN (1) CN102419710B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109254915A (en) * 2018-08-29 2019-01-22 郑州云海信息技术有限公司 A kind of localization method and system based on Linux problem breakpoint

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6385766B1 (en) * 1999-05-20 2002-05-07 Dell Usa L.P. Method and apparatus for windows-based installation for installing software on build-to-order computer systems
CN1932765A (en) * 2005-09-15 2007-03-21 英业达股份有限公司 Method for setting operating system with additional drive program and structure
TW200823652A (en) * 2006-11-23 2008-06-01 Inventec Corp Computer platform boot block program corruption recovery handling method and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6385766B1 (en) * 1999-05-20 2002-05-07 Dell Usa L.P. Method and apparatus for windows-based installation for installing software on build-to-order computer systems
CN1932765A (en) * 2005-09-15 2007-03-21 英业达股份有限公司 Method for setting operating system with additional drive program and structure
TW200823652A (en) * 2006-11-23 2008-06-01 Inventec Corp Computer platform boot block program corruption recovery handling method and system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
使用多重启动管理器GRUB引导Linux系统;白伸伸;《甘肃科技纵横》;20071231;第35卷(第6期);21-22 *
白伸伸.使用多重启动管理器GRUB引导Linux系统.《甘肃科技纵横》.2007,第35卷(第6期),21-22.

Also Published As

Publication number Publication date
CN102419710A (en) 2012-04-18

Similar Documents

Publication Publication Date Title
JP6931684B2 (en) Cloud-based target debugging
US7529990B2 (en) Systems and methods for managing multi-device test sessions
CN105487864B (en) The method and apparatus of Code automatic build
CN103336705B (en) Automatic transcoding between script process and Workflow system and semantic self adaptation
US6421822B1 (en) Graphical user interface for developing test cases using a test object library
CN103365262A (en) Apparatus and method for determining operation compatibility between field devices
CN103136018A (en) Setting method and setting system of basic input/ output system (BIOS)
KR20110063320A (en) Automated form layout based upon usage patterns
JP2016541037A (en) Automated commissioning system and method for virtualized distributed control system, tangible computer readable storage medium
JP2008538026A (en) Modular image download system
CN111190598B (en) Gas turbine monitoring software picture configuration method based on control library drag-type development
US7251724B2 (en) Device environment configuration system and method, and data storage therefor
CN103914315A (en) Configuration method of drivers
CN109787957B (en) Configuration method of configuration file and related device
WO2013190714A1 (en) Automatic operation system and method for automating operation
EP3563232A1 (en) Methods and systems for verifying a software program
CN102419710B (en) Method for repairing Grub boot loader based on Anaconda
CN110018856A (en) The method that dynamic modifies UEFI boot sequence
CN104137074A (en) Optimization of resource usage in a multi-environment computing system
JPH0855042A (en) Method for programming of data processing system
CN108089854A (en) Device PCI drives development system under a kind of LINUX system
KR20090110486A (en) method of robot control code generation and apparatus thereof
EP3872625A1 (en) Method and system for managing an app
US10545729B2 (en) Computer program interface
CN101308648B (en) Method of automatic test display apparatus and system thereof

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant