Use UbuntuLiveCD to install grub

Source: Internet
Author: User
Article Title: Use UbuntuLiveCD to install grub. 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.

Original article connection:
How to install Grub from a live Ubuntu cd.

ThanksCatlett
1. Install mbr (mbr = Master Boot Records, Master Boot Records)
Because windows is installed or mbr is accidentally deleted or changed, the grub boot menu or prompt error may not be visible during startup. The following describes how to recover
(Written in Ubuntu, but it should be applicable to other systems)
Start with Ubuntu livdCD. When the desktop appears, open a terminal and enter:
Sudo grub
Enter
Grub> find/boot/grub/stage1
Find the location of grub files. If multiple linux systems are installed, all the files are displayed. Check the location of Ubuntu/boot/grub /.
Grub> root (hd ?,?)
(Hd ?,?) In Ubuntu, the question mark is replaced by the/boot/grub/position. For example, if the search result of the find command above is hd (), it is root (hd0, 1)
Run the following command to install grub on mbr:
Grub> setup (hd0)
Exit
Grub> quit
Explanations:
Sudo grub gets the grub command interpreter.
Find/boot/grub/stage1 is used to find the location of the stage1 file. It tells us where the grub file is located. Only a small part of grub is placed on mbr, and the other part is located in your boot folder. Grub needs these files for installation.
Finally, setup (hd0) installs grub to hd0. When the hd0 parameter is used but no specific partition is provided, grub is installed in mbr. Grub regards hd0 as the mbr zone of the first hard disk.
Ii. install it in other partitions
Thanks to HT
If you want to install grub on a partition instead of mbr, change setup (hd0) to setup (hdx, y ). X indicates the number of hard disks and Y indicates the number of partitions on the hard disk. The grub counting method starts from 0 (for example, hd0, 1 indicates the first partition on the first hard disk)
3. If grub cannot find the stage1 file or cannot recognize the hard disk
Thanks to TOSK
1. Use livdCD to load/root partitions
Sudo mkdir/mnt/root
Sudo mount-t ext3/dev/sda6/mnt/root
2. Load proc and udev under/mnt/root
Sudo mount-t proc none/mnt/root/proc
Sudo mount-o bind/dev/mnt/root/dev
In this way, grub can recognize your driving instrument. Next step:
Sudo chroot/mnt/root/bin/bash
For more information about chroot, see:
What is chroot?

Linuxfocus.org/ChineseGB/January2002/article225.shtml "target = _ blank>All services in chroot linux
If you want to install grub to mbr, see 1. To install grub to a partition, see 2.
What I have done:
(1) install it on mbr. This machine has three operating systems, which can run well.
(2) install it in a partition. There are also three operating systems on this machine, and the grub menu does not appear at the beginning, because the computer finds the starter from hd0 by default, and then starts from hd2 to solve the problem.
Grub Manual
Gnu grub Manual 0.97
Good luck!

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.