GRUB이 Windows 부팅 파티션을 감지하도록 하는 방법은 무엇입니까?

GRUB이 Windows 부팅 파티션을 감지하도록 하는 방법은 무엇입니까?

저는 이중 부팅 Windows/Kali Linux를 사용하고 있으며 최신 grub 업데이트 이후 Windows 항목이 제거되었습니다.

Windows 부팅 파티션은 BIOS에서 부팅할 때 작동하지만 GRUB가 해당 구성에 자동으로 추가하도록 할 수 없습니다.

운영 체제가 다음을 올바르게 감지했습니다.

╰─❯ sudo os-prober
/dev/sda2@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi
╰─❯ efibootmgr -v
BootCurrent: 0007
Timeout: 0 seconds
BootOrder: 0007,0006,0001,0000,0002,0003,0004,0005
Boot0000  Windows Boot Manager  HD(2,GPT,e7826255-29ed-4a3f-9293-05f922724cd1,0x800,0x100000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)WINDOWS.........x...B.C.D.O.B.J.E.C.T.=.{.9.d.e.a.8.6.2.c.-.5.c.d.d.-.4.e.7.0.-.a.c.c.1.-.f.3.2.b.3.4.4.d.4.7.9.5.}...a................
Boot0001  UEFI: Samsung SSD 860 EVO 1TB, Partition 2    HD(2,GPT,e7826255-29ed-4a3f-9293-05f922724cd1,0x800,0x100000)/File(\EFI\Boot\BootX64.efi)..BO
Boot0002* Diskette Drive    BBS(Floppy,Diskette Drive,0x0)..BO
Boot0003* USB Storage Device    BBS(USB,USB Storage Device,0x0)..BO
Boot0004* CD/DVD/CD-RW Drive    BBS(CDROM,CD/DVD/CD-RW Drive,0x0)..BO
Boot0005* Onboard NIC   BBS(Network,Onboard NIC,0x0)..BO
Boot0006* Grub  PciRoot(0x0)/Pci(0x17,0x0)/Sata(0,65535,0)/HD(2,GPT,e7826255-29ed-4a3f-9293-05f922724cd1,0x800,0x100000)/File(\EFI\Boot\bootx64.efi)
Boot0007* kali  HD(2,GPT,e7826255-29ed-4a3f-9293-05f922724cd1,0x800,0x100000)/File(\EFI\kali\grubx64.efi)

이것은 내 파티션입니다.

╰─❯ sudo parted -l
Model: ATA Samsung SSD 860 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system     Name     Flags
 2      1049kB  538MB   537MB   fat32                    boot, esp
 3      538MB   239GB   239GB   ext4
 4      239GB   256GB   16.8GB  linux-swap(v1)           swap
 1      256GB   1000GB  744GB   ntfs            Storage  msftdata


Model: BC501 NVMe SK hynix 512GB (nvme)
Disk /dev/nvme0n1: 512GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system  Name                          Flags
 1      1049kB  17.8MB  16.8MB               Microsoft reserved partition  msftres
 2      17.8MB  510GB   510GB   ntfs         Basic data partition          msftdata
 3      510GB   511GB   773MB   ntfs                                       hidden, diag
 4      511GB   512GB   1139MB  ntfs         Basic data partition          diag

파티션을 수동으로 마운트하려는 경우:

╰─❯ sudo mount /dev/sda2 /boot/efi
mount: /boot/efi: /dev/sda2 already mounted on /boot/efi.
       dmesg(1) may have more information after failed mount system call.

grub을 업데이트할 때 Windows 항목이 추가되지 않음(와 동일한 출력 grub-mkconfig)

╰─❯ sudo update-grub
Generating grub configuration file ...
Found theme: /boot/grub/themes/kali/theme.txt
Found background image: /boot/grub/themes/fallout-grub/background.png
Found linux image: /boot/vmlinuz-5.17.0-kali3-amd64
Found initrd image: /boot/initrd.img-5.17.0-kali3-amd64
Found linux image: /boot/vmlinuz-5.16.0-kali7-amd64
Found initrd image: /boot/initrd.img-5.16.0-kali7-amd64
Found linux image: /boot/vmlinuz-5.17.0-kali3-amd64
Found initrd image: /boot/initrd.img-5.17.0-kali3-amd64
Found linux image: /boot/vmlinuz-5.16.0-kali7-amd64
Found initrd image: /boot/initrd.img-5.16.0-kali7-amd64
Adding boot menu entry for EFI firmware configuration
done

답변1

/etc/grub.d/40_custom@artem-s-tashkinov의 제안에 따라 grub backup( ) 기반 파일을 편집하여 Windows 항목을 수동으로 추가하고 /etc/grub.d/backup/boot_grub/grub.cfgUUID를 교체한 후 update-grub.

╰─❯ cat /etc/grub.d/40_custom
#!/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.
menuentry "Windows 10" --class windows --class os $menuentry_id_option 'osprober-efi-' {
    insmod part_gpt
    insmod fat
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root  7A03-CA46
    else
      search --no-floppy --fs-uuid --set=root 7A03-CA46
    fi
    chainloader /efi/Microsoft/Boot/bootmgfw.efi
}

잘 작동합니다. 감사합니다.

관련 정보