GRUB2 installation and configuration notes

Source: Internet
Author: User
Article Title: installation and configuration notes of GRUB2. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

1 Legend: GRUB 2 supports many background formats, such as JPEG, PND, and TGA. It supports 24 colors, 800x600, 1024x768, and chinese menus. As a result, I was tempted to install it. However, due to the small amount of information on the Internet, it was hard to find my own configuration. But fortunately, it's basically done. Write down and take notes.

Install GRUB 2. I am using Debian Lenny. The installation is quite simple and can be directly executed:
Apt-get install grub2

Grub-pc and grub-common are installed on the system dependencies. The following message is displayed during installation:

GRUB upgrade scripts have detected a GRUB Legacy setup in/boot/grub.
In order to replace the Legacy version of GRUB in your system, it is
Recommended that/boot/grub/menu. lst is adjusted to chainload GRUB 2
From your existing GRUB Legacy setup. This step may be automaticaly
Saved med now.

It's recommended that you accept chainloading GRUB 2 from menu. lst, and
Verify that your new GRUB 2 setup is functional for you, before you
Install it directly to your MBR (Master Boot Record ).

In either case, whenever you want GRUB 2 to be loaded directly from MBR,
You can do so by issuing (as root) the following command:
Upgrade-from-grub-legacy

Note: This prompt indicates that GRUB settings are detected when GRUB 2 is installed. The system will use the old settings for guidance, the New GRUB 2 will be a project guide for the old GRUB. When you confirm that GRUB 2 can be used normally, run upgrade-from-grub-legacy, and the old GRUB will disappear, only the menu of GRUB 2 is left.

Chainload from menu. lst?

Use the old configuration menu. lst to boot GRUB 2? We recommend that you use it here.

The following Linux command line was extracted from the 'kopt' parameter │
│ In GRUB Legacy's menu. lst. Please verify that it is correct, and modify
│ It if necessary.
│ Linux command line:
│ <确定> │

I don't know much about it here, but I didn't enter anything for my own confirmation.

2. After the installation is complete, restart. You will find that the GRUB menu is a little different. There are GRUB 2 projects on the top, and there are some prompts in the middle. When you are sure GRUB 2 can be used normally, use upgrade-from-grub-legacy. If it cannot be booted, the original GRUB settings are retained below and can be directly used.
After you run the upgrade-from-grub-legacy command, the original menu. lst project will be deleted.

3 GRUB 2 settings have changed, not the original menu. lst, but/boot/grub. cfg.
4. Check grub. cfg, learn this file (Note: by default,/boot/grub. cfg is a read-only file. If you modify this file, chmod + w/boot/grub first. cfg)
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by/usr/sbin/update-grub using templates
# From/etc/grub. d and settings from/etc/default/grub
#

### BEGIN/etc/grub. d/00_header ###

Set default = 0
# The default value is 0, which is the first project.

Set timeout = 5
# Wait time

Set root = (hd0, 7)
# Setting root partitions

Search? Fs-uuid? Set 15d9bbc2-a1be-400c-883b-0b038a8174e0

If font/usr/share/grub/ascii. pff; then
# Here, ascii. pff is the default font, and Chinese characters are not supported. If
# To support Chinese characters, change to unicode. pff.

Set gfxmode = 1024x768 # default value: 640x480
# Set the resolution. We recommend that you set the resolution to the same size as the image you want.

Insmod gfxterm
# Insert the gfxterm module. After you set it to unicode. pff, this terminal supports Chinese display.
# Display, it also supports 24-bit Images

Insmod vbe
# Insert the vbe module. GRUB 2 introduces many modules. to use it, you need to add them here.

Insmod png
# For example, if we want to display the png image as the GRUB 2 background, we need to add the previous line.

Insmod jpeg
# Add jpg support. In/boot/grub, you can view the module, files with. mod

Insmod tga
# If you want to use a tga image as the background, this is the file in the gurb2-themes

Terminal gfxterm
# Set the GRUB 2 terminal to gfxterm

Background_image/boot/grub/111.png
# Setting background images

Fi

### END/etc/grub. d/00_header ###

### BEGIN/etc/grub. d/05_debian_theme ###

Set menu_color_normal = cyan/blue
Set menu_color_highlight = white/blue
# Set the color of the menus in Debian by default.
# You will find that the background is completely blocked by blue, and you need to modify blue
# You can change it to black, so that the background will appear.

### END/etc/grub. d/05_debian_theme ###

### BEGIN/etc/grub. d/10_hurd ###

### END/etc/grub. d/10_hurd ###

### BEGIN/etc/grub. d/10_linux ###

Set root = (hd0, 7)

Search? Fs-uuid? Set 15d9bbc2-a1be-400c-883b-0b038a8174e0

Menuentry "Debian GNU/Linux, linux 2.6.26-1-amd64 ″{

Linux/boot/vmlinuz-2.6.26-1-amd64 root = UUID = 15d9bbc2-a1be-400c-883b-0b038a8174e0 ro
Initrd/boot/initrd. img-2.6.26-1-amd64

}
# Here, root = xxxx can also be replaced by/dev/hdax.
# If your system cannot be started and you don't want to take that long.
# In the command line when GRUB 2 is started, use the (hd + tab key to view the partition and uuid

Menuentry "Debian GNU/Linux, linux 2.6.26-1-amd64 (single-user mode )"{

Linux/boot/vmlinuz-2.6.26-1-amd64 root = UUID = 15d9bbc2-a1be-400c-883b-0b038a8174e0 ro single
Initrd/boot/initrd. img-2.6.26-1-amd64

}
# The default GRUB 2 does not seem to have added Windows projects.

Menuentry "start Windows"
# Menu name
{

Set root = (hd0, 1)
# Set Windows partition. Note that GRUB 2 is hard disk from 0 and partition from 1.

Chainloader + 1
# The original GRUB is hd0 and starts from 0

}

### END/etc/grub. d/10_linux ###

### BEGIN/etc/grub. d/30_os-prober ###

### END/etc/grub. d/30_os-prober ###

### BEGIN/etc/grub. d/40_custom ###

# This file is an example on how to add custom entries

### END/etc/grub. d/40_custom ###

5. The above is just my experience of installing GRUB 2 On Debian Lenny. I graduated from high school and E was not very good. If it is in English, it may be slightly different. If any error occurs, please point it out. Thank you.
Update

Add as follows:


(Click to enlarge)

If you use a mobile phone to take a video, the effect is not good. You have to take a partial shot. Sorry.

 

Related Article

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.