在机器一年多没有启动后进行升级时,我遇到了一些奇怪的 efi 错误,据我所知,这个系统甚至没有使用 UEFI。BIOS 启动设置为旧版。以前安装 Windows 7 时有一些保留空间,但第一个分区现在是一个简单的 260MB 类型的 ext4,什么也不做。
我一直在阅读有关 EFI 的资料,并且不想在这个系统上切换到 UEFI。grub-pc 已安装,但是似乎没有需要重建 initramfs 的新 linux 内核映像想要正确编译。
我已经删除了内核,重新安装了 grub-pc,格式化了第一个分区,挂载/卸载了它,检查 grub 是否正常,但我不知道如何解决这个问题,并且尝试了一整天。
这是来自 aptitude 更新的错误。
Setting up initramfs-tools (0.140ubuntu13.4pop2~1711143149~22.04~e0b5994) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for initramfs-tools (0.140ubuntu13.4pop2~1711143149~22.04~e0b5994) ...
update-initramfs: Generating /boot/initrd.img-5.15.0-105-generic
I: The initramfs will attempt to resume from /dev/nvme0n1p3
I: (UUID=c58e5139-ba75-4fc6-9785-9de7d350b976)
I: Set the RESUME variable to override this.
kernelstub.Config : INFO Looking for configuration...
kernelstub.Drive : ERROR Could not find a block device for the a partition. This is a critical error and we cannot continue.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/kernelstub/drive.py", line 56, in __init__
self.esp_fs = self.get_part_dev(self.esp_path)
File "/usr/lib/python3/dist-packages/kernelstub/drive.py", line 94, in get_part_dev
raise NoBlockDevError('Couldn\'t find the block device for %s' % path)
kernelstub.drive.NoBlockDevError: Couldn't find the block device for /boot/efi
run-parts: /etc/initramfs/post-update.d//zz-kernelstub exited with return code 174
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
Setting up initramfs-tools (0.140ubuntu13.4pop2~1711143149~22.04~e0b5994) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.140ubuntu13.4pop2~1711143149~22.04~e0b5994) ...
update-initramfs: Generating /boot/initrd.img-5.15.0-105-generic
I: The initramfs will attempt to resume from /dev/nvme0n1p3
I: (UUID=c58e5139-ba75-4fc6-9785-9de7d350b976)
I: Set the RESUME variable to override this.
kernelstub.Config : INFO Looking for configuration...
kernelstub.Drive : ERROR Could not find a block device for the a partition. This is a critical error and we cannot continue.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/kernelstub/drive.py", line 56, in __init__
self.esp_fs = self.get_part_dev(self.esp_path)
File "/usr/lib/python3/dist-packages/kernelstub/drive.py", line 94, in get_part_dev
raise NoBlockDevError('Couldn\'t find the block device for %s' % path)
kernelstub.drive.NoBlockDevError: Couldn't find the block device for /boot/efi
run-parts: /etc/initramfs/post-update.d//zz-kernelstub exited with return code 174
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
initramfs-tools
Press Return to continue, 'q' followed by Return to quit.
$ fdisk -l /dev/nvme0n1
Disk /dev/nvme0n1: 476.94 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: INTEL SSDPEKKW512G7
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 2BAB67F3-034D-44DD-BCB6-4D9FC7E5383E
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 534527 532480 260M Linux filesystem
/dev/nvme0n1p2 1050624 252708863 251658240 120G EFI System <-- old Win7 EFI
/dev/nvme0n1p3 252708864 386924527 134215664 64G Linux swap
/dev/nvme0n1p4 386924544 903315455 516390912 246.2G Linux filesystem
我已尝试将分区 1 设置为启动(esp 标志也已设置)但 grub-install 失败。
我已尝试将分区 2 设置为启动(esp 标志也已设置)但 grub-install 仍然失败?
$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=24538672k,nr_inodes=6134668,mode=755,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=4919400k,mode=755,inode64)
/dev/nvme0n1p2 on / type ext4 (rw,relatime,errors=remount-ro)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k,inode64)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=22664)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
none on /run/credentials/systemd-sysusers.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)
tmpfs on /run/qemu type tmpfs (rw,nosuid,nodev,relatime,mode=755,inode64)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=4919396k,nr_inodes=1229849,mode=700,uid=1000,gid=1000,inode64)
portal on /run/user/1000/doc type fuse.portal (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
$ sudo grub-install /dev/nvme0n1 (also tried /dev/nvme0n1p1 & p2 but no diff)
Installing for i386-pc platform.
grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
grub-install: warning: Embedding is not possible. GRUB can only be installed in this setup by using blocklists. However, blocklists are UNRELIABLE and their use is discouraged..
grub-install: error: will not proceed with blocklists.
安装的 grub 包是:
# dpkg -l | grep grub
ii grub-common:i386 2.06-2ubuntu7.2 i386 GRand Unified Bootloader (common files)
ii grub-gfxpayload-lists 0.7 amd64 GRUB gfxpayload blacklist
ii grub-pc 2.06-2ubuntu7.2 amd64 GRand Unified Bootloader, version 2 (PC/BIOS version)
ii grub-pc-bin 2.06-2ubuntu7.2 amd64 GRand Unified Bootloader, version 2 (PC/BIOS modules)
ii grub-theme-breeze 5.24.4-0ubuntu1 amd64 Breeze theme for GRUB 2
ii grub2-common:i386 2.06-2ubuntu7.2 i386 GRand Unified Bootloader (common files for version 2)
ii grub2-splashimages 1.0.1+nmu2 all a collection of great GRUB2 splashimages
ii grub2-themes-ubuntu-mate 0.3.7 all GRand Unified Bootloader, version 2 (ubuntu-mate theme)
ii grub2-themes-ubuntustudio 0.5 all GRand Unified Bootloader, version 2 (Ubuntu Studio theme)
更新之前,grub 正在更新 NVMe 启动顺序,并且启动正常。
我也尝试将 grub 切换到 grub-efi,但遇到问题,/boot/efi 分区上缺少 bios 文件,无法恢复为分区 1 作为标准 ext4,未安装并留在那里作为保留空间。
解决这个问题的方法是什么,或者较新的内核是否强制 GPT 磁盘使用 EFI?