Grubは他のハードドライブにWindowsエントリを追加できません(デュアルブート)。

Grubは他のハードドライブにWindowsエントリを追加できません(デュアルブート)。

最近SSDドライブにLinux(MintOS)をインストールしました。私のハードドライブにもWindows 10があります。 WindowsはLinuxの前にインストールされました。

問題は、grubローダーがWindowsローダーを認識せず、Windowsから起動できないことです。

そのSSDには2つの異なるOSがあったことを覚えています。 grubメニューには問題がなく、そのOSがドライブに見つかりました。ただし、ハードドライブ(Windows)から起動するには、毎回BIOSを使用してください。

今の状況は同じです。ただし、SSDにOSが1つしかなく、Windowsを起動できません。ウィンドウを削除することはオプションではありません。

ブート回復でこの問題を解決したところ、ソフトウェアはオペレーティングシステム(os-prober?)とドライブなどを正しく検出しました。 GrubはLinux構成の良い紹介も提供しています。 Windowsが検出されましたが追加されていません... :(

修理を開始するときは、次のフラグを選択してください。

  • グラップを再インストール
  • 起動メニューを非表示にする
  • sdb(linuxを含むSSD)にgrubをインストールします。別の/boot/efiパーティションが選択されていません。
  • Windowsのスタートアップファイルの回復
  • sdb3 linuxはデフォルトのブートオペレーティングシステムです。

起動回復ログは次のとおりです。

============================= Boot Repair Summary ==============================




Default settings: ______________________________________________________________

The default repair of the Boot-Repair utility would reinstall the grub2 of
sdb3 into the MBR of sdb.
Grub-efi would not be selected by default because legacy Windows detected.
Additional repair would be performed: unhide-bootmenu-10s win-legacy-basic-fix

Final advice in case of suggested repair: ______________________________________

Please do not forget to make your BIOS boot on sdb (ATA IR-SSDPR-S25A-12) disk!

User settings: _________________________________________________________________

This will install an obsolete bootloader (GRUB Legacy). Please backup your data before this operation.
The settings chosen by the user will reinstall the grub2 of
sdb3 into the MBR of sdb.
Grub-efi will not be selected by default because legacy Windows detected.
Additional repair will be performed:  unhide-bootmenu-10s win-legacy-basic-fix


Quantity of real Windows: 1

========================= Reinstall the grub2 of sdb3 ==========================

chroot /mnt/boot-sav/sdb3 grub-install --version
grub-install (GRUB) 2.06-2ubuntu7.1

==> Reinstall the GRUB of sdb3 into the MBR of sdb

chroot /mnt/boot-sav/sdb3 grub-install /dev/sdb
Installing for i386-pc platform.
Installation finished. No error reported.

chroot /mnt/boot-sav/sdb3 update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50_linuxmint.cfg'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.15.0-56-generic
Found initrd image: /boot/initrd.img-5.15.0-56-generic
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.

Unhide GRUB boot menu in sdb3/boot/grub/grub.cfg

Boot successfully repaired.

You can now reboot your computer.
Please do not forget to make your BIOS boot on sdb (ATA IR-SSDPR-S25A-12) disk!


============================ Boot Info After Repair ============================

 => No boot loader is installed in the MBR of /dev/sda.
 => Grub2 (v2.00) is installed in the MBR of /dev/sdb and looks at sector 2048 
    of the same hard drive for core.img. core.img is at this location and 
    looks for (,gpt3)/boot/grub. It also embeds following components:
    
    modules
    ---------------------------------------------------------------------------
    fshelp ext2 part_gpt biosdisk
    ---------------------------------------------------------------------------
 => Syslinux MBR (5.00 and higher) is installed in the MBR of /dev/sdc.

sda1: __________________________________________________________________________

    File system:       
    Boot sector type:  -
    Boot sector info: 

sda2: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 8/10/11/2012: NTFS
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  Windows 8 or 10
    Boot files:        /Windows/System32/winload.exe

sda3: __________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows 2000/XP: NTFS
    Boot sector info:  According to the info in the boot sector, sda3 starts 
                       at sector 0. But according to the info from fdisk, 
                       sda3 starts at sector 519923712.
    Operating System:  
    Boot files:        

sdb1: __________________________________________________________________________

    File system:       BIOS Boot partition
    Boot sector type:  Grub2's core.img
    Boot sector info: 

sdb2: __________________________________________________________________________

    File system:       vfat
    Boot sector type:  FAT32
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /efi/BOOT/fbx64.efi /efi/BOOT/mmx64.efi 
                       /efi/ubuntu/grubx64.efi /efi/ubuntu/mmx64.efi 
                       /efi/ubuntu/shimx64.efi /efi/ubuntu/grub.cfg

sdb3: __________________________________________________________________________

    File system:       ext4
    Boot sector type:  -
    Boot sector info: 
    Operating System:  Linux Mint 21.1
    Boot files:        /boot/grub/grub.cfg /etc/fstab /etc/default/grub 
                       /boot/grub/i386-pc/core.img

sdc1: __________________________________________________________________________

    File system:       vfat
    Boot sector type:  SYSLINUX 6.04
    Boot sector info:  Syslinux looks at sector 32832 of /dev/sdc1 for its 
                       second stage. The integrity check of Syslinux failed. 
                       No errors found in the Boot Parameter Block.
    Operating System:  
    Boot files:        /boot/grub/grub.cfg /syslinux.cfg 
                       /efi/boot/bootx64.efi /efi/boot/grubx64.efi 
                       /efi/boot/mmx64.efi /ldlinux.sys


================================ 2 OS detected =================================

OS#1:   Linux Mint 21.1 Vera (21.1) on sdb3
OS#2:   Windows 8 or 10 on sda2

================================ Host/Hardware =================================

CPU architecture: 64-bit
Video: GK104 [GeForce GTX 770] from NVIDIA Corporation
Live-session OS is Linuxmint 64-bit (Linux Mint 21.1, vera, x86_64)

===================================== UEFI =====================================

BIOS/UEFI firmware: 1802(4.6) from American Megatrends Inc.
This live-session is in Legacy/BIOS/CSM mode (not in EFI mode).


c152ec201c37b6e97bbc2207e49d1271   sdb2/BOOT/fbx64.efi
fdafb5eece6caeccb788c946a28e6872   sdb2/BOOT/mmx64.efi
5ddf997e8b025bfbc2009e85b32f60dc   sdb2/ubuntu/grubx64.efi
fdafb5eece6caeccb788c946a28e6872   sdb2/ubuntu/mmx64.efi
728124f6ec8e22fbdbe7034812c81b95   sdb2/ubuntu/shimx64.efi
728124f6ec8e22fbdbe7034812c81b95   sdb2/BOOT/BOOTX64.efi

============================= Drive/Partition Info =============================

Disks info: ____________________________________________________________________

sda : is-GPT,   no-BIOSboot,    has-noESP,  not-usb,    not-mmc, has-os,    has-win,    2048 sectors * 512 bytes
sdb : is-GPT,   hasBIOSboot,    has---ESP,  not-usb,    not-mmc, has-os,    no-wind,    2048 sectors * 512 bytes

Partitions info (1/3): _________________________________________________________

sda2    : is-os,    32, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   farbios
sda3    : no-os,    32, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   farbios
sdb2    : no-os,    32, nopakmgr,   no-docgrub, nogrub, nogrubinstall,  no-grubenv, noupdategrub,   not-far
sdb3    : is-os,    64, apt-get,    signed grub-pc grub-efi ,   grub2,  grub-install,   grubenv-ok, update-grub,    farbios

Partitions info (2/3): _________________________________________________________

sda2    : isnotESP, part-has-no-fstab,  no-nt,  haswinload, no-recov-nor-hid,   no-bmgr,    notwinboot
sda3    : isnotESP, part-has-no-fstab,  no-nt,  no-winload, no-recov-nor-hid,   no-bmgr,    notwinboot
sdb2    : is---ESP, part-has-no-fstab,  no-nt,  no-winload, no-recov-nor-hid,   no-bmgr,    notwinboot
sdb3    : isnotESP, fstab-without-efi,  no-nt,  no-winload, no-recov-nor-hid,   no-bmgr,    notwinboot

Partitions info (3/3): _________________________________________________________

sda2    : not--sepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sda
sda3    : not--sepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sda
sdb2    : not--sepboot, no---boot,  part-has-no-fstab,  not-sep-usr,    no---usr,   part-has-no-fstab,  no--grub.d, sdb
sdb3    : not--sepboot, with-boot,  fstab-without-boot, not-sep-usr,    with--usr,  fstab-without-usr,  std-grub.d, sdb

fdisk -l (filtered): ___________________________________________________________

Disk sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk identifier: 78E47EB1-EED8-44E8-85FC-7E3BE186D6CA
          Start        End    Sectors   Size Type
sda1       2048      34815      32768    16M Microsoft reserved
sda2      34816  519923711  519888896 247.9G Microsoft basic data
sda3  519923712 1953523711 1433600000 683.6G Microsoft basic data
Disk sdb: 111.79 GiB, 120034123776 bytes, 234441648 sectors
Disk identifier: 2B6D4B4B-FADE-4169-AC1F-21598C19C5E1
        Start       End   Sectors   Size Type
sdb1     2048      4095      2048     1M BIOS boot
sdb2     4096   1054719   1050624   513M EFI System
sdb3  1054720 234440703 233385984 111.3G Linux filesystem
Disk sdc: 29.3 GiB, 31457280000 bytes, 61440000 sectors
Disk identifier: 0x00030679
      Boot Start      End  Sectors  Size Id Type
sdc1  *     2048 61439999 61437952 29.3G  c W95 FAT32 (LBA)

parted -lm (filtered): _________________________________________________________

sda:1000GB:scsi:512:4096:gpt:ATA WDC WD10EZEX-00B:;
1:1049kB:17.8MB:16.8MB::Microsoft reserved partition:msftres;
2:17.8MB:266GB:266GB:ntfs:Basic data partition:msftdata;
3:266GB:1000GB:734GB:ntfs:Basic data partition:msftdata;
sdb:120GB:scsi:512:512:gpt:ATA IR-SSDPR-S25A-12:;
1:1049kB:2097kB:1049kB:btrfs::bios_grub;
2:2097kB:540MB:538MB:fat32:EFI System Partition:boot, esp;
3:540MB:120GB:119GB:ext4::;
sdc:31.5GB:scsi:512:512:msdos:VendorCo ProductCode:;
1:1049kB:31.5GB:31.5GB:fat32::boot, lba;

blkid (filtered): ______________________________________________________________

NAME   FSTYPE   UUID                                 PARTUUID                             LABEL      PARTLABEL
sda                                                                                                  
├─sda1                                               8a47735e-847e-4e08-b7cf-9d242dac3f42            Microsoft reserved partition
├─sda2 ntfs     C448EE9848EE890E                     715729d9-1ab0-4a3a-a829-b2a6a909e4e6            Basic data partition
└─sda3 ntfs     01D7EC689D67D2E0                     78020014-7be6-43d1-bc08-137656e47de0 D          Basic data partition
sdb                                                                                                  
├─sdb1 btrfs    6eff9117-2be7-4fe7-8538-030938804bc3 50aa9682-8317-4601-81d8-a745a89810cc            
├─sdb2 vfat     D3A6-386D                            830148b5-746a-466b-af8d-7fb76a88f065            EFI System Partition
└─sdb3 ext4     d6be2234-9945-435c-829e-756c0e872a42 750e3efe-4797-4ff6-8be2-b19cbc280614            
sdc                                                                                                  
└─sdc1 vfat     3C77-F150                            00030679-01                          LINUX MINT 

Mount points (filtered): _______________________________________________________

            Avail Use% Mounted on
/dev/sda2   164.6G  34% /mnt/boot-sav/sda2
/dev/sda3   555.6G  19% /mnt/boot-sav/sda3
/dev/sdb2   505.9M   1% /mnt/boot-sav/sdb2
/dev/sdb3      93G  10% /mnt/boot-sav/sdb3
/dev/sdc1    26.8G   9% /cdrom

Mount options (filtered): ______________________________________________________

/dev/sda2   fuseblk         rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sda3   fuseblk         rw,relatime,user_id=0,group_id=0,allow_other,blksize=4096
/dev/sdb2   vfat            rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
/dev/sdb3   ext4            rw,relatime
/dev/sdc1   vfat            ro,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro

===================== sdb2/efi/ubuntu/grub.cfg (filtered) ======================

search.fs_uuid d6be2234-9945-435c-829e-756c0e872a42 root hd1,gpt3 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

====================== sdb3/boot/grub/grub.cfg (filtered) ======================

Ubuntu   d6be2234-9945-435c-829e-756c0e872a42
Ubuntu, with Linux 5.15.0-56-generic   d6be2234-9945-435c-829e-756c0e872a42
### END /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_uefi-firmware ###

========================== sdb3/etc/fstab (filtered) ===========================

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sdb3 during installation
UUID=d6be2234-9945-435c-829e-756c0e872a42 /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sdb2 during installation
/swapfile                                 none            swap    sw              0       0

======================= sdb3/etc/default/grub (filtered) =======================

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_DISABLE_OS_PROBER=false

==================== sdb3: Location of files loaded by Grub ====================

           GiB - GB             File                                 Fragment(s)
            ?? = ??             boot/grub/grub.cfg                             1
  13.881172180 = 14.904795136   boot/grub/i386-pc/core.img                     1
  28.841812134 = 30.968659968   boot/vmlinuz                                   1
  28.841812134 = 30.968659968   boot/vmlinuz-5.15.0-56-generic                 1
  26.887382507 = 28.870107136   boot/initrd.img                                2
  26.887382507 = 28.870107136   boot/initrd.img-5.15.0-56-generic              2
  26.887382507 = 28.870107136   boot/initrd.img.old                            2

===================== sdb3: ls -l /etc/grub.d/ (filtered) ======================

-rwxr-xr-x 1 root root 18683 Apr 15  2022 10_linux
-rwxr-xr-x 1 root root 43031 Apr 15  2022 10_linux_zfs
-rwxr-xr-x 1 root root 14180 Apr 15  2022 20_linux_xen
-rwxr-xr-x 1 root root 13369 Apr 15  2022 30_os-prober
-rwxr-xr-x 1 root root  1372 Apr 15  2022 30_uefi-firmware
-rwxr-xr-x 1 root root   700 Sep 20 03:18 35_fwupd
-rwxr-xr-x 1 root root   214 Apr 15  2022 40_custom
-rwxr-xr-x 1 root root   215 Apr 15  2022 41_custom

=========================== sdb3/etc/grub.d/35_fwupd ===========================

#! /bin/sh
# SPDX-License-Identifier: LGPL-2.1+
set -e
[ -d ${pkgdatadir:?} ]
# shellcheck source=/dev/null
. "$pkgdatadir/grub-mkconfig_lib"
if [ -f /var/lib/fwupd/uefi_capsule.conf ] &&
   ls /sys/firmware/efi/efivars/fwupd-*-0abba7dc-e516-4167-bbf5-4d9d1c739416 1>/dev/null 2>&1; then
      . /var/lib/fwupd/uefi_capsule.conf
      if [ "${EFI_PATH}" != "" ] && [ "${ESP}" != "" ]; then
      echo "Adding Linux Firmware Updater entry" >&2
cat << EOF
menuentry 'Linux Firmware Updater' \$menuentry_id_option 'fwupd' {
EOF
      ${grub_probe:?}
      prepare_grub_to_access_device '`${grub_probe} --target=device \${ESP}` | sed -e "s/^/\t/"'
cat << EOF
    chainloader ${EFI_PATH}
}
EOF
      fi
fi

====================== sdc1/boot/grub/grub.cfg (filtered) ======================

Start Linux Mint 21.1 Cinnamon 64-bit
Start Linux Mint 21.1 Cinnamon 64-bit (compatibility mode)
OEM install (for manufacturers)
Boot from next volume
UEFI Firmware Settings
Test memory

========================= sdc1/syslinux.cfg (filtered) =========================

DEFAULT loadconfig

LABEL loadconfig
  CONFIG /isolinux/isolinux.cfg
  APPEND /isolinux/

==================== sdc1: Location of files loaded by Grub ====================

           GiB - GB             File                                 Fragment(s)
            ?? = ??             boot/grub/grub.cfg                             1

================== sdc1: Location of files loaded by Syslinux ==================

           GiB - GB             File                                 Fragment(s)
            ?? = ??             syslinux.cfg                                   1
            ?? = ??             ldlinux.sys                                    1

======================== Unknown MBRs/Boot Sectors/etc =========================


/dev/sda1: unknown GPT attributes
8000000000000000

grubにウィンドウを追加するには?

答え1

1つの考えられる解決策は、ファイルにWindowsエントリを追加することです(「手動」と仮定)/etc/grub.d/40_custom。このエントリは実行時にupdate-grub自動的に追加されます。

正確なものは、Windowsブートローダおよび/またはその他の詳細によって試行錯誤がある可能性があります。

一例(/etc/grub.d/40_custom)。前の行はmenuentry...すでにファイルにあるので、次の項目を追加するだけです。

#!/bin/sh
exec tail -n +3 $0
# 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.

# Add this

menuentry 'Windows' {
     insmod ntfs
     insmod ntldr
     insmod part_msdos
     insmod search_fs_uuid
     # the uuid would be of the partition where the bootloader is, I assume sda2
     search --no-floppy --fs-uuid --set=root 715729d9-1ab0-4a3a-a829-b2a6a909e4e6
     ntldr /bootmgr
}

コンテンツを追加して実行する必要がありますupdate-grub

答え2

コメントを残してくれた皆さんに感謝します。数時間後に解決策を見つけました。したがって、WindowsブートローダはLinuxのインストール後に削除され、ブートリカバリを介してそれらを復元することはできません。

実際、Linuxでも回復ができないと思います。

Windows 10 PEライブUSBを作成しました。そして、c:\ windowsでbcdbootを実行してください。方法はわかりませんが、このユーティリティは現在LinuxがインストールされているSSDにエントリポイントを追加しました。 grubにはすべてのメニュー項目があります。

バラよりそれ記事では説明します。

また、これが後ろでどのように機能するかを知りたいです。ご存知の場合はコメントを残してください。

関連情報