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 repair GRUB Boot failure in Linux Environment

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Editor today to show you how to repair GRUB boot failure under the Linux environment, the knowledge points in the article are introduced in great detail. Friends who think it is helpful can browse the content of the article with the editor, hoping to help more friends who want to solve this problem to find the answer to the problem. Let's follow the editor to learn more about "how to repair GRUB boot failure in Linux environment".

How to repair GRUB boot failure in Linux environment? The cause of GRUB failure: the GRUB program in MBR is damaged, the grub.conf file is lost, and the boot configuration is incorrect.

The configuration file for grub boot is stored in / boot/grub2/grub.cfg. When this file is corrupted or missing, the Linux host may only be prompted with "grub >" after startup, as shown in the following figure:

Solution: Linux boot will automatically enter the grub boot interface (if you do not enter the grub boot interface, press C to enter)

GNU GRUB version x.x.xxxxx Minimal BASH-like line editing is supported... Grub > first step: find the sector and / boot/grub directory corresponding to the system. Note: assume that the hard disk interface type sd,hd0 corresponds to sda hd1 and corresponds to sdb (hd0) ≠ (hd0) (hd1,gpt2) = (hd1,2) ls (hd1,gpt2)  View (hd1,gpt2) sector information (disk letter, space, etc.) ls (hd1,gpt2) /  View (hd1,gpt2) sector contents (files, text, etc.)

If you print the catalog information for each sector, two situations occur:

1. Ls (hd1,gpt2) displays a Unknow filesystem prompt indicating that this sector is not the system partition we are looking for

2. Ls (hd1,gpt2) display / boot / proc and other system directory information indicates that this sector is the system partition we are looking for.

If you find the system partition for the corresponding sector, you may encounter two situations:

1. / boot/grub is in the A directory.

2. There is / grub in the / boot,B directory under directory A (set prefix= (hd1,gpt2) / grub command is used to load the system kernel in the second step)

Grub > ls (hd0), (hd1), (hd1, gpt1), (hd2,gpt2), (hd3, gpt3)

Step 2: load the system kernel grub > set root=hd1,2 # there is no need for parentheses, but parentheses are fine. There is a difference between hd0 and hd1. Grub > set prefix= (hd1,2) / boot/grub grub > linux / vmlinuz root=/dev/sdb2 # vmlinuz must use TAB completion (may have a suffix). Note that sda or sdb need to see their own actual situation grub > initrd / initrd.img-xxx # TAB completion, multi-kernel version needs to be unified grub > boot

Tip: if you unfortunately enter BusyBox after boot, you can check the log of the error carefully and repeat the second step after rebooting the system (the parameters set above will be cleared after restarting the system).

Step 3: modify grub boot if you successfully enter the system, remember to immediately message grub boot, otherwise the problem still exists after restarting the system.

Sudo update-grub2 # grub2 command (higher version uses grub2) $sudo grub-install / dev/sdb

Step 4: restart the system and restart the system to enter the system reboot normally.

Thank you for your reading, the above is the whole content of "how to repair GRUB boot failure in Linux environment", learn friends to hurry up to operate it. I believe that the editor will certainly bring you better quality articles. Thank you for your support to the website!

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

Development

Wechat

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

12
Report