Debian + Windows 10 雙重開機

Windows 10 was installed first on a non-formated disk using a non-UEFI BIOS.

A partition table (type msdos) and a partition for Windows were created manually during the installation of Windows. Windows automatically created a “System Reserved” partition (/dev/sda1) used for booting. Windows was installed into the second partition (/dev/sda2). Debian was installed into the third partition (/dev/sda3).

Problem: The GRUB entry created for Windows by the os-prober is wrong (e.g., has the wrong name). Solution: Disable os-prober create a custom GRUB menu entry for Windows.

To disable os-prober add the following line to /etc/default/grub:

GRUB_DISABLE_OS_PROBER=true

Discover the UUID of the partition containing the Windows boot loader by executing the following command in terminal as root:

blkid /dev/sda1

The output will be something like this:

/dev/sda1: LABEL="System Reserved" UUID="1D584C40586B2873" TYPE="ntfs" PARTUUID="adc19fb9-33"

Use the UUID value to create a custom menu entry at the end of the /etc/grub.d/40_custom file:

menuentry "Windows 10" --class windows --class os {
   insmod ntfs
   search --no-floppy --set=root --fs-uuid 1D584C40586B2873
   ntldr /bootmgr
}

Update grub by executing the following command in terminal as root:

update-grub

Info on menuentry syntax:

  • --class is used to group menu entries into classes. Menu themes may display different classes using different styles.
  • --no-floppy option prevents searching floppy devices, which can be slow.
  • ntldr is a new method to chainload Windows boot loader (the old one is chainload +1).
  • --hint. You may have seen other menu entries using \–hint* options with the search command. In case when two or more partitions have identical IDs, this hints help to find the right one. In our case, we use UUID and it is very unlikely that several partitions on one system get identical UUIDs.
  • drivemap and parttool commands. You may have seen other menu entries using these commands. They are needed if you have more than one Windows/DOS installation on one disk.

參考 DualBoot/Windows10