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

Linux boot prompt GRUB what to do

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces Linux boot prompt GRUB how to do, the article is very detailed, has a certain reference value, interested friends must read it!

GRUB is an implementation of the multi-boot specification, which allows users to have multiple operating systems in the computer at the same time and choose which operating system they want to run when the computer starts. GRUB can be used to select different kernels on operating system partitions or to pass boot parameters to those kernels.

Repair method of 1.grub damage and non-restart system

1.1 check the information of the disk first

My computer has only one hard drive sda, so the system must be installed in sda and will be recognized as hd0 in grub.

1.2 simulated demo grub damage

Use the dd command to overwrite the first 400 bytes of the sda hard drive and destroy the bootloader. Here, only the first 446 bytes are destroyed.

Do not restart the computer here, the demonstration here is not to restart the repair of grub.

1.3 enter grub

Use sync to synchronize the operation to disk, and enter grub to enter the interface of grub.

1.4 find kernel partition to install grub

Root (hd0,0) refers to the partition where the kernel is located. Hd0 is the first hard disk, followed by 0 is the first partition.

Setup (hd0) install grub to hd0 hard disk

At this point, the simulated damaged grub has been repaired and can be restarted.

two。 Repair method when grub configuration file is corrupted

2.1 Simulation of corrupted grub.conf profile

Let's first take a look at the grub.conf file and rename grub.conf to grub.conf.bak, so that the simulation grub.conf file is corrupted.

2.2 Interface after restart

Haha, you can't enter the system after rebooting. Give us a grup > prompt.

2.3 start looking for the partition where the kernel is located

Type root (hd0), press the tab key here, and the following partition appears. We only need the partition with a type of 83, so we enter root (hd0,0)

2.4 specify the location of the boot kernel

Enter kernel / press tab and find many folders. We know that the kernel is placed under the boot folder, so enter kernel / boot/vm here and press tab to automatically complete it. Root=/dev/sda1 means to specify the location of the root partition device file, and then enter to confirm it.

2.5 specify the location of the temporary image file

Enter initrd / press tab and find that there are many folders. We know that the temporary image is placed under the boot folder, so enter initrd / boot/initra here and press tab to automatically complete it, and then enter to confirm.

At this point, enter boot to start the system according to the kernel file and temporary image file we set, such as: grub > boot

Haha, after the system is started, successfully enter the system, restore the grub.conf on the line.

The above is all the contents of the article "Linux boot prompt GRUB what to do". Thank you for reading! Hope to share the content to help you, more related 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