在Mac上的Ubuntu:执行'grub-install / dev / nvme0n1'失败

场效应管

我知道这是一个非常普遍的问题,但是如果我在这里,这意味着我已经搜索并尝试了许多道路:未成功。我正在尝试在分区(也不是VM也不是Bootcamp)上运行MacOS BigSur的MacBookPro 13“ 2019上安装Ubuntu。

我如何准备Ubuntu live USB

  1. 我目前已下载Ubuntu的最新稳定版本:Ubuntu 20.04.2.0 LTS

  2. 然后,我插入了一个4GB的USB,并使用Disk Utility将其格式化为MS-DOS(FAT)。

  3. 终于安装了Etcher并将ISO映像刻录到了我的USB中。

  4. 重新启动我的Mac保持选项键,然后启动到我的USB(EFI启动)中。

我如何安装Ubuntu

  1. 在第一个菜单中,我选择“尝试Ubuntu”
  2. 一旦在桌面,触摸板或键盘上都无法使用,那么我插入了外部鼠标并启用了屏幕键盘来完成安装
  • 打开“活动”概述,然后开始输入“设置”。

  • 单击设置。

  • 单击侧栏中的“辅助功能”以打开面板。

  • 在“键入”部分中打开“屏幕键盘”。

  1. 我单击了桌面上的Ubuntu安装程序图标

  2. 所选语言

  3. 选择“正常安装”并选中“安装第三方软件”

  4. 当询问用于将Ubuntu安装到的分区时,选择其他选项/其他

  5. 然后,我从可用空间中创建了2个分区

    • 之一512MB,“ EFI ”(从下拉菜单)
    • 之一30GBEXT4(从下拉菜单中),安装到/(从其他下拉菜单)
  6. 然后,我确保将用于安装引导加载程序的磁盘设置为磁盘,而不是我创建的特定EFI分区(即/ dev / nvme0n1而不是/ dev / nvme0n1p3)

  7. 单击立即安装

  8. 在grub2步骤安装失败

笔记

  • 我已经尝试取消选中“安装第三方软件”
  • 我已经尝试选择“最小安装”而不是“正常”
  • WiFi也不起作用,所以我后来尝试了以太网电缆,现在可以使用网络连接了
  • 我完全擦除了磁盘并重新安装了MacOS(我当然有文件的备份)

安装过程视频

观看视频。

最新错误消息的屏幕截图

错误讯息 新警告消息

知识459

I was having exactly the same problem whilst installing Ubuntu 20.04.2.0 LTS on a 2020 MacBook Pro with a 2 GHz Quad-Core Intel Core i5 processor using macOS Big Sur Version 11.1. After spending two days trying to get it to work I finally found a solution. Be warned it is a long process.

From my research I found that the issue is due to the Mac bootloader expecting the EFI partition to be formatted as HFS+ where the Ubuntu installer formats it as VFAT (as stated by Rohith Madhavan here).

To get around this issue I found three possible solutions:

  1. Use Rohith Madhavan's method.
  2. Swap your bootloader from GRUB to rEFInd.
  3. Install Ubuntu on an external SSD using Floris van Breugel's method.

Option one was posted seven years ago and required adding an unsigned repository to my Ubuntu installation (which I wasn't willing to do for security reasons). I didn't understand the full implications of swapping from GRUB to rEFInd so I wasn't comfortable using option two and finally, I didn't want slow memory access by using an external SSD so I didn't want to go with option three.

My final solution was to use parts of options one and three to make my own GRUB config file formatted in HFS+ so that I could boot Ubuntu from a partition on my internal SSD.

Backup

Whilst the process shouldn't cause you any issues, if a mistake occurs it could wipe your drive. As a result, it is always safest to back everything up before progressing.

Installing Ubuntu

  1. Open up Disk Utility on your Mac.
  2. Select your Apple SSD drive (make sure to select the parent drive not the container).
  3. Select "Partition".
  4. Hit the plus button and create a new partition called Ubuntu Boot Loader with format Mac OS Extended (Journaled) and size 128MB. This will serve as the location for your Ubuntu bootloader later on.
  5. Hit the plus button again and create another new partition called Ubuntu with format MS-DOS (FAT) and allocate it the memory size you want your Ubuntu installation to have (I would recommend no smaller than 50GB).
  6. Download Ubuntu from here.
  7. Plug in a USB and go to Disk Utility. From here locate the USB, hit Erase, select the format MS-DOS (FAT) and choose the scheme GUID Partition Map then hit Erase.
  8. Use Etcher to flash this ISO file onto a USB. Be warned this will wipe the entire USB (see this for more details).
  9. Restart your computer hitting Cmd+R on reboot. This will put you into recovery mode.
  10. Sign into your account, go into the menu location Utilities, select the first thing in the drop down menu and change the settings to No Security and Allow booting from external drive.
  11. Turn off your computer.
  12. Plug in your bootable USB drive and turn on your computer whilst holding down the Option key.
  13. Select the EFI boot drive (should be yellow). It might show you a warning saying Update Required. Hit the Update option. This will restart your computer. Make sure you are holding Option when it turns back on. Then click on EFI boot again.
  14. Follow steps one to five from here.
  15. On the Installation Type page select Something Else.
  16. Locate the MS-DOS (FAT) partition you made and hit minus.
  17. Select Free Space and hit plus.
  18. Create your Linux memory space by choosing how many GBs you want, choose Ext4 Journaling File System, check Format the partition and have the mounting point as /.
  19. Select Free Space and hit plus.
  20. Create your Linux swap space, use the remaining memory and choose swap as the format.
  21. Under Device for boot loader installation select the partition where your ext4 formatted memory is.
  22. Hit Install Now.
  23. Continue the installation process. You will again see the grub-install /dev/nvme**** failed warning but don't worry. Just hit restart. You will be asked to remove the USB and then hit Enter.

You will now have Ubuntu installed on your computer, but your GRUB bootloader won't be able to open it without some help.

Getting into Ubuntu

  1. Restart your computer and hit the Option key when booting.
  2. Select the EFI boot drive (this is your Ubuntu installation).
  3. You should be displayed with a GRUB terminal.
  4. Follow these steps that Rohith Madhavan outlines:

At the grub console, type ls

grub> ls

(memdisk) (hd0) (hd0,msdos) (hd1) (hd2) (hd2,gpt3) (hd2,gpt2) (hd2,gpt1)

You may not get exactly the same results as this, but you’ll have some similar options.

Now, find the partition which contains your user's home directory.

grub> ls (hd2,gpt2)/home

rohith/

Keep trying until you find it.

The result from the last step has two parts: (hdX,gptY). You need to keep the hdX part, but go through all the gptY options looking for a /boot/grub directory.

grub> ls (hd2,gpt2)/boot/grub

unicode.pf2 [...] grub.cfg

Now you want to set this as your root for further commands.

grub> set root=(hd2,gpt2)

The only way to boot properly was to use the UUID of the drive. To get it -

grub> ls -l (hd2,gpt2)

Note down the UUID. You'll have to type it manually in the next step.

grub> linux /boot/vmlinuz .efi.signed root=UUID=〈the UUID from above〉

The GRUB console can do tab completion, so if you just type out the vmlinuz part and hit tab, then hit . and tab again, you won't have to type the whole file name. make sure that the efi.signed part is present.

Now, set the initial RAM disk

grub> initrd /boot/initrd〈...tab here!...〉

You should be able to boot with the command

grub> boot

You will now be in your Ubuntu installation as if everything was installed correctly. But every time you restart you have to repeat this process. To work around this you can do the following.

Permanently Fixing the GRUB Issue

Here you want do reformat the VFAT boot loader that the Ubuntu installation made by default to HFS+. This can be done by making your own boot loader config using GRUB. The method I used was the same as what Floris van Breugel did (but on my internal SSD instead of an external SSD).

  1. Following the instructions starting from the heading Making Ubuntu bootable part 1 from this all the way to the end of Turn SIP back on (for security). The only changes are the disk your should reference is your internal Ubuntu Boot Loader partition (you do not need an external drive with this partition.
  2. Restart your computer holding down the Option key during boot-up. You will now have two EFI boot drives. Go into the far left one. It should say you need to install an update for this to work. Click Update.
  3. 在重新引导过程中,Option再次按住该键,然后选择中间的EFI引导驱动器。这将使您再次进入GRUB屏幕。等待一两分钟,然后它应该带您到Ubuntu加载屏幕。

你都做完了。您现在应该能够立即启动Ubuntu和MacOS。

希望这对您有用。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

pip install在mac上产生以下错误:错误:命令'gcc'失败,退出状态为1

GRUB安装在/ dev / sda1上,映像还原后“没有这样的分区”

grub-install --no-floppy / dev / sda失败(Funtoo)

grub-install失败,以及一般的grub2失败

从12.04升级到14.04后,grub-install失败(grub-pc损坏)

Qt 5.4.0在libGL.so.1上安装失败,但是已经安装了libgl-dev和ibglu-dev

继续遇到“ grub-install”失败。在安装Mint的同时

安装失败-'无法在/ dev / sda中安装GRUB'问题

无法在/ dev / nvme中安装GRUB

命令“ sudo apt-get install python-dev,python3-dev”失败,并在执行过程中以100退出

在ubuntu 14.0.4上php7.0-dev安装失败

Grub致命错误-无法在dev / sda上安装

在Grub上安装失败(只读EFI分区?)

Windows之后安装Ubuntu时,“ grub-install / dev / sdb失败”

文件系统显示/ dev / nvme0n1p1而不是/ dev / sda

尝试修复Grub失败

grub 安装失败

挂载:/new_root:fs 类型错误,/dev/nvme0n1p4 上的超级块损坏,缺少代码页或帮助程序,或其他错误

无法在 /dev/sda Ubuntu 18.10 中安装 grub

pip install pycurl 在 Ubuntu 18.04 上失败

/dev/nvme0n1p5 消息;Ubuntu 无法启动

Ubuntu 安装程序因 grub-install /dev/sda failed 致命错误而崩溃

Ubuntu 20.04 在启动期间卡在“/dev/nvme0n1p5 clean.xxx/xxx files.xxx/xxx blocks”

如何使用 SSD(设备:/dev/nvme0n1)安装所有库而不是 /home?

grub-install 在 ubuntu 20.04.1 上失败

GRUB 找不到运行 grub-install /dev/sda 的 Ubuntu

Ubuntu 20.04 停留在“/dev/nvme0n1p6 clean. xxx/xxx 文件。xxx/xxx 块”在启动期间

Ubuntu 21.04 在安装过程中因 grub-install /dev/sda failed 致命错误而崩溃

pip install py-find-1st 在使用 python3.9 的 ubuntu 20 上失败