我已经进行了一些搜索,但无法弄清楚如何将我的 Windows 10 驱动器(单独的 HDD)/dev/sdd 添加到 grub 2 菜单。
我将 Manjaro linux 安装在一个单独的驱动器上,Windows 安装在旧驱动器上。首先安装的是Windows,我记得当我第一次使用ubuntu接触Linux时,它在grub中默认检测并列出了Windows。
如何向 grub 添加 Windows 条目?
uname -r
-> 4.4.17-1-MANJARO
grub-install --version
-> grub-install (GRUB) 2.02~beta3
sudo update-grub
->
Generating grub configuration file ...
Found background: /usr/share/grub/background.png
Found Intel Microcode image
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
Found initrd fallback image: /boot/initramfs-linux-fallback.img
Found linux image: /boot/vmlinuz-4.7-x86_64
Found initrd image: /boot/initramfs-4.7-x86_64.img
Found initrd fallback image: /boot/initramfs-4.7-x86_64-fallback.img
Found linux image: /boot/vmlinuz-4.4-x86_64
Found initrd image: /boot/initramfs-4.4-x86_64.img
Found initrd fallback image: /boot/initramfs-4.4-x86_64-fallback.img
Found linux image: /boot/vmlinuz-3.10-x86_64
Found initrd image: /boot/initramfs-3.10-x86_64.img
Found initrd fallback image: /boot/initramfs-3.10-x86_64-fallback.img
Found memtest86+ image: /boot/memtest86+/memtest.bin
done
blkid | grep ntfs
->
/dev/sdd1: LABEL="System Reserved" UUID="01D1CED0D0E25BB0" TYPE="ntfs" PARTUUID="576e6452-01"
/dev/sdd2: LABEL="Computer" UUID="01D1CED73B23FDC0" TYPE="ntfs" PARTUUID="576e6452-02"
/etc/fdisk
->
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
UUID=596E-1D7B /boot/efi vfat defaults,noatime 0 2
UUID=e96e9dc6-b686-419c-8070-532b71f0631a / ext4 defaults,noatime,discard 0 1
UUID=b0dedb36-a45d-407f-be01-1da38f343149 /home ext4 defaults,commit=60,noatime 0 2
UUID=5acc3a2a-fc46-4d5d-916c-3e42f1b77141 swap swap defaults,noatime,discard 0 2
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
#windows drive
UUID=01D1CED0D0E25BB0 /mnt/windows ntfs locale=en_US.utf8,dmask=022,fmask=022 0 2
UUID=01D1CED73B23FDC0 /mnt/windows2 ntfs locale=en_US.utf8,dmask=022,fmask=022 0 2
编辑: 添加了 os-prober、grub-mkconfig
sudo os-prober
->[空白] 终端没有返回任何内容
sudo grub-mkconfig
->
Generating grub configuration file ...
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
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
}
set menu_color_normal=light-gray/black
set menu_color_highlight=green/black
if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_gpt
insmod ext2
set root='hd4,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,gpt2 --hint-efi=hd4,gpt2 --hint-baremetal=ahci4,gpt2 e96e9dc6-b686-419c-8070-532b71f0631a
else
search --no-floppy --fs-uuid --set=root e96e9dc6-b686-419c-8070-532b71f0631a
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_CA
insmod gettext
fi
terminal_input console
terminal_output gfxterm
Found background: /usr/share/grub/background.png
insmod part_gpt
insmod ext2
set root='hd4,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,gpt2 --hint-efi=hd4,gpt2 --hint-baremetal=ahci4,gpt2 e96e9dc6-b686-419c-8070-532b71f0631a
else
search --no-floppy --fs-uuid --set=root e96e9dc6-b686-419c-8070-532b71f0631a
fi
insmod png
background_image -m stretch /usr/share/grub/background.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/10_linux ###
Found Intel Microcode image
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/initramfs-linux.img
menuentry 'Manjaro Linux' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-e96e9dc6-b686-419c-8070-532b71f0631a' {
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd4,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,gpt2 --hint-efi=hd4,gpt2 --hint-baremetal=ahci4,gpt2 e96e9dc6-b686-419c-8070-532b71f0631a
else
search --no-floppy --fs-uuid --set=root e96e9dc6-b686-419c-8070-532b71f0631a
fi
echo 'Loading Linux linux ...'
linux /boot/vmlinuz-linux root=UUID=e96e9dc6-b686-419c-8070-532b71f0631a rw resume=UUID=5acc3a2a-fc46-4d5d-916c-3e42f1b77141 quiet splash
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/initramfs-linux.img
}
submenu 'Advanced options for Manjaro Linux' $menuentry_id_option 'gnulinux-advanced-e96e9dc6-b686-419c-8070-532b71f0631a' {
menuentry 'Manjaro Linux (Kernel: linux)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced-e96e9dc6-b686-419c-8070-532b71f0631a' {
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd4,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,gpt2 --hint-efi=hd4,gpt2 --hint-baremetal=ahci4,gpt2 e96e9dc6-b686-419c-8070-532b71f0631a
else
search --no-floppy --fs-uuid --set=root e96e9dc6-b686-419c-8070-532b71f0631a
fi
echo 'Loading Linux linux ...'
linux /boot/vmlinuz-linux root=UUID=e96e9dc6-b686-419c-8070-532b71f0631a rw resume=UUID=5acc3a2a-fc46-4d5d-916c-3e42f1b77141 quiet splash
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/initramfs-linux.img
}
Found initrd fallback image: /boot/initramfs-linux-fallback.img
menuentry 'Manjaro Linux (Kernel: linux - fallback initramfs)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-e96e9dc6-b686-419c-8070-532b71f0631a' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd4,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,gpt2 --hint-efi=hd4,gpt2 --hint-baremetal=ahci4,gpt2 e96e9dc6-b686-419c-8070-532b71f0631a
else
search --no-floppy --fs-uuid --set=root e96e9dc6-b686-419c-8070-532b71f0631a
fi
echo 'Loading Linux linux ...'
linux /boot/vmlinuz-linux root=UUID=e96e9dc6-b686-419c-8070-532b71f0631a rw resume=UUID=5acc3a2a-fc46-4d5d-916c-3e42f1b77141 quiet splash
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/initramfs-linux-fallback.img
}
Found linux image: /boot/vmlinuz-4.7-x86_64
Found initrd image: /boot/initramfs-4.7-x86_64.img
menuentry 'Manjaro Linux (Kernel: 4.7.2-1-MANJARO x64)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.7.2-1-MANJARO x64-advanced-e96e9dc6-b686-419c-8070-532b71f0631a' {
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd4,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,gpt2 --hint-efi=hd4,gpt2 --hint-baremetal=ahci4,gpt2 e96e9dc6-b686-419c-8070-532b71f0631a
else
search --no-floppy --fs-uuid --set=root e96e9dc6-b686-419c-8070-532b71f0631a
fi
echo 'Loading Linux 4.7.2-1-MANJARO x64 ...'
linux /boot/vmlinuz-4.7-x86_64 root=UUID=e96e9dc6-b686-419c-8070-532b71f0631a rw resume=UUID=5acc3a2a-fc46-4d5d-916c-3e42f1b77141 quiet splash
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/initramfs-4.7-x86_64.img
}
Found initrd fallback image: /boot/initramfs-4.7-x86_64-fallback.img
menuentry 'Manjaro Linux (Kernel: 4.7.2-1-MANJARO x64 - fallback initramfs)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.7.2-1-MANJARO x64-fallback-e96e9dc6-b686-419c-8070-532b71f0631a' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd4,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,gpt2 --hint-efi=hd4,gpt2 --hint-baremetal=ahci4,gpt2 e96e9dc6-b686-419c-8070-532b71f0631a
else
search --no-floppy --fs-uuid --set=root e96e9dc6-b686-419c-8070-532b71f0631a
fi
echo 'Loading Linux 4.7.2-1-MANJARO x64 ...'
linux /boot/vmlinuz-4.7-x86_64 root=UUID=e96e9dc6-b686-419c-8070-532b71f0631a rw resume=UUID=5acc3a2a-fc46-4d5d-916c-3e42f1b77141 quiet splash
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/initramfs-4.7-x86_64-fallback.img
}
Found linux image: /boot/vmlinuz-4.4-x86_64
Found initrd image: /boot/initramfs-4.4-x86_64.img
menuentry 'Manjaro Linux (Kernel: 4.4.19-1-MANJARO x64)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.19-1-MANJARO x64-advanced-e96e9dc6-b686-419c-8070-532b71f0631a' {
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd4,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,gpt2 --hint-efi=hd4,gpt2 --hint-baremetal=ahci4,gpt2 e96e9dc6-b686-419c-8070-532b71f0631a
else
search --no-floppy --fs-uuid --set=root e96e9dc6-b686-419c-8070-532b71f0631a
fi
echo 'Loading Linux 4.4.19-1-MANJARO x64 ...'
linux /boot/vmlinuz-4.4-x86_64 root=UUID=e96e9dc6-b686-419c-8070-532b71f0631a rw resume=UUID=5acc3a2a-fc46-4d5d-916c-3e42f1b77141 quiet splash
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/initramfs-4.4-x86_64.img
}
Found initrd fallback image: /boot/initramfs-4.4-x86_64-fallback.img
menuentry 'Manjaro Linux (Kernel: 4.4.19-1-MANJARO x64 - fallback initramfs)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.4.19-1-MANJARO x64-fallback-e96e9dc6-b686-419c-8070-532b71f0631a' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd4,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,gpt2 --hint-efi=hd4,gpt2 --hint-baremetal=ahci4,gpt2 e96e9dc6-b686-419c-8070-532b71f0631a
else
search --no-floppy --fs-uuid --set=root e96e9dc6-b686-419c-8070-532b71f0631a
fi
echo 'Loading Linux 4.4.19-1-MANJARO x64 ...'
linux /boot/vmlinuz-4.4-x86_64 root=UUID=e96e9dc6-b686-419c-8070-532b71f0631a rw resume=UUID=5acc3a2a-fc46-4d5d-916c-3e42f1b77141 quiet splash
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/initramfs-4.4-x86_64-fallback.img
}
Found linux image: /boot/vmlinuz-3.10-x86_64
Found initrd image: /boot/initramfs-3.10-x86_64.img
menuentry 'Manjaro Linux (Kernel: 3.10.102-1-MANJARO x64)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.10.102-1-MANJARO x64-advanced-e96e9dc6-b686-419c-8070-532b71f0631a' {
savedefault
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd4,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,gpt2 --hint-efi=hd4,gpt2 --hint-baremetal=ahci4,gpt2 e96e9dc6-b686-419c-8070-532b71f0631a
else
search --no-floppy --fs-uuid --set=root e96e9dc6-b686-419c-8070-532b71f0631a
fi
echo 'Loading Linux 3.10.102-1-MANJARO x64 ...'
linux /boot/vmlinuz-3.10-x86_64 root=UUID=e96e9dc6-b686-419c-8070-532b71f0631a rw resume=UUID=5acc3a2a-fc46-4d5d-916c-3e42f1b77141 quiet splash
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/initramfs-3.10-x86_64.img
}
Found initrd fallback image: /boot/initramfs-3.10-x86_64-fallback.img
menuentry 'Manjaro Linux (Kernel: 3.10.102-1-MANJARO x64 - fallback initramfs)' --class manjaro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.10.102-1-MANJARO x64-fallback-e96e9dc6-b686-419c-8070-532b71f0631a' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd4,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd4,gpt2 --hint-efi=hd4,gpt2 --hint-baremetal=ahci4,gpt2 e96e9dc6-b686-419c-8070-532b71f0631a
else
search --no-floppy --fs-uuid --set=root e96e9dc6-b686-419c-8070-532b71f0631a
fi
echo 'Loading Linux 3.10.102-1-MANJARO x64 ...'
linux /boot/vmlinuz-3.10-x86_64 root=UUID=e96e9dc6-b686-419c-8070-532b71f0631a rw resume=UUID=5acc3a2a-fc46-4d5d-916c-3e42f1b77141 quiet splash
echo 'Loading initial ramdisk ...'
initrd /boot/intel-ucode.img /boot/initramfs-3.10-x86_64-fallback.img
}
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### 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 ###
### 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 ###
### BEGIN /etc/grub.d/60_memtest86+ ###
Found memtest86+ image: /boot/memtest86+/memtest.bin
if [ "${grub_platform}" == "pc" ]; then
menuentry "Memory Tester (memtest86+)" --class memtest86 --class gnu --class tool {
search --fs-uuid --no-floppy --set=root --hint-bios=hd4,gpt2 --hint-efi=hd4,gpt2 --hint-baremetal=ahci4,gpt2 e96e9dc6-b686-419c-8070-532b71f0631a
linux16 /boot/memtest86+/memtest.bin
}
fi
### END /etc/grub.d/60_memtest86+ ###
done
sudo parted /dev/sdd print
->
Model: ATA ST31000524AS (scsi)
Disk /dev/sdd: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 525MB 524MB primary ntfs boot
2 525MB 1000GB 1000GB primary ntfs
尝试遵循这个指导在安装系统内时/mnt/windows
,调用find . -name bootmgfr.efi
没有运气。里面/mnt/windows/Boot
没有 EFI 文件夹或任何类型的 efi 文件
挂载win10 iso,挂载EFI,进入EFI/Microsoft/Boot/
,文件bootmgfw.efi已经存在,从win10 iso添加bootmgr.efi,跑sudo grub-mkconfig
,grub还是没有Windows选项
答案1
请安装os-prober
:pacman -S os-prober
还有,是bootmgfw.efi
,不是bootmgfr.efi
。
该文件bootmgfw.efi
不在 Windows 分区上,而是在EFI系统分区。在每个磁盘上使用fdisk -l
来查找 EFI 分区。然后将文件bootmgfw.efi
从Windows 10 ISOto $esp/EFI/Microsoft/boot
,其中$esp
是EFI分区挂载的位置。然后运行grub-mkconfig
就完成了。