Grub 在启动时无法识别 XEN 内核

Grub 在启动时无法识别 XEN 内核

我们能够在 7 个桉树节点控制器中的 5 个上成功安装并启动 XEN 内核。尽管运行相同的安装过程,后两个仍然存在相同的问题。

我已经安装了桉树-NC并且能够使用 kvm 管理程序启动服务。然后我配置 eucalyptus 使用xen作为虚拟机管理程序并使用以下软件包安装 xen:

yum install -y centos-release-xen xen libvirt python-virtinst libvirt-daemon-xen

我运行此命令两次,因为它第一次不会拉取 xen 包。软件包安装成功。

我还更新了/boot/grub/grub.confxen 内核的新条目:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg_erams7-lv_root
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=15
splashimage=(hd0,0)/grub/splash.xpm.gz

title CentOS-XEN (XEN-4.2.4-33.el6.centos.alt.x86_64)
    root (hd0,0)
    kernel /xen.gz dom0_mem=1024M,max:1024M loglvl=all guest_loglvl=all
    module /vmlinuz-3.10.43-11.el6.centos.alt.x86_64 ro root=/dev/mapper/vg_erams7-lv_root rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=vg_erams7/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg_erams7/lv_root rd_NO_DM rhgb quiet
    module /initramfs-3.10.43-11.el6.centos.alt.x86_64.img
title CentOS (3.10.43-11.el6.centos.alt.x86_64)
    root (hd0,0)
    kernel /vmlinuz-3.10.43-11.el6.centos.alt.x86_64 ro root=/dev/mapper/vg_erams7-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_erams7/lv_swap rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg_erams7/lv_root rd_NO_DM rhgb quiet
    initrd /initramfs-3.10.43-11.el6.centos.alt.x86_64.img
title CentOS (2.6.32-431.20.5.el6.x86_64)
    root (hd0,0)
    kernel /vmlinuz-2.6.32-431.20.5.el6.x86_64 ro root=/dev/mapper/vg_erams7-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_erams7/lv_swap rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg_erams7/lv_root rd_NO_DM rhgb quiet
    initrd /initramfs-2.6.32-431.20.5.el6.x86_64.img
title CentOS (2.6.32-431.el6.x86_64)
    root (hd0,0)
    kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=/dev/mapper/vg_erams7-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_LVM_LV=vg_erams7/lv_swap rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto  KEYBOARDTYPE=pc KEYTABLE=us rd_LVM_LV=vg_erams7/lv_root rd_NO_DM rhgb quiet
    initrd /initramfs-2.6.32-431.el6.x86_64.img

然后我使用 grub shell 刷新 MBR:

$ grub
Probing devices to guess BIOS drives. This may take a long time.


 GNU GRUB  version 0.97  (640K lower / 3072K upper memory)

 [ Minimal BASH-like line editing is supported.  For the first word, TAB
   lists possible command completions.  Anywhere else TAB lists the possible
   completions of a device/filename.]
grub> find /grub/grub.conf
find /grub/grub.conf
 (hd0,0)
grub> root (hd0,0)
root (hd0,0)
 Filesystem type is ext2fs, partition type 0x83
grub> setup (hd0)
setup (hd0)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... yes
 Checking if "/grub/stage2" exists... yes
 Checking if "/grub/e2fs_stage1_5" exists... yes
 Running "embed /grub/e2fs_stage1_5 (hd0)"...  27 sectors are embedded.
succeeded
 Running "install /grub/stage1 (hd0) (hd0)1+27 p (hd0,0)/grub/stage2 /grub/grub.conf"... succeeded
Done.

我可以重新启动,但 grub 菜单仅显示三个现有内核,而不是上面新添加的 XEN 内核:

在此输入图像描述

登录后,运行virsh list不会显示任何内容,而它应该显示如下内容:

Id    Name                           State
----------------------------------------------------
 0     Domain-0                       running

eucalyptus-nc 服务也无法启动,因为 XEN 内核未启动。

我的问题 - 是什么导致上面的 grub 条目在启动时被识别?

答案1

这是通过编辑 grub 文件来修复的,以便 GRUB 可以识别 XEN 内核,即间隔和编辑逻辑卷的标题以匹配服务器上安装的 XEN 版本:

# grub.conf generated by anaconda
... lines inserted below ...


title CentOS-XEN (**XEN-3.10.43-11.el6.centos.alt.x86_64**)
        root (hd0,0)
        kernel /xen.gz dom0_mem=1024M,max:1024M loglvl=all guest_loglvl=all
        module /vmlinuz-3.10.43-11.el6.centos.alt.x86_64 ro root=/dev/mapper/vg_erams7-lv_root rd_NO_LUKS  KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD rd_LVM_LV=vg_erams7/lv_swap SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=vg_erams7/lv_root rd_NO_DM rhgb quiet
        module /initramfs-3.10.43-11.el6.centos.alt.x86_64.img
        ... lines inserted below ...

title CentOS (3.10.43-11.el6.centos.alt.x86_64)
...

我一直认为标题行只是一个标签,grub 文件内的间距并不重要,但事实证明我错了:-/

相关内容