如何向 grub2 添加另一个发行版?

如何向 grub2 添加另一个发行版?

我已经在其中一个硬盘上安装了 Gentoo。整个硬盘都用于该发行版。
我想要在 grub 中进行双启动来启动 Ubuntu 或 Gentoo。

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        7298    58614752+  83  Linux

/dev/sdf1               1         125     1000000   82  Linux swap / Solaris
Partition 1 does not end on cylinder boundary.
/dev/sdf2             125       30402   243196503+  83  Linux
Partition 2 does not end on cylinder boundary.

/dev/sdb 是 Ubuntu root,/dev/sdf 是 Gentoo。
我执行sudo os-prober后显示:

/dev/sdf2:Gentoo Base System release 2.0.2:Gentoo:linux

然后我执行sudo update-grub

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.0.0-6-core2
Found initrd image: /boot/initrd.img-3.0.0-6-core2
Found linux image: /boot/vmlinuz-3.0-3-core2
Found initrd image: /boot/initrd.img-3.0-3-core2
Found memtest86+ image: /boot/memtest86+.bin
Found Gentoo Base System release 2.0.2 on /dev/sdf2
done

但是当我重新启动时,grub 菜单没有显示 Gentoo 条目。

我没有boot在 Gentoo 磁盘中设置标志,这是问题吗?磁盘启动是 Ubuntu 磁盘,而不是 Gentoo。

我的实际/boot/grub/grub.cfg

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
set default="${saved_entry}"
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 recordfail {
  set recordfail=1
  if [ -n ${have_grubenv} ]; then if [ -z ${boot_once} ]; then save_env recordfail; fi; fi
}
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set ae2f99e4-5e5d-480d-abce-e66478f0c72f
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=1280x1024
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
insmod ext2
set root='(hd1,1)'
search --no-floppy --fs-uuid --set ae2f99e4-5e5d-480d-abce-e66478f0c72f
set locale_dir=($root)/boot/grub/locale
set lang=es
insmod gettext
if [ ${recordfail} = 1 ]; then
  set timeout=-1
else
  set timeout=4
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, con Linux 3.0.0-6-core2' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod ext2
    set root='(hd1,1)'
    search --no-floppy --fs-uuid --set ae2f99e4-5e5d-480d-abce-e66478f0c72f
    linux   /boot/vmlinuz-3.0.0-6-core2 root=UUID=ae2f99e4-5e5d-480d-abce-e66478f0c72f ro   crashkernel=384M-2G:64M,2G-:128M quiet splash nomodeset video=uvesafb:mode_option=1280x1024-16,mtrr=3,scroll=ywrap acpi_osi=Linux
    initrd  /boot/initrd.img-3.0.0-6-core2
}
menuentry 'Ubuntu, con Linux 3.0.0-6-core2 (modo recuperación)' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod ext2
    set root='(hd1,1)'
    search --no-floppy --fs-uuid --set ae2f99e4-5e5d-480d-abce-e66478f0c72f
    echo    'Cargando Linux 3.0.0-6-core2 ...'
    linux   /boot/vmlinuz-3.0.0-6-core2 root=UUID=ae2f99e4-5e5d-480d-abce-e66478f0c72f ro single 
    echo    'Cargando el disco RAM inicial...'
    initrd  /boot/initrd.img-3.0.0-6-core2
}
menuentry 'Ubuntu, con Linux 3.0-3-core2' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod ext2
    set root='(hd1,1)'
    search --no-floppy --fs-uuid --set ae2f99e4-5e5d-480d-abce-e66478f0c72f
    linux   /boot/vmlinuz-3.0-3-core2 root=UUID=ae2f99e4-5e5d-480d-abce-e66478f0c72f ro   crashkernel=384M-2G:64M,2G-:128M quiet splash nomodeset video=uvesafb:mode_option=1280x1024-16,mtrr=3,scroll=ywrap acpi_osi=Linux
    initrd  /boot/initrd.img-3.0-3-core2
}
menuentry 'Ubuntu, con Linux 3.0-3-core2 (modo recuperación)' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod ext2
    set root='(hd1,1)'
    search --no-floppy --fs-uuid --set ae2f99e4-5e5d-480d-abce-e66478f0c72f
    echo    'Cargando Linux 3.0-3-core2 ...'
    linux   /boot/vmlinuz-3.0-3-core2 root=UUID=ae2f99e4-5e5d-480d-abce-e66478f0c72f ro single 
    echo    'Cargando el disco RAM inicial...'
    initrd  /boot/initrd.img-3.0-3-core2
}
### END /etc/grub.d/10_linux ###

### 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.
### END /etc/grub.d/40_custom ###

答案1

已解决:
我已经更新了 os-prober 包,并且已经在 Gentoo 硬盘中激活了启动标志,现在它可以正常工作了。

相关内容