Boot

grub-install:錯誤:找不到 NVME 雙啟動的 EFI 目錄

  • May 28, 2022

定期安裝 Xubuntu。最近每當與 apt 互動時,我都會收到以下錯誤:

$ sudo apt install vim
Reading package lists... Done
Building dependency tree       
Reading state information... Done
vim is already the newest version (2:8.0.1453-1ubuntu1.6).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.

Setting up grub-efi-amd64-signed (1.167~18.04.5+2.04-1ubuntu44.1.2) ...
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
dpkg: error processing package grub-efi-amd64-signed (--configure):
installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
grub-efi-amd64-signed
E: Sub-process /usr/bin/dpkg returned an error code (1)

請注意,我的系統啟動正常,我沒有遇到任何問題。

我嘗試解除安裝 grub*、重新安裝和更新 grub,但均無濟於事。這是其他文章中有關此問題的建議。

分區設置如下所示:

sudo blkid

/dev/nvme0n1p1: UUID="<ID>" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="<ID>"
/dev/nvme0n1p3: UUID="<ID>" TYPE="ntfs" PARTLABEL="Basic data partition" PARTUUID="<ID>"
/dev/nvme0n1p4: UUID="<ID>" TYPE="ntfs" PARTUUID="<ID>"
/dev/nvme1n1p1: UUID="<ID>" TYPE="vfat" PARTUUID="<ID>"
/dev/nvme1n1p2: UUID="<ID>" TYPE="swap" PARTUUID="<ID>"
/dev/nvme1n1p3: UUID="<ID>" TYPE="ext4" PARTUUID="<ID>"
/dev/loop8: TYPE="squashfs"
/dev/loop9: TYPE="squashfs"
/dev/loop10: TYPE="squashfs"
/dev/loop11: TYPE="squashfs"
/dev/loop12: TYPE="squashfs"
/dev/nvme0n1: PTUUID="<ID>" PTTYPE="gpt"
/dev/nvme0n1p2: PARTLABEL="Microsoft reserved partition" PARTUUID="<ID>"
/dev/nvme1n1: PTUUID="<ID>" PTTYPE="gpt"

mount顯示以下內容:

mount  | grep /dev

udev on /dev type devtmpfs (rw,nosuid,relatime,size=16377456k,nr_inodes=4094364,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
/dev/nvme1n1p3 on / type ext4 (rw,relatime,errors=remount-ro)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
mqueue on /dev/mqueue type mqueue (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
/dev/fuse on /run/user/1000/doc type fuse (rw,nosuid,nodev,relatime,user_id=<id>,group_id=<id>)
$ cat /etc/fstab
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/nvme1n1p3 during installation
UUID=<ID> /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/nvme0n1p1 during installation
# swap was on /dev/nvme1n1p2 during installation
UUID=<ID> none            swap    sw              0       0
UUID=F030-47FA /boot/efi vfat umask=0077,noauto 0 1
$lsblk -e 7 -o NAME,FSTYPE,LABEL,PARTUUID,MOUNTPOINT,SIZE,MODEL,UUID

NAME        FSTYPE LABEL PARTUUID                             MOUNTPOINT   SIZE MODEL                                    UUID
nvme1n1                                                                  YYY.YG Samsung SSD              
├─nvme1n1p1 vfat         <ID>              YYYM                                          <ID>
├─nvme1n1p2 swap         <ID> [SWAP]      YY.YG                                          <ID>
└─nvme1n1p3 ext4         <ID> /          YYY.YG                                          <ID>
nvme0n1                                                                  YYY.YG Samsung SSD
├─nvme0n1p1 vfat         <ID>              100M                                          <ID>
├─nvme0n1p2              <ID>               16M                                          
├─nvme0n1p3 ntfs         <ID>            YYY.YG                                          <ID>
└─nvme0n1p4 ntfs         <ID>              499M                                          <ID>
First line of fstab matches `nvme1n1p3`
Second line of fstab matches `nvme1n1p2`
Third line of stab matches `nvme0n1p1`

經過反複試驗,我所做的修復是:

sudo mount /boot/efi 
sudo apt autoremove

此時 apt 能夠在 /boot/efi 上完成安裝,並且雙引導中的兩個雙系統按預期工作仍然沒有變化。

引用自:https://unix.stackexchange.com/questions/671786