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

Example Analysis of troubleshooting GRUB Boot in linux

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

Share

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

Editor to share with you the linux GRUB boot troubleshooting example analysis, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

Troubleshooting GRUB Boot

I have found that sometimes when Linux starts up, it goes directly to the GRUB command line interface (only the "grub >" prompt), and many users choose to reinstall GRUB or even reinstall the system.

In fact, generally speaking, there are two most common causes of this failure:

First, the option settings in the GRUB configuration file are incorrect.

Second, the GRUB configuration file is missing (there are a few reasons, such as kernel file or image file corruption, loss, / boot directory deletion, etc.)

In the first case, you can boot the system first with the GRUB command and then repair it; in the second case, use the Linux rescue mode to fix it (described later in this article).

First, we need to understand the boot process of the GRUB boot system. The main configuration options in the grub.conf file are as follows:

(note that the GRUB configuration file is / boot/grub/grub.conf, / etc/grub.conf is just a soft link to this file)

Title Fedora Core (2.6.18-1.2798.fc6) root (hd0,0) kernel / boot/vmlinuz-2.6.18-1.2798.fc6 ro root=LABEL=/ rhgb quiet initrd / boot/initrd-2.6.18-1.2798.fc6.img

Where:

The "title" section specifies the system that GRUB boots:

The "root" section specifies the location of the / boot partition:

The "kernel" section specifies the location of the kernel file, the permission attribute is read-only ("ro") when the kernel is loaded, and the location of the root partition is specified (root=LABEL=/)

"initrd" specifies the location of the image file.

So the GRUB boot sequence is to load the / boot partition first, and then load the kernel and the image file in turn.

Case "title Fedora Core (2.6.18-1.2798.fc6)" paragraph was mistakenly deleted

At this point, the system will automatically enter the "GRUB >" command line after startup. To troubleshoot the problem, we can do the following in turn:

1. Find the partition GRUB > find / boot/grub/grub.conf (hd0,0) where the / boot/grub/grub.conf file resides

2. Check grub.conf file error GRUB > cat (hd0,0) / boot/grub/grub.conf it is recommended to back up the grub.conf file after the system is installed. If you have a backup file such as grub.conf.bak, you can view the backup file at this time. Compared with the current file, you can find an error: GRUB > cat (hd0,0) / boot/grub/grub.conf.bak

3. After confirming the error, first complete the GRUB boot through the command line, and then fix the grub.conf file error after entering the system:

1) specify / boot partition root (hd0,0)

2) specify the kernel to load kernel / boot/vmlinuz-2.6.18-1.2798.fc6 ro root=LABEL=/ rhgb quiet

3) specify the location of the image file initrd / boot/initrd-2.6.18-1.2798.fc6.img

Hint: GRUB supports tab key command completion function

4. Launch boot (hd0,0) from the / boot partition

Command-line mode can be invoked in GRUB menu mode by pressing the "c" key, or it can be used to test the newly compiled kernel (setting kernel, initrd to boot the new kernel and image files). Increased knowledge of GRUB boot and Linux system boot will be of great help to this type of troubleshooting.

The above is all the contents of the article "sample Analysis of troubleshooting GRUB Boot in linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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