您的位置:首页 > 运维架构 > Linux

Kali Linux GRUB2引导修复

2017-07-30 21:57 183 查看

Kali Linux GRUB2引导修复

2016-10-27

我的Github主页

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

话不多说,直奔主题

必要条件:

/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


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux grub 修复