Grub은 다른 하드 드라이브에 Windows 항목을 추가할 수 없습니다(이중 부팅).

Grub은 다른 하드 드라이브에 Windows 항목을 추가할 수 없습니다(이중 부팅).

최근 SSD 드라이브에 Linux(MintOS)를 설치했습니다. 내 하드 드라이브에도 Windows 10이 있습니다. Windows는 Linux보다 먼저 설치되었습니다.

문제는 grub 로더가 Windows 로더를 인식하지 못하고 Windows에서 부팅할 수 없다는 것입니다.

해당 SSD에는 서로 다른 두 개의 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

한 가지 가능한 해결책은 파일에 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에 모든 메뉴 항목이 있습니다.

바라보다저것기사에서는 설명합니다.

또한, 이것이 뒤에서 어떻게 작동하는지 알고 싶습니다. 아시는 경우 댓글을 남겨주세요.

관련 정보