Linux grub2 startup failure solution

  

GRUB is a multi-OS boot program, GRUB 2 adds a lot of new features to GRUB, more practical than GRUB, many friends Linux system operation, will encounter GRUB 2 boot The problem of failure, the following small series will introduce you to the solution to the failure of Linux GRUB2 startup.

update-grub script can be reliably detected kernel, startup files, and add all of Caozuoxitong, your boot menu automatically generated, so you do not have to manually modify them.

We also need to learn how to solve two common faults. When the system is booted, it will stop at the grub prompt, which is a complete GRUB 2 command interface, so don't panic. This means that GRUB 2 can still start and load the normal.mod module (it is located under /boot/grub/[schema]/under the other modules), but your grub.cfg file is not found. If you see grub rescue, this means it can't find normal.mod, so it may not find your startup file.

How did this happen? Because the kernel may change the allocation of drive partition numbers, or if you move your hard drive, or if you manually change some partitions, it is possible to install a new operating system or move some files. In these cases your startup files still exist, but GRUB can't find them. So you can find the startup files in the GRUB prompt, set their location, then boot your system and fix the GRUB configuration.

GRUB 2 Command Line

The GRUB 2 command interface is as powerful as the previous generation GRUB. You can use it to find the boot image, kernel and root file system. In fact, it allows you to bypass permissions and other access controls and fully access all files on your local computer. Some people may think this is a security hole, but you know the old UNIX saying: People who have physical access to the machine are the ones who own it.

When you are prompted by grub, you have many features like the command line interface, such as command history and tab completion. But the grub rescue mode is limited, there is no command history, no tab completion.

If you are practicing on a functioning system, then when the GRUB menu appears, you can press C to open the GRUB command line interface. You can stop the countdown by scrolling through your menu items with the up and down cursor keys. It's safe to experiment with the GRUB command line, because you can't make permanent changes, everything is temporary. If you have seen the grub or grub rescue prompt, it means your performance is coming.

The next few commands can be run in grub and grub rescue mode. The first command you should run is to set up a pager to page long commands. As follows:

grub》set pager=1

There must be no spaces on either side of the equal sign. Let us do a little exploration now. Enter ls to list all the partitions identified by GRUB:

grub ls

(hd0)(hd0,msdos2)(hd0,msdos1)

What is msdos? This means that the system has an old-fashioned MS-DOS partition table instead of a brand new globally unique identifier partition table (GPT). If you are running GPT, it will appear (hd0, GPT1). Now let's see, use the ls command to see what files are in your system:

grub ls (hd0,1)/

lost+found/bin/boot/cdrom/dev /etc/home/lib/

lib64/media/mnt/opt/proc/root/run/sbin/

srv/sys/tmp/usr/var/vmlinuz vmlinuz.old< Br>

initrd.img initrd.img.old

Great, we have found the root filesystem. You can omit the tags for msdos and GPT. If you do not add a slash /after the partition, only the partition information will be listed. You can use the cat command to display any file on the file system:

grub" cat (hd0,1)/etc/issue

Ubuntu14.04 LTS \ \\l

On a multi-boot system, you can tell which Linux system this is through the /etc/issue file.
Previous12Next Total 2 Pages

Copyright © Windows knowledge All Rights Reserved