grub损坏修复方法

Posted 一干而尽

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了grub损坏修复方法相关的知识,希望对你有一定的参考价值。

grub菜单加密                                                                                                 
vim /etc/grub.conf                                                                                       
                                                                                                         
default 0                                                                                                
timeout 5                                                                                                
#password=sheng 明文                                                                                       
password --md5 $1$wZnox$FYPXFLNkmYKQVdCR2mYhW0  //md5加密过                                                 
说明:                                                                                                      
[[email protected] ~]# grub-md5-crypt                                                                          
Password:                                                                                                
Retype password:                                                                                         
$1$wZnox$FYPXFLNkmYKQVdCR2mYhW0                                                                          
                                                                                                         
grub.conf配置文件损坏                                                                                          
手动去引导操作系统:                                                                                               
grub> root (hd0,0)                                                                                       
grub> kernel /vmlinuz-2.6.32-573.el6.x86_64 ro root=/dev/mapper/vg_clone-Logvol01                        
grub> initrd /initramfs-2.6.32-573.el6.x86_64.img                                                        
grub> boot  重新引导                                                                                         
                                                                                                         
boot目录下所有文件丢失                                                                                            
恢复步骤;                                                                                                    
1,通过光盘进入修复模式,rescue installed system                                                                     
2、挂载光盘到当前操作系统,shell start shell                                                                          
    df -h                                                                                                
    ls                                                                                                   
    cd /                                                                                                 
    chroot /mnt/sysimage/                                                                                
    cd boot/                                                                                             
    df -h                                                                                                
    lsblk                                                                                                
    mkdir /u01                                                                                           
    mount /dev/sr0 -o loop /u01                                                                          
    cd /u01/Package/                                                                                     
3、安装kernel                                                                                               
    rpm -ivh kernel-2.6.32-431.el6.x86_64.rpm kernel-firmware-2.6*.noarch.rpm --force                    
4、安装grub                                                                                                 
    cd /boot                                                                                             
    grub install /dev/sda                                                                                
5、编辑grub.conf                                                                                            
    cd grub/                                                                                             
6、重启操作系统                                                                                                 
    reboot                                                                                               
                                                                                                         
内核升级                                                                                                     
方法一:yum安装                                                                                                
方法二:源码编译安装,官网www.kernel.org                                                                              
======================================================================                                   

以上是关于grub损坏修复方法的主要内容,如果未能解决你的问题,请参考以下文章

Linux系统的grub.cfg文件损坏修复

linux命令:grub 文件详解及grub修复,系统常见故障修复

怎样修复grub开机引导

开机出现grub rescue,怎样修复

centos8内核文件和grub文件丢失或者损坏恢复

电脑出现grub问题