Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of booting grub-rescue

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces you how to solve the boot grub-rescue problem, the content is very detailed, interested friends can refer to, hope to be helpful to you.

In the actual process of messing with Linux, it is normal to encounter grub-rescue problems. In fact, this problem does not have any technical content, but it depends on the occasion.

I remember that I taught some MM to play Linux, mainly because of my work. Everything was fine, but I was woken up by a phone call in the afternoon. The other end of the phone told me in a hurry that her computer could not start, and there were thousands of reasons why her computer could not start. So I asked her calmly, is there any hint or output?

Then she told me that the word grub resuce appeared on the screen. For such a situation, needless to say, I know that she has broken something. However, according to the online tutorial, it can not be repaired, so after a detailed inquiry, there is this article.

To be honest, grub2 is mainly divided into two parts, one of which is generally written in MBR, while the other is written in the / boot/grub directory of a partition. If grub is not installed correctly, it may cause the above problems.

We can fix such problems in the following ways:

Locate the partition installed by Linux

Associate with temporary grub

Regenerate grub

Let's explain it separately. In this case, the Linux to be modified is Ubuntu 14.04, which is similar for other distributions.

Find the partition

Let's first enter the command ls at the prompt grub rescue > to list all the disk partition information, assuming the following results:

(hd0), (hd0,msdos8), (hd0,msdos7), (hd0,msdos6)

Next, we need to try to list whether the directory / boot/grub exists on a partition. For the partition of the Windows system, you will get an error message of 1 unknow filesystem directly. In other words, we need to do the following:

Ls (hd0,msdosX) / boot/grub

In this case, X represents the number obtained in the partition above, such as the number 8 in msdos8.

If you follow this way, you can find the corresponding partition, which is also the method of online tutorials, but because the boot partition is partitioned separately on her computer, using the above method will show a prompt that the corresponding file does not exist.

Therefore, we need to modify the above method to:

Ls (hd0,msdosX) / grub

Here, we have removed the boot directory so that we can search for the corresponding directory. For cases where the file does not exist when using the ls command, we can do the following:

Ls (hd0,msdosX) /

Make an association

Then, if we find the correct grub directory, we need to associate it with grub. Here, we mainly use the set command to set up and temporarily associate the directory:

Grub resuce > set root= (hd0,msdos6) grub resuce > set prefix= (hd0,msdos6)

The normal startup process of GRUB involves the environment variable prefix of the core image generated by grub-install. The environment variable root is mainly used to load normal modules from the prefix.

Here, we assume that the correct partition is (hd0,msdos6), and we use the set command to set its root and prefix to this partition. Then we need to load:

Grub resuce > insmod normal grub resuce > normal

Here, the normal command reads the / boot/grub/grub.cfg file and runs the menu.

Regenerate grub

In the above way, we can realize the missing grub menu. Don't be happy too early at this time, so this is only a temporary connection, and if you restart, the problem will occur again. To solve this problem, we need to go into Linux and regenerate the grub to modify it:

Cat@cat-pc:~$ sudo update-grub Generating grub configuration file... Found theme: / boot/grub/themes/deepin/theme.txt Found background image: / boot/grub/themes/deepin/background.png Found linux image: / boot/vmlinuz-4.4.0-2-deepin-amd64 Found initrd image: / boot/initrd.img-4.4.0-2-deepin-amd64 Found Windows 7 (loader) on / dev/sda1 done cat@cat-pc:~$ sudo grub-install / dev/sda Installing for i386-pc platform. Installation finished. No error reported.

Here, we assume that you are using a distribution of deepin, and then use update-grub to regenerate the grub menu. Finally, use grub-install to install it on the hard drive.

On how to solve the boot grub-rescue problem to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report