잘못된 grub 접두사(efi) `grub-install` 및 `update-grub`으로 수정할 수 없음

잘못된 grub 접두사(efi) `grub-install` 및 `update-grub`으로 수정할 수 없음

질문:

부팅할 때 grub은 프롬프트( grub>대신 grub rescue>)를 입력합니다. 다음 항목을 입력해야 합니다.

set prefix=(hd0,gpt8)/boot/grub
insmod normal
normal

일반 그럽 메뉴를 가져옵니다.

지금까지 내가 찾은 모든 기사는 시스템 부팅을 수행 grub-install하고/하거나 일단 부팅하면 update-grub이 문제를 해결합니다 .
시도해 보았으나 문제가 지속됩니다.

세부 사항:

저는 Windows 10과 pop-os(우분투 기반)로 이중 부팅하고 있습니다. 부팅 모드가 UEFI안전 부팅 으로 설정된 Acer 노트북이 있습니다 enabled.

내 파티션은 다음과 같습니다.

$ lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT,UUID,LABEL,PARTUUID,PARTTYPE
NAME            SIZE FSTYPE MOUNTPOINT UUID                                 LABEL    PARTUUID                             PARTTYPE
sda           238.5G                                                                                                      
├─sda1          529M ntfs              6272EE1672EDEF2B                     Recovery b593e2b8-992e-4d79-9074-d990ba21d10c de94bba4-06d1-4d40-a16a-bfd50179d6ac
├─sda2          100M vfat              64EE-A907                                     6ef6e12c-3858-4a83-a1dd-8297719bd477 c12a7328-f81f-11d2-ba4b-00a0c93ec93b
├─sda3           16M                                                                 1b6ba39a-e528-4cf9-b158-cd1a9312afc2 e3c9e316-0b5c-4db8-817d-f92df00215ae
├─sda4        117.2G ntfs              8E6008B56008A655                              c2f2d5bf-16a3-4e99-a6db-2385b36f3f46 ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
├─sda5         58.6G ntfs              F6D0CCD7D0CC9EED                     Storage  c10e8d39-26c3-4d3b-8548-0aa97816ba0b ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
├─sda6          477M swap              74da5edc-3b6c-4644-a151-6b93562c8fa4          408e91bd-c7e7-4ab8-a2ac-bb2bb7fde375 0657fd6d-a4ab-43c4-84e5-0933c84b4f4f
│ └─cryptswap 476.5M swap   [SWAP]     2d2336c7-64c1-4d53-8e99-f66f9b93bef5                                               
├─sda7          600M vfat   /boot/efi  7565-8082                                     a8c1ff00-3790-4ca0-a360-642e6f1859f0 c12a7328-f81f-11d2-ba4b-00a0c93ec93b
└─sda8           61G ext4   /          d40fe3bd-0749-4c29-9e9b-97a064a659dd          8a3b8567-c511-48cd-a3fa-776b556d17da 0fc63daf-8483-4772-8e79-3d69d8477de4
  • 파티션 1-4는 Windows에서 생성되며 부트로더는 sda2.
  • 파티션 5는 Windows/Linux 간의 파일 공유를 용이하게 하기 위해 제가 만들었습니다.
  • 나머지 파티션은 pop-os에 의해 생성되며(Windows 설치 완료 후) pop-os 부트로더는 sda7.

나는 다음과 같이 grub을 설치했습니다.

$ sudo apt install grub-efi
$ sudo grub-install --bootloader-id=grub
Installing for x86_64-efi platform.
Installation finished. No error reported.
$ sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-7642-generic
Found initrd image: /boot/initrd.img-5.4.0-7642-generic
Found linux image: /boot/vmlinuz-5.4.0-7634-generic
Found initrd image: /boot/initrd.img-5.4.0-7634-generic
Found linux image: /boot/vmlinuz-5.4.0-7629-generic
Found initrd image: /boot/initrd.img-5.4.0-7629-generic
Found linux image: /boot/vmlinuz-5.4.0-7626-generic
Found initrd image: /boot/initrd.img-5.4.0-7626-generic
Found Windows Boot Manager on /dev/sda2@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings
done

그 후 내 /boot디렉토리는 다음과 같습니다.

$ sudo tree -a /boot
/boot
├── config-5.4.0-7626-generic
├── config-5.4.0-7629-generic
├── config-5.4.0-7634-generic
├── config-5.4.0-7642-generic
├── efi
│   ├── c0cc91f7cdfcb9a597d9db525eb08842
│   ├── EFI
│   │   ├── BOOT
│   │   │   └── BOOTX64.EFI
│   │   ├── Linux
│   │   ├── grub
│   │   │   ├── grub.cfg
│   │   │   └── grubx64.efi
│   │   ├── Pop_OS-d40fe3bd-0749-4c29-9e9b-97a064a659dd
│   │   │   ├── cmdline
│   │   │   ├── initrd.img
│   │   │   ├── initrd.img-previous
│   │   │   ├── vmlinuz.efi
│   │   │   └── vmlinuz-previous.efi
│   │   └── systemd
│   │       └── systemd-bootx64.efi
│   ├── loader
│   │   ├── entries
│   │   │   ├── Pop_OS-current.conf
│   │   │   └── Pop_OS-oldkern.conf
│   │   ├── loader.conf
│   │   └── random-seed
│   └── System Volume Information
│       ├── AadRecoveryPasswordDelete
│       └── ClientRecoveryPasswordRotation
├── grub
│   ├── fonts
│   │   └── unicode.pf2
│   ├── grub.cfg
│   ├── grubenv
│   └── x86_64-efi
│       ├── acpi.mod
|       < files omitted ... > 
│       └── zstd.mod
├── initrd.img -> initrd.img-5.4.0-7642-generic
├── initrd.img-5.3.0-7642-generic
< files omitted ... > 
├── initrd.img.old -> initrd.img-5.4.0-7634-generic
├── System.map-5.4.0-7626-generic
< files omitted ... > 
├── vmlinuz -> vmlinuz-5.4.0-7642-generic
├── vmlinuz-5.4.0-7626-generic
< files omitted ... > 
└── vmlinuz.old -> vmlinuz-5.4.0-7634-generic

16 directories, 314 files

/boot/efi/EFI/grub, 및 /boot/efi/EFI/BOOT아래의 파일이 /boot/grub새로 추가됩니다 grub-install.

또한 이것은 나에게 좋아 보인다:

$ cat /boot/efi/EFI/grub/grub.cfg 
search.fs_uuid d40fe3bd-0749-4c29-9e9b-97a064a659dd root hd0,gpt8 
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

EFI/grub/grubx64재부팅 후 F2를 눌러 부팅 순서의 맨 위에 추가했습니다 .여기에 이미지 설명을 입력하세요.

저장하고 종료한 후 grub 프롬프트가 표시됩니다.

그런 다음 set명령을 사용하면 다음 출력이 표시됩니다(일부 항목은 생략됨).

grub> set
cmdpath=(hd0,gpt7)/EFI/grub
grub_cpu=x86_64
grub_platform=efi
prefix=(hd0,gpt7)/EFI/ubuntu
root=(hd0,gpt7)

이제 길을 잃었네요. 올바른 부트로더( cmdpath=(hd0,gpt7)/EFI/pop)가 로드된 것 같지만 EFI/grub/grub.cfg. 이러한 잘못된 설정은 어디에서 발생합니까?

prefix위와 같이 수정한 후 1. pop-os, 2. pop-os 폴백 이미지, 3. windows 및 4. 부팅 설정에 대한 항목이 포함된 모든 기능을 갖춘 grub 메뉴를 얻었습니다. 모든 옵션을 시도했는데 모두 작동했습니다.

그래서 나는 popOs로 부팅하는데 성공했는데, efibootmgr -v이는 나에게 다음과 같이 알려줍니다:

$ efibootmgr -v
BootCurrent: 0003
Timeout: 0 seconds
BootOrder: 0003,0001,0002,0000,2001,2002,2003
Boot0000* Windows Boot Manager     HD(2,GPT,6ef6e12c-3858-4a83-a1dd-8297719bd477,0x109000,0x32000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)RC
Boot0001* systemd                  PciRoot(0x0)/Pci(0x17,0x0)/Sata(2,0,0)/HD(7,GPT,a8c1ff00-3790-4ca0-a360-642e6f1859f0,0x160d3000,0x12c000)/File(\EFI\systemd\systemd-bootx64.efi)A01 ..
Boot0002* HDD0: HFS256G39TND-N210A PciRoot(0x0)/Pci(0x17,0x0)/Sata(2,0,0)/HD(7,GPT,a8c1ff00-3790-4ca0-a360-642e6f1859f0,0x160d3000,0x12c000)RC
Boot0003* grub                     PciRoot(0x0)/Pci(0x17,0x0)/Sata(2,0,0)/HD(7,GPT,a8c1ff00-3790-4ca0-a360-642e6f1859f0,0x160d3000,0x12c000)/File(\EFI\grub\grubx64.efi)A01 ..
Boot0004* EFI USB Device           RC
Boot0005* EFI DVD/CDROM            RC
Boot0006* EFI Network              RC
Boot2001* EFI USB Device           RC
Boot2002* EFI DVD/CDROM            RC
Boot2003* EFI Network              RC

내가 무슨 일이 일어날 거라고 예상했는지

  1. (hd0,gpt7)/EFI/grub/grub.efiUEFI 펌웨어에서 grub을 부팅합니다.
  2. grub이 읽는 구성 파일입니다 (hd0,gpt7)/EFI/grub/grub.cfg. 이는 root으로 설정되고 으로 설정 (hd0,gpt8) 됩니다 .prefix(hd0,gpt8)/boot/grub
  3. grub은 에서 구성을 로드합니다 (hd0,gpt8)/boot/grub/grub.cfg.
  4. grub이 나에게 메뉴를 제시하면, 로드할 운영 체제를 선택하고 하루를 계속합니다.

실제로 무슨 일이 일어났는가

  1. (hd0,gpt7)/EFI/grub/grub.efiUEFI 펌웨어에서 grub을 부팅합니다.
  2. 유충확실히에 있는 구성 파일을 읽으십시오 (hd0,gpt7)/EFI/grub/grub.cfg. root대신 (hd0,gpt7)prefix로 설정됩니다 (hd0,gpt7)/boot/ubuntu.

    위에서 설명한 대로 오류를 수동으로 수정했습니다 prefix.
  3. grub은 에서 구성을 로드합니다 (hd0,gpt8)/boot/grub/grub.cfg.
  4. grub이 나에게 메뉴를 제시하면, 로드할 운영 체제를 선택하고 하루를 계속합니다.

내가 시도한 것들:

  • 보안 부팅 비활성화(차이 없음)
  • 재실행 grub-installupgrade-grub(차이 없음)
  • sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub --recheck --debug /dev/sda &> grub.log(차이 없음,여기서 출력)

답변1

생성 되면 기본값 grubx64.efi이 포함될 수 있습니다 .grub-mkimageprefix

데비안에서는 /EFI/debian로 설정되어 있고 grub-mkimage, grub-install우분투에서는 접두사가 /EFI/ubuntu​​입니다. 이로 인해 GRUB는 먼저 에 있는 미니 구성 파일을 읽게 됩니다 . 이 파일에는 일반적으로 GRUB 를 디렉터리/파일 시스템이 있는 위치 /EFI/(debian|ubuntu)/grub.cfg로 리디렉션하는 몇 줄만 포함되어 있으며 그 다음 거기에서 실제 구성 파일을 읽습니다./boot

<any configuration lines required to cover complications like software RAID, disk encryption or LVM>
search.fs_uuid <UUID of the filesystem that contains /boot>
set prefix=($root)'/boot/grub' # or just ($root)/grub if /boot is a separate filesystem 
configfile $prefix/grub.cfg

Pop!OS의 GRUB 패키지를 사용하는 경우 Pop의 패키저가 이에 충분한 주의를 기울이지 않으면 해당/기본값 grub-install에 유사한 레거시 "우분투주의"가 있을 수 있습니다 . grub-mkimage그리고 Pop의 기본 UEFI 부트로더는 GRUB가 아닌 Gutmiboot로 나타나므로 이러한 버그는 눈에 띄지 않을 수 있습니다.

grub-efi-amd64-signedSecure Boot 호환 패키지를 설치한 경우 원래 패키지 는 Secure Boot 서명 프로세스를 거쳤고 일반적으로 모든 GRUB 모듈이 내장되어 있기 때문에 /boot/efi/EFI/pop/grubx64.efi실제로는 다를 수 있습니다 ./boot/grub/x86_64-efi/grub.efi

아마도 Pop!OS 개발자는 grub-efi-amd64-signedSecureBoot가 아닌 서명된 버전에 변경 사항을 적용하지 않고 Ubuntu의 패키지를 있는 그대로 사용했을까요?


배경:

grub-install이 옵션과 함께 사용 하거나 --uefi-secure-bootSecure Boot가 감지되면 설치할 시스템 grub-mkimage구축에 최적화된 GRUB를 사용하지 않고 grubx64.efi대신 미리 컴파일되고 Secure Boot 서명된 GRUB을 사용합니다 /usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed.

적어도 데비안에서는 재현 가능한 빌드 기술을 사용하여 빌드되므로 해당 버전의 소스 코드 패키지와 별도의 보안 부팅 서명 파일을 사용하면 누구나 직접 컴파일하고 결과가 사전 빌드된 것과 정확히 동일한지 확인할 수 있습니다. 하나의 버전. 얻다저것부분적으로 잘 작동하는 것이 데비안이 보안 부팅 지원을 받는 데 시간이 걸리는 주된 이유인 것 같습니다.

답변2

문제의 정확한 원인은 완전히 명확하지 않지만 popOs 관리자가 잘못 구성한 grub 패키지와 관련이 있을 수 있습니다.

grub-install생성된 grub 파일을 복사하여 이 문제를 해결했습니다 /boot/efi/EFI/ubuntu. popO를 사용 중이고 grub-install옵션이 없는 경우 다음이 작동합니다.

sudo mv /boot/efi/EFI/pop /boot/efi/EFI/ubuntu

아직 테스트하지 않은 또 다른 해결 방법은 다음과 같습니다.

sudo cp /boot/grub/x86_64-efi/grub.efi /boot/efi/EFI/pop/grubx64.efi

자세한 내용은 다음을 참조하세요.오류 보고서.

답변3

에서 인용샘 드메이어답변,

아직 테스트하지 않은 또 다른 해결 방법은 다음과 같습니다.

sudo cp /boot/grub/x86_64-efi/grub.efi /boot/efi/EFI/pop/grubx64.efi

슬레이브 efi 파티션(내 OS에서 켜져 있는 파티션)으로 인해 grub.efi구성을 통해 GRUB 테마를 적용했는데도 GRUB 테마를 사용할 수 없게 됩니다. 대신 기본 파란색 그럽 테마가 사용됩니다./boot/grub/x86_64-efi/boot/efi/EFI/neon/grubx64.efi/etc/default/grubGRUB_THEME

내가 해결하고 싶은 솔루션이것내 테마를 유지하는 데 문제가 있는 것은 단지 테마를 복사하는 것입니다 /boot/efi/EFI/neon/grub.cfg./boot/efi/EFI/ubuntu/grub.cfg

sudo cp /boot/efi/EFI/neon/grub.cfg /boot/efi/EFI/ubuntu/grub.cfg

그 전에는 sudo grub-install달려야 합니다.

관련 정보