持久修復“支援最小 BASH 之類的行編輯”

持久修復“支援最小 BASH 之類的行編輯”

昨天我將作業系統版本從 Kubuntu 20.04 更新到 22.04,不幸的是它帶來了一系列問題(主要是 Grub 2.06)

今天,我在啟動Grub時遇到以下錯誤:

minimal BASH like line editing is supported (...).

我沒有看到通常的圖形介面,而是看到了一個 CLI,要求我輸入。我已經成功地暫時解決了這個問題,並給出了建議這篇文章位於 geeksforgeeks.org

透過執行以下命令:

set root=(hd1,gpt2)
set prefix=(hd1,gpt2)/boot/grub
insmod normal
normal

sudo grub-install /dev/sdXY (in my case, /boot/efi is located on sdb3)
sudo update-grub

啟動我的作業系統時。但是,重新啟動後問題仍然存在,並且我再次被發送到 CLI。

輸出來自

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.15.0-52-generic
Found initrd image: /boot/initrd.img-5.15.0-52-generic
Found linux image: /boot/vmlinuz-5.4.0-131-generic
Found initrd image: /boot/initrd.img-5.4.0-131-generic
Found linux image: /boot/vmlinuz-5.4.0-56-generic
Found initrd image: /boot/initrd.img-5.4.0-56-generic
Found linux image: /boot/vmlinuz-5.15.0-52-generic
Found initrd image: /boot/initrd.img-5.15.0-52-generic
Found linux image: /boot/vmlinuz-5.4.0-131-generic
Found initrd image: /boot/initrd.img-5.4.0-131-generic
Found linux image: /boot/vmlinuz-5.4.0-56-generic
Found initrd image: /boot/initrd.img-5.4.0-56-generic
Memtest86+ needs a 16-bit boot, that is not available on EFI, exiting
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.
Found Windows Boot Manager on /dev/sdb3@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
Found linux image: /boot/vmlinuz-5.15.0-52-generic
Found initrd image: /boot/initrd.img-5.15.0-52-generic
Found linux image: /boot/vmlinuz-5.4.0-131-generic
Found initrd image: /boot/initrd.img-5.4.0-131-generic
Found linux image: /boot/vmlinuz-5.4.0-56-generic
Found initrd image: /boot/initrd.img-5.4.0-56-generic
Found Windows Boot Manager on /dev/sdb3@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings

輸出grub-install

Installing for x86_64-efi platform.
Installation finished. No error reported.

輸出df

Filesystem     1K-blocks      Used Available Use% Mounted on
tmpfs            1629800      1972   1627828   1% /run
/dev/sdb2      205377444  77481204 117390824  40% /
tmpfs            8148984       512   8148472   1% /dev/shm
tmpfs               5120         4      5116   1% /run/lock
/dev/sdb3         998480     37892    960588   4% /boot/efi
/dev/sda1      557135192 205411480 323349288  39% /media/User/Linux HDD
tmpfs            1629796        84   1629712   1% /run/user/1000
/dev/sdb4      277079036  24608052 252470984   9% /media/User/Windows_10
/dev/sdc1      976758780 504811472 471947308  52% /media/User/Seagate

輸出fdisk -l

Device     Start        End    Sectors   Size Type
/dev/sda1   2048 1134323711 1134321664 540,9G Linux filesystem

Disk /dev/sdb: 465,76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: CT500MX500SSD1  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 9592ABCA-3C53-4225-B388-FDF8B09DF156

Device         Start       End   Sectors   Size Type
/dev/sdb1       2048     34815     32768    16M Microsoft reserved
/dev/sdb2    1052672 420614143 419561472 200,1G Linux filesystem
/dev/sdb3  420614144 422615039   2000896   977M EFI System
/dev/sdb4  422615040 976773119 554158080 264,2G Microsoft basic data

我該如何克服這個問題?

答案1

追蹤 grub 上的斷開連接並找到其選單。 cat /boot/efi/EFI/ubuntu/grub.cfg 文件,並將其中的 UUID 與 /dev/sdb2 的 UUID 進行比較(sudo blkid 將列出它們)。他們應該匹配。然後 configfile 指令使用 UUID 導入 grub 選單的 /boot/grub/grub.cfg 檔案-它是否存在?

答案2

如果您像我一樣使用 pop 作業系統(或可能的其他發行版),則配置的分割區似乎與/boot/efi/EFI/pop/grub.cfg我使用echo $prefix和時看到的不符echo $root

事實證明,GRUB 預設為麵包/boot/efi/EFI/ubuntu/grub.cfg,如果它不存在(被刪除或其他原因),它會使用一些預設值。

簡短的答案是將您的發行版複製grub.cfg到“/boot/efi/EFI/ubuntu/grub.cfg”中

Grub 僅在 shell 模式下,根和前綴設定錯誤

相關內容