Kali Linux GRUB2引导修复

Kali Linux GRUB2引导修复

2016-10-27

我的Github主页

觉得kali的grub主题看着不舒服,我就总要给grub换个主题,因为GRUB2有这个功能嘛。昨天,更新了电脑,发现我的主题不见了,变成了一个好丑的界面,就在那儿改啊改,发现没有用,一气之下,把GRUB卸载了,连同跟GRUB相关的几个文件夹一起move to trash了,想着重装之后重新生成。可是并没能生成,这下GG了,配置文件又没有备份,配置好的电脑,又不想重装系统,只得想办法咯

话不多说,直奔主题

必要条件:

  1. /etc/default/grub(以下是默认的)

    # If you change this file, run 'update-grub' afterwards to update
    # /boot/grub/grub.cfg.
    # For full documentation of the options in this file, see:
    #   info -f grub -n 'Simple configuration'
    
    GRUB_DEFAULT=0
    GRUB_TIMEOUT=5
    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
    GRUB_CMDLINE_LINUX_DEFAULT="quiet"
    GRUB_CMDLINE_LINUX="initrd=/install/initrd.gz"
    
    # Uncomment to enable BadRAM filtering, modify to suit your needs
    # This works with Linux (no patch required) and with any kernel that obtains
    # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
    #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
    
    # Uncomment to disable graphical terminal (grub-pc only)
    #GRUB_TERMINAL=console
    
    # The resolution used on graphical terminal
    # note that you can use only modes which your graphic card supports via VBE
    # you can see them in real GRUB with the command `vbeinfo'
    #GRUB_GFXMODE=640x480
    
    # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
    #GRUB_DISABLE_LINUX_UUID=true
    
    # Uncomment to disable generation of recovery mode menu entries
    #GRUB_DISABLE_RECOVERY="true"
    
    # Uncomment to get a beep at grub start
    #GRUB_INIT_TUNE="480 440 1"
    

2./etc/grub.d/(默认)

1. 00_header
2. 05_debian_theme
3. 10_linux
4. 20_linux_xen
5. 30_os-prober
6. 30_uefi-firmware
7. 40_custom
8. 41_custom

使用kali安装盘启动救援模式

打开终端,默认即为root然后依次输入并执行以下命令

注:sda1为所在kali分区,先挂载原系统

mount /dev/sda1 /mnt/
mount --bind /dev /mnt/dev/
mount --bind /dev/pts /mnt/dev/pts
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys

转至原系统根目录

chroot /mnt/

安装grub并刷新,如果有,则不用装

grub-install /dev/sda

更新grub.cfg,并退至启动盘根目录

update-grub
exit

解除挂载

# umount /mnt/dev/pts
# umount /mnt/dev
# umount /mnt/proc
# umount /mnt/sys
# umount /mnt

重启电脑即可

# reboot

我的微信

  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值