Note: How to fix issue "system bootloader not found error"
Overview:
因應需求,製作完畢一可攜式OS-USB(ubuntu)後,出現UEFI無法順利導引至boot loader,進而導致開機失敗(進入UEFI Shell),如下圖:
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Root cause analysis
開機流程(以LINUX為例):
根據上圖,如在載入EFI system partition(ESP)失敗,則會進入UEFI shell或是退回BIOS,甚至進入無限迴圈,與當前狀況大致符合,於是產生兩個假設:
- 無法正確辨認ESP
- 無法正確辨認bootloader所導致
第一個假設的請況下,解決方案相當簡單:
重新製作一個USB系統碟,並在安裝階段多切割一塊partition,供存放initrd和kernel文件;也就是將/boot路徑下的config獨立存放,issue is fixed!!
如圖:
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
然而這樣出現兩個問題:
- 以往製作的、釋出的系統碟工具,都可能面臨重工的問題
- 這次的系統碟工具,客戶方有可能需要在"不啟動"情況下存入/修改內部設置文件,而安裝當初,第三個partition增加了lvm2,不僅增加掛載的複雜度,更有掛載失敗的可能性
於是嘗試從第二個假設著手:分析/修改bootloader
最初構思的解法也是如此,並參照了以下方法:
Fix bootloadder
然而失敗,經過分析的結果,確定bootloader有以下檔案:
- BOOTX64.CSV
- grub.cfg
- mmx64.efi
- shimix64.efi
- grubx64.efi
其中,grub.cfg載明關於grub的各類參數,與此案較無關係
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
workflow如下:
其中,修改BOOTX64.CSV的部份是將路徑預設值修改成/EFI/BOOT/BOOTX64.efi
在分析檔案結構時,發現是:自動生成的BOOTX64.efi無法被正確識別;然而在UEFI shell底下可以順利執行grubx64.efi並進入OS,所以解決方案如下:
將自動產生之BOOTX64.EFI刪除後,將grubx64.efi複製到/EFI/BOOT/,並命名為BOOTX64.EFI
附圖是可順利開機和無法順利開機之兩組系統碟目錄結構比較:
- 可順利開機:
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
- 無法順利開機:
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
(經實驗證明,與檔案大小寫無關連,所以單純修改檔名並無效用;BOOT.bak是筆者建立的備份資料夾,並非自然產生)
Commands
commands
修改指令如下,可先建立備份資料夾(BOOT.bak)以防誤刪檔案:
command: cp /boot/efi/EFI/BOOT* /boot/efi/EFI/BOOT.bak
command: rm /boot/efi/EFI/BOOT/*
command: cp /boot/efi/EFI/BOOT.bak/fbx64.efi /boot/efi/EFI/BOOT/
command: cp /boot/efi/EFI/BOOT.bak/mmx64.efi /boot/efi/EFI/BOOT/
command: cp /boot/efi/EFI/ubuntu/fbx64.efi /boot/efi/EFI/BOOT/BOOTX64.efi
執行擷圖:
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
之後斷電,重新使用調整完畢的系統碟開機即可
Ref.
Fix bootloader
initrd & initramfs
GRUB 2
開機流程
The correlation between EFI、boot loading config & linux distribution
bootOrder not found