我已经被这个咬了很多次了,今天openssl
在我的服务器 grub 更新后抱怨我应该重新安装它,因为“以前安装的硬盘不存在”。
我有一个带有以下设置的raid 1安装(根据bootinfoscript):
> ============================= Boot Info Summary: ===============================
>
> => Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at
> sector 1 of the same hard drive for core.img. core.img is at this location and looks
> for (mduuid/d2a04f98760e2b3cc23ba87845667605)/grub on this drive.
>
> => Grub2 (v1.99) is installed in the MBR of /dev/sdb and looks at sector 1 of
> the same hard drive for core.img. core.img is at this location and looks
> for (mduuid/d2a04f98760e2b3cc23ba87845667605)/grub on this drive.
My mount points are:
> /dev/md2 on / type ext4 (rw)
> /dev/md1 on /boot type ext3 (rw)
And mduuid seems to match the ones bootinfoscript mentions:
> ls -l /dev/disk/by-id/md-uuid-*
>
> lrwxrwxrwx 1 root root 9 Mar 19 11:37 /dev/disk/by-id/md-uuid-38048286:e3004e47:510ca3e1:2bae3f2e -> ../../md2
>
> lrwxrwxrwx 1 root root 9 Mar 19 11:37 /dev/disk/by-id/md-uuid-d2a04f98:760e2b3c:c23ba878:45667605 -> ../../md1
>
> lrwxrwxrwx 1 root root 9 Mar 19 11:37 /dev/disk/by-id/md-uuid-e099b695:0143bb58:e4ef7645:0f22ce0b -> ../../md0
Run Code Online (Sandbox Code Playgroud)
运行 grub-install 有效,但我想确保在重新启动 grub 后实际上会正确启动我的分区。
我该如何验证?
May*_*hux 27
我认为您不能在尝试之前检查这是否有效,而是可以立即预览您的 GRUB,这样您就可以确保在 GRUB 中正确加载了您的新配置。
这可以使用名为grub-emu
.
man grub-emu
NAME
grub-emu - GRUB emulator
SYNOPSIS
grub-emu [OPTION]...
DESCRIPTION
GRUB emulator.
-r, --root-device=DEV
use DEV as the root device [default=guessed]
-m, --device-map=FILE
use FILE as the device map [default=/boot/grub/device.map]
-d, --directory=DIR
use GRUB files in the directory DIR [default=/boot/grub]
-v, --verbose
print verbose messages
Run Code Online (Sandbox Code Playgroud)
grub-emu
使用命令行轻松安装:
sudo apt-get install grub-emu
Run Code Online (Sandbox Code Playgroud)
要运行它,只需使用终端运行此命令:
grub-emu
Run Code Online (Sandbox Code Playgroud)
此答案用于file -s /dev/sda
查看 GRUB MBR 是否已成功安装。在那之后,您绝对可以仔细检查中的值/boot/grub/grub.cfg
以确保 UUID 与 中的值匹配/dev/disk/by-uuid
,并确保/boot/grub/device.map
. 如果该文件有误,您将在 grub.cfg 中遇到 (hdX) 规范问题。
如果您update-grub
在替换驱动器上安装 grub 后使用,则不需要手动管理这些文件。根据我的经验,最大的问题是没有更新 GRUB 配置,没有在所有驱动器上安装 GRUB,或者分区不当导致您无法在不使用 --force 的情况下安装 GRUB。