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

Centos7 grub damage repair

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

The tester came to me and told me that the test environment could not be remotely operated, but I could ping. After logging in to the virtual machine, I found that the system had been faked dead and could not be operated, so I had no choice but to reset the virtual machine. After the reset, the virtual machine could not enter the system prompt:

Error: can't find command':'

Grub >

1. Manual boot

# failed to repair grub by manual boot! #

Grub > ls

Grub > ls (hd0,msdos1) / grub2 # # separate partition

Grub > insmod xfs

Grub > set root= (hd0,msdos1) (- > this is the boot partition you found in the previous step)

Grub > linux16 / vmlinuz-xxxxx root=/dev/sda1 # I see sda1 when boot partition through rescue mode

Grub > initrd16 / initramfs-.xxxxx.img

Grub > boot

#! Failure! #

2. Repair through rescue mode

(1) the virtual machine loads the centos7 CD-ROM drive, and the BIOS setting is started through dvd.

(2) Select Trobleshooting

(3) Select Rescue a CentOS Linux system

(4) Select 1) Continue

(5) enter the sh interface

Sh-4.2# chroot / mnt/sysimage # change to the root directory

Sh-4.2# cp-r / boot/ / tmp/ # backup boot partition files

Sh-4.2# rm-fr / boot/* # Delete all files under the boot partition

Sh-4.2# mount / dev/cdrom / media # Mount the CD-ROM drive

Sh-4.2# rpm-ivh / mnt/Packages/kernel-3.10.0-514.e17.x86_64.rpm-- force # reinstall the kernel, preferably with the previous version of the kernel

Sh-4.2# grub2-install / dev/sda1 # install grub directory

Sh-4.2# grub2-mkconfig-o / boot/grub2/grub.cfg # repair grub2 configuration file

Sh-4.2# exit

Sh-4.2# reboot

Choose: boot from the hard disk, the system can find the grub normally, find the kernel to boot normally, and the repair is complete.

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