2

Idecided to install Ubuntu on my Mac Mini, and delete the macOS partition. While installing Ubuntu 20.04 on my Mac Mini 2018 model A1993 I came across some errors and the installer wasn't able to finish. The first fatal error was grub-install '/dev/nvme0n1' failed. Then I ran Boot-Repair and it showed that Locked NVRAm is detected. Also the paste URL was indicating that Both primary and backup GPT are corrupted. Try making a fresh table and using Parted's rescue to recover partitions. Can anyone guide me in the right direction? This is my first time doing this type of install.

Error 1:

Error 1

Error 2:

Error 2

GParted partitions:

GParted partitions

Boot-Repair error:

Boot-Repair error

https://paste.ubuntu.com/p/vm6gZhNyJJ/

============================ Boot Repair Summary ==============================

Error: Both the primary and backup GPT tables are corrupt. Try making a fresh table, and using Parted's rescue feature to recover partitions. cat: /sys/firmware/efi/vars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c/data: Input/output error

Recommended repair: ____________________________________________________________

The default repair of the Boot-Repair utility will purge (in order to fix packages) and reinstall the grub-efi-amd64-signed of nvme0n1p2, using the following options: nvme0n1p1/boot/efi, Additional repair will be performed: unhide-bootmenu-10s use-standard-efi-file

/boot/efi added in nvme0n1p2/fstab Mount nvme0n1p1 on /mnt/boot-sav/nvme0n1p2/boot/efi No nvme0n1p2/boot/efi/efi/ ubuntu/mint folder chroot /mnt/boot-sav/nvme0n1p2 apt-get -y update Purge the GRUB of nvme0n1p2 grub-efi-amd64-signed available The following additional packages will be installed: efibootmgr grub-efi-amd64-bin The following NEW packages will be installed: efibootmgr grub-efi-amd64-bin grub-efi-amd64-signed 0 upgraded, 3 newly installed, 0 to remove and 190 not upgraded. DEBCHECK debOK, grub-efi-amd64-signed DEBCHECK debOK shim-signed available Please type: sudo chroot "/mnt/boot-sav/nvme0n1p2" dpkg --configure -ansudo chroot "/mnt/boot-sav/nvme0n1p2" apt-get install -fynsudo chroot "/mnt/boot-sav/nvme0n1p2" apt-get purge --allow-remove-essential -y grub*-common shim-signed shim-signed available linux-headers-generic available linux-signed-generic NOT available (apt-cache policy problem) Then type: sudo chroot "/mnt/boot-sav/nvme0n1p2" apt-get install -y grub-efi-amd64-signed shim-signed linux-headers-generic

Unhide GRUB boot menu in nvme0n1p2/etc/default/grub

== Reinstall the grub-efi-amd64-signed shim-signed linux-headers-generic of nvme0n1p2 ==

grub-install --version grub-install (GRUB) 2.04-1ubuntu26.13

efibootmgr -v from chroot before grub install show_order(): Input/output error Skipping unreadable variable "Boot0080": Input/output error Skipping unreadable variable "BootFFFF": Input/output error

uname -r 5.11.0-27-generic

grub-install --efi-directory=/boot/efi --target=x86_64-efi --uefi-secure-boot Installing for x86_64-efi platform. grub-install: warning: Cannot read EFI Boot* variables. grub-install: warning: read_file: could not read from file: Input/output error. grub-install: warning: vars_get_variable: read_file(/sys/firmware/efi/vars/Boot0080-8be4df61-93ca-11d2-aa0d-00e098032b8c/raw_var) failed: Input/output error. grub-install: warning: efi_get_variable: ops->get_variable failed: Input/output error. grub-install: error: failed to register the EFI boot entry: Input/output error. Exit code: 1

dosfsck -a /dev/nvme0n1p1 fsck.fat 4.1 (2017-01-24) 0x41: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt. Automatically removing dirty bit. Free cluster summary wrong (123043 vs. really 121706) Auto-correcting. Performing changes. /dev/nvme0n1p1: 25 files, 9078/130784 clusters

grub-install --efi-directory=/boot/efi --target=x86_64-efi --uefi-secure-boot Installing for x86_64-efi platform. grub-install: warning: Cannot read EFI Boot* variables. grub-install: warning: read_file: could not read from file: Input/output error. grub-install: warning: vars_get_variable: read_file(/sys/firmware/efi/vars/Boot0080-8be4df61-93ca-11d2-aa0d-00e098032b8c/raw_var) failed: Input/output error. grub-install: warning: efi_get_variable: ops->get_variable failed: Input/output error. grub-install: error: failed to register the EFI boot entry: Input/output error. Exit code: 1

rm -Rf /dev/nvme0n1p1/ubuntu .. fedora

grub-install --efi-directory=/boot/efi --target=x86_64-efi --uefi-secure-boot Installing for x86_64-efi platform. grub-install: warning: Cannot read EFI Boot* variables. grub-install: warning: read_file: could not read from file: Input/output error. grub-install: warning: vars_get_variable: read_file(/sys/firmware/efi/vars/Boot0080-8be4df61-93ca-11d2-aa0d-00e098032b8c/raw_var) failed: Input/output error. grub-install: warning: efi_get_variable: ops->get_variable failed: Input/output error. grub-install: error: failed to register the EFI boot entry: Input/output error. Exit code: 1

efibootmgr -v from chroot after grub install show_order(): Input/output error Skipping unreadable variable "Boot0080": Input/output error Skipping unreadable variable "BootFFFF": Input/output error Error: NVram is locked (Ubuntu not found in efibootmgr).

chroot /mnt/boot-sav/nvme0n1p2 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.11.0-27-generic Found initrd image: /boot/initrd.img-5.11.0-27-generic grub-probe: error: cannot find a GRUB drive for /dev/sda1. Check your device.map.

Unhide GRUB boot menu in nvme0n1p2/boot/grub/grub.cfg

An error occurred during the repair.

Locked-NVram detected.

============================ Boot Info After Repair ============================

=> No boot loader is installed in the MBR of /dev/nvme0n1.

nvme0n1p1: _____________________________________________________________________

File system:       vfat
Boot sector type:  FAT32
Boot sector info:  According to the info in the boot sector, nvme0n1p1 
                   starts at sector 2048. But according to the info from 
                   fdisk, nvme0n1p1 starts at sector 1. According to the 
                   info in the boot sector, nvme0n1p1 has 131072 
                   sectors.. But according to the info from the partition 
                   table, it has 16414 sectors.
Operating System:  
Boot files:        /efi/BOOT/bkpbootx64.efi /efi/BOOT/bootx64.efi 
                   /efi/BOOT/fbx64.efi /efi/BOOT/grubx64.efi 
                   /efi/BOOT/mmx64.efi /efi/ubuntu/grubx64.efi 
                   /efi/ubuntu/mmx64.efi /efi/ubuntu/shimx64.efi 
                   /efi/ubuntu/grub.cfg

nvme0n1p2: _____________________________________________________________________

File system:       ext4
Boot sector type:  -
Boot sector info: 
Operating System:  Ubuntu 20.04.3 LTS
Boot files:        /boot/grub/grub.cfg /etc/fstab /etc/default/grub

sda: ___________________________________________________________________________

File system:       iso9660
Boot sector type:  Unknown
Boot sector info: 
Mounting failed:   mount: /mnt/BootInfo/FD/sda: /dev/sda already mounted or mount point busy.


================================ 1 OS detected =================================

OS#1: Ubuntu 20.04.3 LTS on nvme0n1p2

============================ Architecture/Host Info ============================

CPU architecture: 64-bit Live-session OS is Ubuntu 64-bit (Ubuntu 20.04.3 LTS, focal, x86_64)

===================================== UEFI =====================================

BIOS is EFI-compatible, and is setup in EFI-mode for this live-session. SecureBoot disabled.

efibootmgr -v No BootOrder is set; firmware will attempt recovery This session has been detected as 'live' because df -Th / contains overlay

============================= Drive/Partition Info =============================

Disks info: ____________________________________________________________________

nvme0n1 : is-GPT, no-BIOSboot, has---ESP, not-usb, not-mmc, has-os, 2048 sectors * 512 bytes

Partitions info (1/3): _________________________________________________________

nvme0n1p1 : no-os, 32, nopakmgr, no-docgrub, nogrub, nogrubinstall, no-grubenv, noupdategrub, not-far nvme0n1p2 : is-os, 64, apt-get, grub-pc , grub2, grub-install, no-grubenv, update-grub, farbios

Partitions info (2/3): _________________________________________________________

nvme0n1p1 : is---ESP, part-has-no-fstab, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot nvme0n1p2 : isnotESP, fstab-has-goodEFI, no-nt, no-winload, no-recov-nor-hid, no-bmgr, notwinboot

Partitions info (3/3): _________________________________________________________

nvme0n1p1 : not-sepboot, no-boot, part-has-no-fstab, not-sep-usr, no---usr, part-has-no-fstab, std-grub.d, nvme0n1 nvme0n1p2 : not-sepboot, with-boot, fstab-without-boot, not-sep-usr, with--usr, fstab-without-usr, std-grub.d, nvme0n1

fdisk -l (filtered): ___________________________________________________________

Disk nvme0n1: 113 GiB, 121332826112 bytes, 29622272 sectors Disk identifier: 3A71B754-BCE5-474C-B9AD-997AFC849E3F Start End Sectors Size Type nvme0n1p1 256 131327 131072 512M EFI System nvme0n1p2 131328 29622050 29490723 112.5G Linux filesystem Disk sda: 14.66 GiB, 15728640000 bytes, 30720000 sectors Disk identifier: 0x2cf4ba3a Boot Start End Sectors Size Id Type sda1 * 0 5999871 5999872 2.9G 0 Empty sda2 5271500 5279499 8000 3.9M ef EFI (FAT-12/16/32) sda3 6000640 30719999 24719360 11.8G 83 Linux

parted -lm (filtered): _________________________________________________________

sda:15.7GB:scsi:512:512:unknown: USB DISK 2.0:; nvme0n1:121GB:nvme:4096:4096:gpt:APPLE SSD AP0128M:; 1:1049kB:538MB:537MB:fat32:EFI System Partition:boot, esp; 2:538MB:121GB:121GB:ext4::;

Free space (filtered): _________________________________________________________

nvme0n1:115712MiB:nvme:4096:4096:gpt:APPLE SSD AP0128M:; 1:0.02MiB:1.00MiB:0.98MiB:free; 1:115711MiB:115712MiB:0.84MiB:free; sda:15000MiB:scsi:512:512:unknown: USB DISK 2.0:;

gdisk (filtered): ______________________________________________________________

MBR: hybrid GPT: present Found valid GPT with hybrid MBR; using GPT. Disk /dev/nvme0n1: 29622272 sectors, 113.0 GiB Disk identifier (GUID): 3A71B754-BCE5-474C-B9AD-997AFC849E3F Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 5 First usable sector is 6, last usable sector is 29622266 Partitions will be aligned on 256-sector boundaries Total free space is 466 sectors (1.8 MiB) Number Start (sector) End (sector) Size Code Name 1 256 131327 512.0 MiB EF00 EFI System Partition 2 131328 29622050 112.5 GiB 8300 MBR: MBR only Warning! Secondary partition table overlaps the last partition by 33 blocks! You will need to delete this partition or resize it in another utility. Disk /dev/sda: 30720000 sectors, 14.6 GiB Disk identifier (GUID): 972F6C9F-26F2-465E-ADD9-849F4A1D2AE2 Partition table holds up to 128 entries Main partition table begins at sector 2 and ends at sector 33 First usable sector is 34, last usable sector is 30719966 Partitions will be aligned on 4-sector boundaries Total free space is 5992606 sectors (2.9 GiB) Number Start (sector) End (sector) Size Code Name 2 5271500 5279499 3.9 MiB EF00 EFI system partition 3 6000640 30719999 11.8 GiB 8300 Linux filesystem

blkid (filtered): ______________________________________________________________

NAME FSTYPE UUID PARTUUID LABEL PARTLABEL sda iso9660 2021-08-19-11-03-38-00 Ubuntu 20.04.3 LTS amd64 ├─sda1 iso9660 2021-08-19-11-03-38-00 2cf4ba3a-01 Ubuntu 20.04.3 LTS amd64 ├─sda2 vfat 54C5-9C6C 2cf4ba3a-02
└─sda3 2cf4ba3a-03
nvme0n1
├─nvme0n1p1 vfat 68E1-6818 a5242004-c6a9-4f41-920c-c19066c9b4d2 EFI System Partition └─nvme0n1p2 ext4 3b5fc5ee-e457-45ac-9714-04ca68b282dd e3fe6fb4-fa99-4b09-9d49-1cbdbbb2749d

df (filtered): _________________________________________________________________

               Avail Use% Mounted on

nvme0n1p1 472.9M 7% /mnt/boot-sav/nvme0n1p1 nvme0n1p2 97G 7% /mnt/boot-sav/nvme0n1p2 sda1 0 100% /cdrom

Mount options: __________________________________________________________________

nvme0n1p1 rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro nvme0n1p2 rw,relatime sda1 ro,noatime,nojoliet,check=s,map=n,blocksize=2048

=================== nvme0n1p1/efi/ubuntu/grub.cfg (filtered) ===================

search.fs_uuid 3b5fc5ee-e457-45ac-9714-04ca68b282dd root set prefix=($root)'/boot/grub' configfile $prefix/grub.cfg

=================== nvme0n1p2/boot/grub/grub.cfg (filtered) ====================

Ubuntu 3b5fc5ee-e457-45ac-9714-04ca68b282dd Ubuntu, with Linux 5.11.0-27-generic 3b5fc5ee-e457-45ac-9714-04ca68b282dd

END /etc/grub.d/30_os-prober

END /etc/grub.d/30_uefi-firmware

======================== nvme0n1p2/etc/fstab (filtered) ========================

<file system> <mount point> <type> <options> <dump> <pass>

/ was on /dev/nvme0n1p2 during installation

UUID=3b5fc5ee-e457-45ac-9714-04ca68b282dd / ext4 errors=remount-ro 0 1

/boot/efi was on /dev/nvme0n1p1 during installation

/swapfile none swap sw 0 0 UUID=68E1-6818 /boot/efi vfat defaults 0 1

==================== nvme0n1p2/etc/default/grub (filtered) =====================

GRUB_DEFAULT=0 GRUB_TIMEOUT_STYLE=menu GRUB_TIMEOUT=10 GRUB_DISTRIBUTOR=lsb_release -i -s 2&gt; /dev/null || echo Debian GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" GRUB_CMDLINE_LINUX=""

================= nvme0n1p2: Location of files loaded by Grub ==================

       GiB - GB             File                                 Fragment(s)

0.007831573 = 0.008409088 boot/grub/grub.cfg 1 4.828136444 = 5.184172032 boot/vmlinuz 2 4.828136444 = 5.184172032 boot/vmlinuz-5.11.0-27-generic 2 50.703136444 = 54.442078208 boot/initrd.img 3 50.703136444 = 54.442078208 boot/initrd.img-5.11.0-27-generic 3 50.703136444 = 54.442078208 boot/initrd.img.old 3

=================== nvme0n1p2: ls -l /etc/grub.d/ (filtered) ===================

-rwxr-xr-x 1 root root 18151 Aug 12 09:18 10_linux -rwxr-xr-x 1 root root 42359 Aug 12 09:18 10_linux_zfs -rwxr-xr-x 1 root root 12894 Aug 12 09:18 20_linux_xen -rwxr-xr-x 1 root root 12059 Aug 12 09:18 30_os-prober -rwxr-xr-x 1 root root 1424 Aug 12 09:18 30_uefi-firmware -rwxr-xr-x 1 root root 214 Aug 12 09:18 40_custom -rwxr-xr-x 1 root root 216 Aug 12 09:18 41_custom

=============================== StdErr Messages ================================

File descriptor 63 (pipe:[70841]) leaked on lvs invocation. Parent PID 6561: /bin/bash Error: Both the primary and backup GPT tables are corrupt. Try making a fresh table, and using Parted's rescue feature to recover partitions. =============================== StdErr Messages ================================

File descriptor 63 (pipe:[70841]) leaked on lvs invocation. Parent PID 6561: /bin/bash Error: Both the primary and backup GPT tables are corrupt. Try making a fresh table, and using Parted's rescue feature to recover partitions.

karel
  • 114,770
euffi
  • 31
  • If you ran boot-repair, you must have already had some problem you were trying to fix. Can you edit your question and include more details and context about the problems you are experiencing? – Nmath Dec 19 '21 at 04:52
  • Boot-Repair would not corrupt partition tables. It primarily runs grub updates or grub installs and other standard commands to document system. As it suggests you may need parted rescue to try to recovery partitions. Do you have partition table backup or other documentation on what partitions you have? Parted rescue seems easier than testdisk https://askubuntu.com/questions/665445/upgraded-to-windows-10-on-dual-boot-and-cant-boot-to-ubuntu-partition Used parted rescue https://ubuntuforums.org/showthread.php?t=2362656 & https://www.gnu.org/software/parted/manual/parted.html#rescue – oldfred Dec 19 '21 at 15:21
  • @Nmath I edited my questions and included more info and pictures of the errors. – euffi Dec 19 '21 at 15:48
  • Doesn't make sense IMO to run boot-repair when all you're trying to fix is an installation that was not successful to begin with. First I would make sure that your motherboard BIOS is up-to-date. Refer to the documentation and support for your motherboard to do that. Then, before installing - you should format your hard drive as GPT. You can do this using "Disks" in the live session (Try Ubuntu when booting from installation media). Formatting will create a new partition table. Then you should be able to install Ubuntu. Let us know if this works for you – Nmath Dec 19 '21 at 20:56

1 Answers1

2

I've stumbled upon the same issues while installing Linux Mint - it seems grub can't write to NVRAM in the MacMini (no clue what that means, just repeating what I read), and thus it needs to do stuff a bit differently.

Then, you have two options: