How to upgrade grub to grub2

Source: Internet
Author: User
Grub upgrade to grub2 because most of the company's systems use the traditional GRUB (version 0.97), the later version needs to be upgraded to GRUB2, which is 1.96 or later. let's take a look at grub2's main functions compared with the traditional grub: 1. supports scripts, including conditional syntax and functions. dynamic... grub upgrade to grub2 because most of the company's systems use the traditional GRUB (version 0.97), the later version needs to be upgraded to GRUB2, which is 1.96 or later. let's take a look at grub2's main functions compared with the traditional grub: 1. supports scripts, including conditional syntax and functions. dynamic loading Module 3. rescue Mode 4. customizable Menu, Topic 5. supports graphical boot menus and enhanced boot screen functions 6. the new configuration file structure fully supports UUID. although grub2's default menu looks familiar to grub users, it is quite different. 1. no/boot/grub/menu.1st. It has been/boo/grub. cfg replaces 2. no find command at the grub prompt, and it has become search. 3. grub2 is modular and does not require 'stage1. 5 '. so the bootstrap can be small. 4. the disk partition number is changed. Now the first disk partition is 1 rather than 0. However, the first device is still 0 (not changed. /etc/grub. cfg should not be manually edited. the configuration file for editing is/etc/default/grub and/etc/grub. d/Files in the directory. modifications to all configuration files will not take effect until the update-grub command is executed. view grub version, upgrade to grub2 1root@10.1.1.45 :~ # Grub-install-v2grub-install (gnu grub 0.97) 01root@10.1.1.45 :~ # Dpkg-I grub-common_1.96 + 20080724-16_amd64.deb02 (Reading database... 35648 files and directories currently installed .) 03 Preparing to replace grub-common 1.96 + 20080724-16 (using grub-common_1.96 + 20080724-16_amd64.deb )... 04 Unpacking replacement grub-common... 05 Setting up grub-common (1.96 + 20080724-16 )... 06root@10.1.1.45 :~ # Dpkg-I grub-pc_1.96 + 20080724-16_amd64.deb07Selecting previously deselected package grub-pc.08dpkg: considering removing grub in favor of grub-pc... 09 dpkg: yes, will remove grub in favor of grub-pc.10 (Reading database... 35648 files and directories currently installed .) 11 Unpacking grub-pc (from grub-pc_1.96 + 20080724-16_amd64.deb )... 12 Setting up grub-pc (1.96 + 20080724-16 )... 13 Generating core. Img14Saving menu. lst backup in/boot/grub/menu. lst_backup_by_grub2_postinst15Running update-grub Legacy to hook our core. img in it16 Searching for GRUB installation directory... found:/boot/grub17 Searching for default file... found:/boot/grub/default18 Testing for an existing GRUB menu. lst file... found:/boot/grub/menu. lst19 Searching for splash image... none found, skipping... 20 Found G RUB 2:/boot/grub/core. img21 Found kernel:/boot/vmlinuz-2.6.26-2-amd6422 Updating/boot/grub/menu. lst... done23 24 Updating/boot/grub. cfg... 25 Found linux image:/boot/vmlinuz-2.6.26-2-amd6426Found initrd image:/boot/initrd. img-2.6.26-2-amd6427done28Processing triggers for man-db... 1. there will be a prompt during this period. after "OK" is selected, the next option allows you to add a menu item in the normal GRUB menu to test GRUB2. selecting "Yes" will add a Chainload item in the GRUB menu. when GRUB is started next time You can select a normal GRUB menu item or switch control to GRUB 2 through the Chainload menu item. 2. the next step is to import content from menu. lst of GRUB to [Linux command line] (for example) or [Linux default command line]. These projects allow users to enter any special commands, such as quiet, splash, noapic, or other commands of the same nature. GRUB 2 will automatically import these configurations. Generally, you do not need to modify and select "OK 」. If necessary, the options can be added later. When grub2 has been installed, you also need to change several parameters 01root@10.1.1.45: grub # cat/etc/default/grub02 # This file is sourced by update-grub, and its variables are propagated03 # to its children in/etc/grub. d/04GRUB_DEFAULT = 005GRUB_TIMEOUT = 506GRUB_DISTRIBUTOR = 'lsb _ release-I-s 2>/dev/null | echo Debian '07grub _ line_linux = "console = tty0 console = ttyS1, 115200 "# add the console connection parameters in the kernel boot to ensure that the server can be connected through ipmi. because the machine model is R710, 115200.08 # U is used. Ncomment to disable graphical terminal (grub-pc only) 10GRUB_TERMINAL = console # select console as the terminal device to ensure that the ipmi connection is correctly colored. 11 # Uncomment if you don't want GRUB to pass "root = UUID = xxx" parameter to Linux12 # GRUB_DISABLE_LINUX_UUID = true1root@10.1.1.45: # vi/etc/inittab2T1: 23: respawn: /sbin/getty-L ttyS1 115200 vt100 ensure that the login does not show garbled 1root@10.1.1.45: grub # update-grub effective configuration file 2 Updating/boot/grub. cfg... 3 Found linux image: /Boot/vmlinuz-2.6.26-2-amd644Found initrd image:/boot/initrd. after the img-2.6.26-2-amd645done restarts the machine, you can see the updated grub traditional menu welcome screen and a "Chainload into GRUB 2" menu item to test GRUB 2 installation. If you select the Chainload option, the control is directed to GRUB 2 and the GRUB2 menu is displayed. Use the following command to completely upgrade to grub2. 01root@10.1.1.45 :~ # Upgrade-from-grub-legacy02 03 Installing GRUB to Master Boot Record of your first hard drive... 04 05 Installation finished. no error reported.06This is the contents of the device map/boot/grub/device. map.07Check if this is correct or not. if any of the lines is incorrect, 08fix it and re-run the script 'grub-install '. 09 10 (hd0)/dev/hda11 12 GRUB Legacy has been removed, but its configuration files Have been preserved, 13 since this script cannot determine if they contain valuable information. if14you wowould like to remove the configuration files as well, use the following15command: 16 17 rm-f/boot/grub/menu. the following section describes the main configuration directories and files used by grub2: 1. /boot/grub. cfg: a file similar to/boot/grub/menu.1st in grub. contains grub2 menu information. manual editing is not required. it should be updated by update-grub. many items will be displayed in the/boot/grub Directory *. mod file, which indicates the modular nature of grub2. when grub2 is started, different modules are loaded as needed. 01root @ 10.1.1.45: grub # ls02acorn. mod _ bsd. mod device. map gzio. mod lnxboot. img multiboot. mod reiserfs. mod vbe. mod03affs. mod bsd. mod diskboot. img halt. mod loadenv. mod normal. mod search. mod vbetest. mod04afs. mod cat. mod echo. mod hello. mod loopback. mod ntfscomp. mod serial. mod vga. mod05amiga. mod cdboot. img elf. mod help. mod ls. mod ntfs. mod sfs. mod video. mod06aout. mod _ chain. mod ext2.mod hexdump. mod lspci. mod pa Rtmap. lst sleep. mod videotest. mod07apple. mod chain. mod fat. mod hfs. mod lvm. mod pci. mod sun. mod xfs. mod08ascii. pff cmp. mod font. mod hfsplus. mod memdisk. mod pc. mod terminal. mod09ata. mod command. lst fshelp. mod iso9660.mod menu. lst play. mod terminfo. mod10biosdisk. mod configfile. mod fs. lst jfs. mod menu. lst ~ Png. mod test. mod11bitmap. mod core. img fs_uuid.mod jpeg. mod menu. lst_backup_by_grub2_postinst pxeboot. img tga. mod12blocklist. mod cpio. mod gfxterm. mod kernel. img minix. mod raid. mod udf. mod13boot. img cpuid. mod gpt. mod _ linux. mod moddep. lst read. mod ufs. mod14boot. mod default grub. cfg linux. mod _ multiboot. mod reboot. mod vbeinfo. mod 2. /etc/default/grub: contains the original GRUB traditional menu. the configuration content in the first half of the lst and The append configuration after each kernel configuration. 3. /etc/grub. d/: the files in this directory will be read when the update-grub command is executed, and the commands will be combined into/boot/grub. cfg. The order of menu items in the grub. cfg menu is determined by the order of files in this directory. Files with a small numeric prefix file name will be executed first. During update-grub execution, only executable files will be output to grub. cfg. The default file in this directory is: 00_header. configure the initial display Project, sample mode, default options, and time limit. These configuration information is generally imported from/etc/default/grub. Users generally do not need to make any changes to this file. 05_debian_theme the configurations in this file are used to configure the boot screen, text color, high brightness options, and themes. If there is no boot screen, this file will configure a monochrome topic to display the initial menu screen. How to configure the font display and boot screen will be discussed in the boot screen and topic sections. 10_hurd: Locate the location of the Hurd kernel. Not used currently. 10_linux: Locate the root device kernel in use in the current operating system. This information will be used to create the names of these kernels displayed in the menu. 30_os-prober this file and OS-prober are used to search for Linux and other operating systems. The results will be stored in grub. cfg based on the content in this file. This file is divided into four paragraphs, representing the four types of operating systems processed by the script: Windows, Linux, OSX, and Hurd. The variables in this script are used to specify the name display format in the/boot/grub. cfg and GRUB 2 menus. Users familiar with basic scripts can modify these variables to change the display format of menu options. In addition, you can modify the/etc/default/grub option to close the script. 40_custom is used to add a template for a custom menu item. it will be embedded into grub. cfg when the update-grub command is executed. The content in this file will be directly imported to/etc/default/grub without changing the line "exec tail-n + 3 $0" and the default comment. cfg. 1root@10.1.1.45: grub. d # ll2total 283-rwxr-xr-x 1 root 1897 root 1143 root 2369 root 84 40_custom9-rw-r -- r -- 1 root 483 README when upgrading other debian machines, after restarting the machine, grub encountered the error: unknown command 'initrd '. later, Google found that the problematic command list is generally in the following format: 1 menuentry "Debian GNU/Linux, linux 2.6.32-2-amd64 "{2 set root = (hd0, 1) 3 search -- fs-uuid -- set c618b7d1-4769-4dfe-8169-66e9f8aace434 linux/boot/vmlinuz-2.6.32-2-amd64 root = UUID = c618b7d1-4769-4dfe-8169-66e9f8aace43 ro console = tty0 console = ttyS1, 1152005 initrd/boot/initrd. img-2.6.32-2-amd646} the solution is to delete the line of search.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.