为了清除锁定的 nvram,我运行了
root@ubuntu:~# sudo apt install grub-efi-amd64-signed shim-signed
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
grub-efi-amd64-signed is already the newest version (1.180+2.06-2ubuntu7).
shim-signed is already the newest version (1.51+15.4-0ubuntu9).
0 upgraded, 0 newly installed, 0 to remove and 229 not upgraded.
root@ubuntu:~# mount /dev/nvme0n1p2 /mnt
root@ubuntu:~# mount /dev/nvme0n1p1 /mnt/boot/efi
root@ubuntu:~# grub-install /dev/nvmeOn1 --boot-directory=/mnt/boot --uefi-secure-boot
Installing for x86_64-efi platform.
Installation finished. No error reported.
root@ubuntu:~#
然后运行启动修复,三个错误仍然存在...我不小心关闭了启动修复信息,所以我不知道锁是否被清除了。然而,
root@ubuntu:/# nvram -c
nvram: command not found
下次更新。我按照建议删除了 UEFI 固件中的 ubuntu 启动项如何在 BIOS 启动菜单中删除“Ubuntu”?(UEFI)。
root@ubuntu:~# mkdir /mnt/efipart
root@ubuntu:~# mount /dev/nvme0n1p1 /mnt/efipart
root@ubuntu:cd /mnt/efipart/EFI/ubuntu
root@ubuntu:/mnt/efipart/EFI/ubuntu# rm -r /mnt/efipart/EFI/ubuntu
root@ubuntu:/mnt/efipart/EFI/ubuntu#
然后我运行了启动修复并得到了以下结果:
修复过程中出现错误。错误:NVram 已锁定(在 efibootmgr 中未找到 Ubuntu)。请将此消息报告给[电子邮件保护] 文本查看器中将打开一个新文件 (/var/log/boot-repair/20220623_175437/Boot-Info_20220623_1754.txt)。如果您仍然遇到启动问题,请将其内容指示给: [电子邮件保护] 检测到锁定的 NVram。
重启后没有变化,仍然是相同的三个错误。我还注意到 UEFI 固件中的 ubuntu 启动项仍然存在。
root@ubuntu:~# efibootmgr -v
BootCurrent: 0013
Timeout: 1 seconds
BootOrder: 0013,0012,0011,000F,000E
Boot000E* CD/DVD Drive BBS(CDROM,,0x0)AMGOAMNO........o.T.S.S.T.c.o.r.p. .C.D.D.V.D.W. .S.H.-.2.2.4.D.B....................A...........................>..Gd-.;.A..MQ..L.9.R.E.3.8.6.F.C.0.3.4.1.N.8. . . . . . ......AMBO
Boot000F* Hard Drive BBS(HD,,0x0)AMGOAMNO........o.W.D.C. .W.D.1.0.E.A.R.X.-.0.0.N.0.Y.B.0....................A...........................>..Gd-.;.A..MQ..L. . . . .W. .-.D.M.W.0.C.0.T.3.3.1.2.4.3......AMBOAMNO........o.W.D.C. .W.D.2.0.E.Z.R.X.-.0.0.D.8.P.B.0....................A...........................>..Gd-.;.A..MQ..L. . . . .W. .-.D.M.W.4.C.1.N.7.7.3.2.9.9......AMBOAMNO........o.S.a.n.D.i.s.k. .S.D.8.S.B.B.U.1.2.0.G.1.1.2.2....................A...........................>..Gd-.;.A..MQ..L.6.1.8.2.4.7.4.4.2.1.6.0. . . . . . . . ......AMBOAMNO........q.G.e.n.e.r.i.c. .U.S.B. .S.D. .R.e.a.d.e.r. .1...0.0....................A.............................>..Gd-.;.A..MQ..L.1.2.3.4.5.6.7.8.9.0.1.2.3.4.5.6.7.8.9.0......AMBO
Boot0011* UEFI OS HD(1,GPT,04802071-8017-41e3-a394-e98aea0add09,0x800,0xf3800)/File(\EFI\BOOT\BOOTX64.EFI)
Boot0012* ubuntu HD(1,GPT,04802071-8017-41e3-a394-e98aea0add09,0x800,0xf3800)/File(\EFI\UBUNTU\GRUBX64.EFI)
Boot0013* UEFI: Generic USB SD Reader 1.00 PciRoot(0x0)/Pci(0x1a,0x0)/USB(1,0)/USB(6,0)/HD(2,GPT,a09db2b8-b5f6-43ae-afb1-91e0a90189a1,0x6cc954,0x2130)AMBO
root@ubuntu:~#
有什么建议么?
更新“没有这样的设备错误”,我按照@Neil的建议通过命令行重新安装了 grub,Grub救援没有这样的设备 和@kyodake建议的“无法找到EFI”位,grub-install:错误:找不到 EFI 目录
root@ubuntu:~# mount /dev/nvme0n1p2 /mnt
root@ubuntu:~# grub-install
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
root@ubuntu:~# mount /dev/nvme0n1p1 /mnt
root@ubuntu:~# grub-install
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
root@ubuntu:~# mount /dev/nvme0n1p2 /mnt
root@ubuntu:~# mount /dev/nvme0n1p1 /mnt/boot/efi
root@ubuntu:~# grub-install --boot-directory=/mnt/boot --bootloader-id=ubuntu --target=x86_64-efi --efi-directory=/mnt/boot/efi
Installing for x86_64-efi platform.
Installation finished. No error reported.
我重新启动了,但还是出现了跟之前一样的三条错误信息。据我所知,fdisk -l 和 lsblk 没有变化。
我现在已在新 ssd 上重新安装了 22.04。Gparted 询问将引导加载程序放在哪里,我选择了 EFI 分区 (nvme0n1p1)。重启后,我在 UEFI 固件中更改了引导顺序,在下次重启后,我得到了
错误:没有这样的设备 [新根分区的 uuid]。错误:未找到文件“/boot/vmlinuz-5.15.0-33-generic”。错误:您需要先加载内核。
以下从实时 USB 棒进行的启动修复没有改变任何东西。到目前为止,我不再做任何其他事情,因为那之前已经弄乱了我的系统(请参阅上面的原始帖子)。
我刚刚注意到,虽然我刚刚安装了 22.04,但 / 和 /home 上都有数据。由于我之前已将目录复制到 ssd,现在是否有可能将它们自动复制到新安装的 22.04 上?
ubuntu@ubuntu:~$ sudo -i
root@ubuntu:~# fdisk -l
Disk /dev/loop0: 2.33 GiB, 2502324224 bytes, 4887352 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/nvme0n1: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: WD Blue SN570 500GB
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: 85F2585A-78A0-49E2-A09D-E93A7B6F9223
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 999423 997376 487M EFI System
/dev/nvme0n1p2 999424 118185983 117186560 55.9G Linux filesystem
/dev/nvme0n1p3 118185984 976771071 858585088 409.4G Linux filesystem
Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WDC WD10EARX-00N
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: dos
Disk identifier: 0xa9e9f62d
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 1953523711 1953521664 931.5G 7 HPFS/NTFS/exFAT
Disk /dev/sdb: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: WDC WD20EZRX-00D
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: dos
Disk identifier: 0xa30a6203
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 3907028991 3907026944 1.8T 7 HPFS/NTFS/exFAT
Disk /dev/sdc: 111.79 GiB, 120034123776 bytes, 234441648 sectors
Disk model: SanDisk SD8SBBU1
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: 046EB513-B772-4255-9C4F-9E112449003C
Device Start End Sectors Size Type
/dev/sdc1 2048 999423 997376 487M EFI System
/dev/sdc2 999424 59592703 58593280 27.9G Linux filesystem
/dev/sdc3 59592704 234440703 174848000 83.4G Linux filesystem
The backup GPT table is corrupt, but the primary appears OK, so that will be used.
Disk /dev/sdd: 7.61 GiB, 8168931328 bytes, 15954944 sectors
Disk model: USB SD Reader
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: A09DB2B8-B5F6-43AE-AFB3-91E0A90189A1
Device Start End Sectors Size Type
/dev/sdd1 64 7129427 7129364 3.4G Microsoft basic data
/dev/sdd2 7129428 7137923 8496 4.1M EFI System
/dev/sdd3 7137924 7138523 600 300K Microsoft basic data
/dev/sdd4 7139328 15954880 8815553 4.2G Linux filesystem
root@ubuntu:~# lsblk -o NAME,UUID,LABEL,FSTYPE
NAME UUID LABEL FSTYPE
sda
└─sda1 3CECE8015D533D10 ntfs
sdb
└─sdb1 7298AD2F71D18046 ntfs
sdc
├─sdc1 8229-FB8C vfat
├─sdc2 08976726-a0e8-4a28-a272-4248507169fa ext4
└─sdc3 d9c471f5-8756-4d49-a5cf-a94687b25fcb ext4
sdd 2022-04-19-10-23-19-00 Ubuntu 22.04 LTS amd64 iso9660
├─sdd1 2022-04-19-10-23-19-00 Ubuntu 22.04 LTS amd64 iso9660
├─sdd2 8D6C-A9F8 ESP vfat
├─sdd3
└─sdd4 f1cf0ecb-8f65-4bd0-ae2a-393aa54f0da6 writable ext4
sr0
nvme0n1
├─nvme0n1p1 6EA6-4D2B BOOT ESP vfat
├─nvme0n1p2 9c4e476d-62d5-401e-8a2b-cfc854782173 ext4
└─nvme0n1p3 afa6d092-848e-4aa0-a87e-5ac7ab0e746e ext4
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/nvme0n1p2 during installation
UUID=9c4e476d-62d5-401e-8a2b-cfc854782173 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/nvme0n1p1 during installation
UUID=6EA6-4D2B /boot/efi vfat umask=0077 0 1
# /home was on /dev/nvme0n1p3 during installation
UUID=afa6d092-848e-4aa0-a87e-5ac7ab0e746e /home ext4 defaults 0 2
/swapfile none swap sw 0 0
我在 ssd 上运行 20.04,最近在新的 ssd 上安装了 22.04。然后我将 /home 和 / 从旧 ssd 复制到新 ssd(全部成功)。但我无法从新 ssd 启动,因为它出现“错误:没有这样的设备 [uuid]。错误:未找到文件‘/boot/vmlinuz-5.15.0-33-generic’。错误:您需要先加载内核。”
我尝试逐一解决这些问题,但毫无进展。然后我使用启动修复,但仍然收到相同的错误消息。
接下来我想移动引导加载程序。
root@ubuntu:/# grub-install /dev/nvme0n1
Installing for x86_64-efi platform.
grub-install: error: cannot find EFI directory.
root@ubuntu:/# mount /dev/nvme0n1p2
mount: /dev/nvme0n1p2: can't find in /etc/fstab.
root@ubuntu:/# mount /dev/nvme0n1p2 /mnt
root@ubuntu:/# mount /dev/nvme0n1p1 /mnt/boot/efi
root@ubuntu:/# grub-install --boot-directory=/mnt/boot --bootloader-id=ubuntu --target=x86_64-efi --efi-directory=/mnt/boot/efi
Installing for x86_64-efi platform.
Installation finished. No error reported.
重启后,我收到与之前相同的错误消息(没有这样的设备……)。现在我真的陷入困境,非常希望得到任何建议。
root@ubuntu:~# fdisk -l
Disk /dev/nvme0n1: 465.76 GiB, 500107862016 bytes, 976773168 sectors
Disk model: WD Blue SN570 500GB
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: 11521EA3-923B-455A-8267-3A2FE7AE179D
Device Start End Sectors Size Type
/dev/nvme0n1p1 2048 999423 997376 487M EFI System
/dev/nvme0n1p2 999424 118185983 117186560 55.9G Linux filesystem
/dev/nvme0n1p3 118185984 976771071 858585088 409.4G Linux filesystem
Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WDC WD10EARX-00N
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: dos
Disk identifier: 0xa9e9f62d
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 1953523711 1953521664 931.5G 7 HPFS/NTFS/exFAT
Disk /dev/sdb: 1.82 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: WDC WD20EZRX-00D
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: dos
Disk identifier: 0xa30a6203
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 3907028991 3907026944 1.8T 7 HPFS/NTFS/exFAT
Disk /dev/sdc: 111.79 GiB, 120034123776 bytes, 234441648 sectors
Disk model: SanDisk SD8SBBU1
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: 046EB513-B772-4255-9C4F-9E112449003C
Device Start End Sectors Size Type
/dev/sdc1 2048 999423 997376 487M EFI System
/dev/sdc2 999424 59592703 58593280 27.9G Linux filesystem
/dev/sdc3 59592704 234440703 174848000 83.4G Linux filesystem
The backup GPT table is corrupt, but the primary appears OK, so that will be used.
Disk /dev/sdd: 7.61 GiB, 8168931328 bytes, 15954944 sectors
Disk model: USB SD Reader
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: A09DB2B8-B5F6-43AE-AFB3-91E0A90189A1
Device Start End Sectors Size Type
/dev/sdd1 64 7129427 7129364 3.4G Microsoft basic data
/dev/sdd2 7129428 7137923 8496 4.1M EFI System
/dev/sdd3 7137924 7138523 600 300K Microsoft basic data
/dev/sdd4 7139328 15954880 8815553 4.2G Linux filesystem
root@ubuntu:~# lsblk -o NAME,UUID,LABEL,FSTYPE
NAME UUID LABEL FSTYPE
loop0 squashfs
loop1 squashfs
loop2 squashfs
loop3 squashfs
loop4 squashfs
loop5 squashfs
loop6 squashfs
loop7 squashfs
loop8 squashfs
sda
└─sda1 3CECE8015D533D10 ntfs
sdb
└─sdb1 7298AD2F71D18046 ntfs
sdc
├─sdc1 8229-FB8C vfat
├─sdc2 08976726-a0e8-4a28-a272-4248507169fa ext4
└─sdc3 d9c471f5-8756-4d49-a5cf-a94687b25fcb ext4
sdd 2022-04-19-10-23-19-00 Ubuntu 22.04 LTS amd64 iso9660
├─sdd1 2022-04-19-10-23-19-00 Ubuntu 22.04 LTS amd64 iso9660
├─sdd2 8D6C-A9F8 ESP vfat
├─sdd3
└─sdd4 f1cf0ecb-8f65-4bd0-ae2a-393aa54f0da6 writable ext4
sr0
nvme0n1
├─nvme0n1p1 6EA6-4D2B BOOT ESP vfat
├─nvme0n1p2 9c4e476d-62d5-401e-8a2b-cfc854782173 ext4
└─nvme0n1p3 afa6d092-848e-4aa0-a87e-5ac7ab0e746e ext4
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sdc2 during installation
# old SSD / on sdc2
UUID=08976726-a0e8-4a28-a272-4248507169fa / ext4 errors=remount-ro 0 1
# new SSD / on nvme0n1p2
UUID=9c4e476d-62d5-401e-8a2b-cfc854782173 / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sdc1 during installation
# old EFI on sdc1
UUID=8229-FB8C /boot/efi vfat umask=0077 0 1
# new EFI on /dev/nvme0n1p1
UUID=7176-F776 /boot/efi vfat umask=0077 0 1
# /home was on /dev/sdc3 during installation
UUID=d9c471f5-8756-4d49-a5cf-a94687b25fc /home ext4 errors=remount-ro 0 1
/swapfile none swap sw 0 0
/dev/disk/by-uuid/7298AD2F71D18046 /mnt/7298AD2F71D18046 auto nosuid,nodev,nofail,x-gvfs-name=Storage,x-gvfs-sho>
/dev/disk/by-uuid/3CECE8015D533D10 /mnt/3CECE8015D533D10 auto nosuid,nodev,nofail,x-gvfs-name=Labor,x-gvfs-show >
UUID=afa6d092-848e-4aa0-a87e-5ac7ab0e746e /home ext4 defaults,auto 0 2
# apparently added by boot repair
UUID=6EA6-4D2B /boot/efi vfat defaults 0 1
答案1
将根目录/
从一个 Ubuntu 系统复制到另一个系统从来都不是一个好主意...更不用说在不同的版本之间...所以现在你有两个版本混合在一起。
复制/
应该会弄乱文件权限(以及其他一些东西),并且无法进行任何可行的修复...并且显然除其他事情之外,您/etc/fstab
从另一个驱动器复制了旧文件(其中包含旧的 uuid)并覆盖了新驱动器中的文件,因此 uuid 不再有效...因此您收到错误...但是,不幸的是,在这种情况下,这个错误应该是您最不关心的问题。
您的 Ubuntu 系统目前处于无法修复的状态...从实时 USB 启动,备份您的/home
目录和任何个人数据,然后全新安装 Ubuntu。
下次避免复制系统文件和目录...您需要复制的只是您的主目录和个人数据。