Ubuntu 20.04 在更新後啟動到 grub 終端,無法使用 update-grub 永久修復

Ubuntu 20.04 在更新後啟動到 grub 終端,無法使用 update-grub 永久修復

更新後,Ubuntu 20.04 啟動至 grub 終端機。我能夠按照下面的解決方案恢復登錄,但每次重新啟動時都會出現 grub 終端。

我按照該影片中的說明操作https://youtu.be/r7meKJsjqfY讓我恢復並運行,但最後的步驟update-grub(我也嘗試過grub-mkconfig /boot/grub/grub.cfg)並不能永久解決問題。每次重新啟動我都會得到 grub 終端機。

到目前為止我的解決方案...

ls (hd1,gpt2)/ls (hd0,gpt2) <-----(this changes with/without external drive *)
set root=(hd1,gpt2)
linux /boot/vmlinuz root=/dev/sda2
initrd /boot/initrd.img
boot

(我嘗試設定 linux /boot/vmlinuz-5.4.0-40-generic 和 linux /boot/vmlinuz-5.4.0-42-generic 並使用各自的 IMG 檔案)

重啟後打開終端機。我都試過了....

sudo update-grub

grub-mkconfig /boot/grub/grub.cfg

其輸出...

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-42-generic
Found initrd image: /boot/initrd.img-5.4.0-42-generic
Found linux image: /boot/vmlinuz-5.4.0-40-generic
Found initrd image: /boot/initrd.img-5.4.0-40-generic
Adding boot menu entry for UEFI Firmware Settings
done

我還需要做其他事嗎? (我是 Linux 新手,所以文件和其他解決方案感覺相當冗長,並沒有真正描述我的問題 - 至少我覺得我已經接近解決方案並錯過了明顯的)

這是我的 grub 文件

cat /etc/default/grub/

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

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

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

cat /etc/default/grub.d/init-select.cfg

# Work around a bug in the obsolete init-select package which broke
# grub-mkconfig when init-select was removed but not purged.  This file does
# nothing and will be removed in a later release.
#
# See:
#   https://bugs.debian.org/858528
#   https://bugs.debian.org/863801

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:    20.04
Codename:   focal
  • 附加資訊...

如果我ls在 grub 終端機中使用和不使用外部磁碟機啟動,我會看到根磁碟機的不同標籤。

(proc) (hd0) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1) (hd1) (hd1,gpt2) (hd1,gpt1) (cd0)

不含外部驅動器

(proc) (hd0) (hd0,gpt2) (hd0,gpt1) (cd0)

答案1

您有 1 個 MBR 驅動器和 1 個 GPT 驅動器? UEFI 應該是 gpt。

讓我們查看詳細信息,將ppa 版本與您的即時安裝程式(第二個選項)或任何工作安裝一起使用,而不是較舊的引導修復ISO:請將Pastebin 連結複製並貼上到引導資訊摘要報告(不要發布報告),不要運行自動修復直至經過審核。

https://help.ubuntu.com/community/Boot-Repair

https://sourceforge.net/p/boot-repair/home/Home/

如果是 UEFI,則不應將開機載入程式放在 MBR 中,因為所有開機檔案都位於 ESP - efi 系統分割區中。 MBR 可用於舊 BIOS 引導,但如果是 UEFI 系統則不應使用。

MBR 與 gpt 一起存在,僅適用於一個分割項目,表示磁碟機是 gpt,因此舊的分割工具不會嘗試將磁碟機重新分割到 MBR 並損壞它。

答案2

我會嘗試使用以下命令重新建立 initramfs:

sudo update-initramfs -c -k 5.4.0-42-generic

隨後sudo update-grub重新啟動。

相關內容