我决定在我的 Mac Mini 上安装 Ubuntu,并删除 macOS 分区。在我的 Mac Mini 2018 型号 A1993 上安装 Ubuntu 20.04 时,我遇到了一些错误,安装程序无法完成。第一个致命错误是grub-install '/dev/nvme0n1' failed
。然后我运行了 Boot-Repair,它显示Locked NVRAm is detected
。此外,粘贴的 URL 指示Both primary and backup GPT are corrupted. Try making a fresh table and using Parted's rescue to recover partitions
。有人可以指导我正确的方向吗?这是我第一次进行这种类型的安装。
错误 1:
错误 2:
GParted 分区:
启动修复错误:
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> /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.
答案1
在安装 Linux Mint 时我遇到了同样的问题 - 似乎 grub 无法写入 MacMini 中的 NVRAM(不知道这意味着什么,只是重复我读到的内容),因此它需要做一些不同的事情。
然后,你有两个选择:
- 从 MacOS 安装 rEFInd,它可能会找到你未完成的安装并让你从中启动。一个好的指南是https://wiki.t2linux.org/guides/refind/(你还可以在那里找到你可能会偶然发现的其他东西)
- 使用像这样的修补 ISO(来自 t2linux wiki 维护者之一)重新安装操作系统:https://github.com/AdityaGarg8/mbp-ubuntu/releases/tag/v20.04-5.15.11