我已经使用相同的配置成功添加了第二个菜单项,并通过 CentOS 7 中的“grub2-reboot # && restart”启动它,但我所做的一切似乎都没有改变 FreePBX Distro 7 中下次启动的菜单项选择。
关于如何尝试排除故障/测试/修复有什么想法吗?
配置:
猫 /etc/default/grub
[root@freepbx ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="gfxterm"
GRUB_CMDLINE_LINUX="crashkernel=auto biosdevname=0 net.ifnames=0 rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
GRUB_BACKGROUND=/boot/splash.png
猫 /boot/grub2/grub.cfg
[root@freepbx ~]# cat /boot/grub2/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub2-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
set pager=1
if [ -s $prefix/grubenv ]; then
load_env
fi
if [ "${next_entry}" ] ; then
set default="${next_entry}"
set next_entry=
save_env next_entry
set boot_once=true
else
set default="${saved_entry}"
fi
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_msdos
insmod ext2
set root='hd0,msdos2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 --hint='hd0,msdos2' 5820774d-3fcf-44fb-86b9-972fab5de985
else
search --no-floppy --fs-uuid --set=root 5820774d-3fcf-44fb-86b9-972fab5de985
fi
font="/usr/share/grub/unicode.pf2"
fi
if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_US
insmod gettext
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1' 0123444f-dbb6-421e-ad8a-6f6bfb0a0901
else
search --no-floppy --fs-uuid --set=root 0123444f-dbb6-421e-ad8a-6f6bfb0a0901
fi
insmod png
background_image -m stretch /splash.png
if [ x$feature_timeout_style = xy ] ; then
set timeout_style=menu
set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
set timeout=5
fi
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/00_tuned ###
set tuned_params=""
### END /etc/grub.d/00_tuned ###
### BEGIN /etc/grub.d/01_users ###
if [ -f ${prefix}/user.cfg ]; then
source ${prefix}/user.cfg
if [ -n "${GRUB2_PASSWORD}" ]; then
set superusers="root"
export superusers
password_pbkdf2 root ${GRUB2_PASSWORD}
fi
fi
### END /etc/grub.d/01_users ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Sangoma Linux (3.10.0-514.2.2.el7.x86_64) 7 (Core)' --class sangoma --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-514.2.2.el7.x86_64-advanced-5820774d-3fcf-44fb-86b9-972fab5de985' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1' 0123444f-dbb6-421e-ad8a-6f6bfb0a0901
else
search --no-floppy --fs-uuid --set=root 0123444f-dbb6-421e-ad8a-6f6bfb0a0901
fi
linux16 /vmlinuz-3.10.0-514.2.2.el7.x86_64 root=UUID=5820774d-3fcf-44fb-86b9-972fab5de985 ro crashkernel=auto biosdevname=0 net.ifnames=0 rhgb quiet
initrd16 /initramfs-3.10.0-514.2.2.el7.x86_64.img
}
if [ "x$default" = 'Sangoma Linux (3.10.0-514.2.2.el7.x86_64) 7 (Core)' ]; then default='Advanced options for Sangoma Linux>Sangoma Linux (3.10.0-514.2.2.el7.x86_64) 7 (Core)'; fi;
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/20_ppc_terminfo ###
### END /etc/grub.d/20_ppc_terminfo ###
### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Parted Magic 64-bit LiveISO" {
set root=(hd0,msdos2)
set isofile="/home/isos/pmagic.iso"
loopback loop $isofile
linux (loop)/pmagic/bzImage64 iso_filename=$isofile load_ramdisk=1
initrd (loop)/pmagic/initrd.img /pmagic/fu.img /pmagic/m64.img
}
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
我还尝试了以下方法并得到相同的结果:
sudo rm /boot/grub2/grub.cfg
sudo rm /etc/grub.d/* -R
sudo rm /etc/sysconfig/grub
yum reinstall -y grub2-tools
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-install /dev/sda
所以 FreePBX 使用自己的 Repo,所以我按照上面的代码操作,但手动下载了 grub2-tools,现在出现以下错误:
[root@freepbx grub]# grub2-install --target=x86_64
grub2-install: error: /usr/lib/grub/x86_64/modinfo.sh doesn't exist. Please specify --target or --directory.
[root@freepbx grub]# grub2-install /dev/sda
grub2-install: error: /usr/lib/grub/i386-pc/modinfo.sh doesn't exist. Please specify --target or --directory.
答案1
由于某种原因,FreePBX Distro 即使在 MBR 安装上也有一个 /boot/efi/ 文件夹。
树:(我删除了多余的东西)
[root@freepbx ~]# tree /boot/
/boot/
├── efi
│ └── EFI
│ ├── BOOT
│ │ ├── BOOTX64.EFI
│ │ └── fallback.efi
│ └── centos
│ ├── BOOT.CSV
│ ├── fonts
│ │ └── unicode.pf2
│ ├── gcdx64.efi
│ ├── grubenv
│ ├── grubx64.efi
│ ├── MokManager.efi
│ ├── shim-centos.efi
│ └── shim.efi
├── grub
│ └── splash.xpm.gz
├── grub2
│ ├── grub.cfg
│ ├── grubenv -> /boot/efi/EFI/centos/grubenv
问题 :
/boot/grub2/grubenv 是到 /boot/efi/EFI/centos/grubenv 的软链接
检查 MBR 与 UEFI:
[root@freepbx ~]# sudo parted -l | grep Table
Partition Table: msdos
sudo rm /boot/efi -R
sudo rm /boot/grub2/grubenv*
sudo rm /boot/grub2/grub.cfg
sudo rm /etc/grub.d/* -R
sudo rm /etc/sysconfig/grub
yum reinstall -y grub2-tools
nano /etc/grub.d/40_custom
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-install /dev/sda
grub2-reboot 'Parted Magic 64-bit LiveISO'
reboot