1

To clear the locked nvram I ran

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:~# 

Then ran boot repair and the three errors where still there... I accidentally closed the boot repair info, so I don't now if the lock was cleared. However,

root@ubuntu:/# nvram -c
nvram: command not found

Next update. I deleted the ubuntu boot entry in the UEFI firmware as suggested in How do I remove "Ubuntu" in the bios boot menu? (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#

I then ran boot repair and got this:

An error occurred during the repair. Error: NVram is locked (Ubuntu not found in efibootmgr). Please report this message to boot.repair@gmail.com A new file (/var/log/boot-repair/20220623_175437/Boot-Info_20220623_1754.txt) will open in your text viewer. In case you still experience boot problem, indicate its content to: boot.repair@gmail.com Locked-NVram detected.

No changes after reboot, still the same three errors. I have also noticed that the ubuntu boot entry in the UEFI firmware was still there.

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:~# 

Any suggestions?


Update re the 'no such device error' I reinstalled grub via command line as suggested by @Neil, Grub rescue no such device and the 'cannot find EFI' bit as suggested by @kyodake, grub-install: error: cannot find EFI directory

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.

I rebooted, but got the same three error messages as before. No changes in fdisk -l and lsblk as far as I can tell.


I have now re-installed 22.04 on the new ssd. Gparted asked where to place the boot loader and I choose the EFI partition (nvme0n1p1). After the reboot I changed the boot order in the UEFI firmware and after the following reboot I get

error: no such device [uuid of the new root partition]. error: file ‘/boot/vmlinuz-5.15.0-33-generic‘ not found. error: You need to load the kernel first.

The following boot repair from a live usb stick didn't change anything. I have so far abstained from doing anything else since that had messed up my system before (see original post above).

I have just noticed that both / and /home have data on it altough I have just installed 22.04. Since I had copied the directories to the ssd previously would it be possible that they were copied automatically onto the newly installed 22.04 now?

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

I run 20.04 on a ssd and have recently installed 22.04 on a new ssd. I then copied /home and / from the old ssd to the new one (all successfully). But I cannot boot from the new ssd as it comes up with "error: no such device [uuid]. Error: file ‘/boot/vmlinuz-5.15.0-33-generic‘ not found. Error: You need to load the kernel first."

I have tried to tackle the issues one by one, but got nowhere. I then used boot repair, but I kept getting the same error messages.

Next I wanted to move the boot loader.

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.

On rebooting I got the same error message as before (no such device...). And I now I'm really stuck and would appreciate any advice.

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
    I think you have overwritten the system files from 22.04 with 20.04 files. – nobody Jun 19 '22 at 15:01
  • Okay, thanks. Any idea how I fix that? – Florian107 Jun 19 '22 at 15:02
  • Just out of curiosity … why did you copy over your root directory? What benefit did you expect? – Raffa Jun 19 '22 at 15:36
  • I followed the advice in a German speaking Ubuntu forum. I didn't really think about it, just thought it was part of the process. – Florian107 Jun 19 '22 at 17:44
  • Any hints, @Raffa ? – Florian107 Jun 22 '22 at 17:43
  • You mention two SSDs but, I see only one SSD disk while the others appear to be HDDs ... as for the boot issue still showing errors after reinstalling Ubuntu, I suggest you delete the current boot entries labeled Ubuntu in the UEFI/BIOS setup screen then follow boot-repair instructions from a live-USB – Raffa Jun 23 '22 at 06:55
  • I have HDDs on sda and sdb for data storage, yes. I also have 20.04 on sdc, but that does not boot either. Error message: No swap file ... (with which I have never had any issues before), Will check and run boot repair once I'm back home in the afternoon. Thansk so far. – Florian107 Jun 23 '22 at 07:07
  • See this … fix the locked NVram issue … then run boot-repair again if you need to. – Raffa Jun 23 '22 at 18:54

1 Answers1

1

Copying over the root directory / from one Ubuntu system to another is NEVER a good idea ... let alone between different releases ... so now you have two releases mixed together.

Copying over / should have messed up file permissions(among other things) beyond any feasible repair ... and apparently among the other things is you copied your old /etc/fstab file from the other drive (with the old uuid in it) and overwritten the one in the new drive so the uuid is not valid anymore … hence the error you get … but, unfortunately, that error should be the least of your concerns in this situation.

Your Ubuntu system in its current state is unfixable … boot from a live USB, backup your /home directory and any personal data then do a fresh Ubuntu install.

Next time avoid copying system files and directories … all you need to copy is your home directory and personal data.

Raffa
  • 32,237