Windows linux dual-system startup

Source: Internet
Author: User

Windows linux dual-system startup

If Windows is installed, Linux is installed, grub is installed into mbr, and shutdown abnormally (sometimes it will be restarted) you cannot enter any system to display only one "grub> _" prompt.


This is because your mbr is damaged. If an mbr error occurs, you cannot enter any system. Only one "grub> _" prompt is displayed.

Let's enter the root partition. Enter root in the prompt, but do not press Enter:

Grub> root (

Press the Tab key once. If multiple hard disks exist in the system, GRUB displays a list of possible completed disks, starting with "hd0. If there is only one hard disk, GRUB inserts "hd0 ,". If there are multiple hard disks, continue, Enter a name in ("hd2"), followed by a comma, but do not press Enter. The partially completed root command looks as follows:

Grub> root (hd0,

Now, continue and press Tab again. GRUB displays the list of all partitions on a specific hard disk and their file system types. In my system, press the Tab key to get the following list:

Grub> root (hd0, (tab)

Possible partitions are:
Partition num: 0, Filesystem type is ext2fs, partition type 0x83
Partition num: 1, Filesystem type unknown, partition type 0x82
Partition num: 2, Filesystem type unknown, partition type 0x7
Partition num: 4, Filesystem type is reiserfs, partition type 0x83
Partition num: 5, Filesystem type is reiserfs, partition type 0x83

As you can see, GRUB's interactive hard drive and partition name implementation functions are very organized. In this case, you only need to understand GRUB's novel hard disk and partition naming syntax, and then you can continue the operation.

Mount the kernel

Grub>

To start an operating system, first specify the system on which the disk is to be booted. For example, to boot the operating system of the first partition on the first hard disk

Grub> root (hd0, 0)

Then, if you want to start Windows, Type

Grub> chainloader (hd0, 0) + 1

Note that (hd0, 0) numbers must be changed based on the hard disk and partition. If you want to boot Linux or other systems, Type

Grub> kernel (hd0, 0)/boot/vmlinuz root =/dev/hda1

Note that the hda1 parameter also needs to change with the hard disk and partition. For example, hdb1 is used for booting from the first partition of the second hard disk.

Finally, press boot to start the system.

You cannot determine the command or command parameters at any time. You can press the Tab to get help. Use the up/down key to obtain the command history. In fact, these commands are the boot description of menu. lst. You can also enter the startup command according to the descriptions, and then press boot to guide the system.

We need to enter Linux. After Entering, we can use root to log on and then open the terminal.

The command is as follows (the blue is the command ):
[Root @ localhost ~] # Cd/boot/
[Root @ localhost boot] # grub
Probing devices to guess BIOS drives. This may take a long time.

Gnu grub version 0.97 (640 K lower/3072 K upper memory)

[Minimal BASH-like line editing is supported. For the first word, TAB
Lists possible command completions. Anywhere else TAB lists the possible
Completions of a device/filename.]
Grub> root (hd0, 0) [here (hd0, 0) is my Linux partition. You should check the root file in the grub. conf file in Linux]
Root (hd0, 0)
Filesystem type is ext2fs, partition type 0x83
Grub> setup (hd0)
Setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed/boot/grub/e2fs_stage1_5 (hd0)"... 23 sectors are embedded.
Succeeded
Running "Install/boot/GRUB/stage1 D (hd0) (hd0) 1 + 23 p (hd0, 0)/boot/GRUB/stage2/boot/GRUB/grub. conf "... succeeded
Done.
Grub> quit
Quit
[Root @ localhost boot] #

After restarting, you can access the graphic grub. Now the MBR repair is completed.

Note: Do not rush to restart after the fix. Now let's take a look at grub. conf (menu. (LST) whether there is a problem with the content. Generally, the partition order is changed. conf (menu. (LST.

$ Sudo grub
Grub> root (hd0, 0)
Grub> setup (hd0)
Grub> setup (hd1)

Http://forum.ubuntu.org.cn/viewtopic.php? F = 42 & t = 274182 & START = 30

Installation experience, supplement LZ installation method, hardware environment gateway p-79 raid0, hard disk on the original win7 Partition

Ubuntu 10.04 does not support the fakeraid installer in two aspects: 1. The raid part cannot be formatted (can be identified); 2. Grub 2 does not support fakeraid.

Livedvd is not very important because "Disk utility" can be installed on the network in the livecd environment before installation ", ubuntu 10.04 provides good support for most network adapters or wireless network adapters.
After the disk utility is installed, partition and format the disk, and then run the installation program. Partitions are not formatted during installation. Grub installation fails no matter how you set grub during installation. You need to install grub manually after installation.

Later, according to the LZ method, we also encountered the problem on the 36th floor. In this case, although grub. cfg will be generated, the grub installation is not successful. After a while, it was solved by installing grub 1.
Several key points are as follows (root permission is required for the following commands ):

1. After chroot, reinstall grub to replace grub2
# Apt-get install -- purge grub
# Cp/usr/lib/grub/i386/*/boot/grub/

2. Install grub on MBR
# Fdisk-l/dev/mapper/isw_xxxx // view the physical information of the current RAID disk. Note that the isw_xxxx here is the raid array Device ing, rather than the specific raid logical partition.
View information such as "255 heads, 63 sectors/track, 19458 cylinders" and take notes. This information is important; otherwise, problems may occur when grub is set later.
Next, go to grub shell.
# Grub -- no-curses
Grub> device (hd0)/dev/mapper/isw_xxxx // specify to install grub to MBR, where isw_xxxx is mapped to the device as above
Grub> geometry (hd0) 19458 255 63 // set the physical information of the RAID disk. If the data is incorrect, the command will not return a value. Otherwise, the logical partition is correctly displayed. Note that the parameter format is c h s.
Grub> find/boot/grub/stage1 // find the Linux boot partition and write down the returned value. It should be similar (hd0, x) to indicate the location of the logical partition.
Grub> root (hd0, 2) // set the grub boot Partition
Grub> setup (hd0) // install grub on MBR
Grub> quit // exit grub Shell

Next, configure menu. lst:
# Update-grub // generate the grub configuration file
Use nano to edit/boot/GRUB/menu. lst
Search
# Groot = (hd0, 0)
Change
# Groot = (hd0, 2) // It is the execution result of find, which indicates the start partition of grub.
Later, for users of multiple systems, you also need to add startup options for other systems.
Continue to search, "### begin automagic kernels list", and add information from other systems before this, for example:
Title Windows 7
Rootnoverify (hd0, 1) # use the correct partition for Windows !!!
Makeactive
Chainloader + 1
Note that the boot partition for Windows 7 is (hd0, 1). If it is XP, it should be (hd0, 0)

After exiting Nano, continue to update the grub configuration file:
# Update-grub

3. Configure the dmraid, generate a new initramfs, and load the dmraid when the system starts.
# Echo dm-raid4-5>/etc/initramfs-tools/modules
# Update-initramfs-u
# Echo dm-raid4-5>/etc/modules

Note that after chroot, the permission needs to be reset due to the/location change. If you have the patience, you can set the permissions separately. Here we use a relatively lazy method.
Chmod 775/
Chmod 775/home/User Name
Chown username/home/username

After logout is restarted, grub should be able to run normally.

When grub shell command grub> find/boot/grub/stage1 is executed, if no return value is returned, the command fails. This is probably because the geometry parameter is incorrect and you need to repeat the previous operation. If the find command still fails, it may be because the parameters returned by fdisk are incorrect. If you know the partition in which/or/boot is installed, you can directly execute root (hd0, x) to specify the location of grub, note that in grub, x is counted from 0.

In some cases, Windows 7 may be abnormal. In this case, you can use the Windows 7 installation disk to perform the repair. It may need to be repaired twice before the BOOTMGR of Windows 7 can be restored to normal. I did not encounter the above problems during the installation process. In addition, if Ubuntu cannot be started, it is likely that the file permission settings are incorrect. You can use the root permission to reset the permission in the recovery mode.

The above method also applies to linuxmint

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.