Score:1

Install Ubuntu 22.04 besides Windows 10 in BOOTCAMP partition on Macbook and triple boot without 3rd party boot manager

cn flag

I have installed Windows 10 besides MacOS Big Sur using bootcamp on a Macbook retina 2015 with PCIe based SSD. wubiuefi failed to install Ubuntu 22.04 within the Windows partition and I wonder if there exists any straightforward and trusted method to shrink the BOOTCAMP partition (Windows) and install Ubuntu, without the need for any 3rd party boot manager, and if this can be riskful for further Ubuntu upgrades.

Here is the output of diskutil list:

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI ⁨EFI⁩                     314.6 MB   disk0s1
   2:                 Apple_APFS ⁨Container disk1⁩         220.0 GB   disk0s2
   3:       Microsoft Basic Data ⁨BOOTCAMP⁩                280.0 GB   disk0s3

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +220.0 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume ⁨MacBook - Data⁩          24.3 GB    disk1s1
   2:                APFS Volume ⁨Preboot⁩                 333.0 MB   disk1s2
   3:                APFS Volume ⁨Recovery⁩                623.2 MB   disk1s3
   4:                APFS Volume ⁨VM⁩                      1.1 GB     disk1s4
   5:                APFS Volume ⁨MacBook⁩                 15.3 GB    disk1s5
   6:              APFS Snapshot ⁨com.apple.os.update-...⁩ 15.3 GB    disk1s5s1
David Anderson avatar
us flag
Your `BOOTCAMP` volume may not have enough free space to shrink more than 2 GB. If you can not sufficiently shrink the `BOOTCAMP` volume, then reinstalling Windows may be necessary in order to install Ubuntu after Windows.
Mohammad Mahdi Amirian avatar
cn flag
The `BOOTCAMP` shrink size limit problem was due to unmovable hibernation and paging files and now is resolved by temporarily disabling hibernation, system restore and virtual memory.
Score:0
us flag

The Boot Camp Assistant will install Windows 10 to UEFI boot on a 2015 MacBook. This means the hybrid method of partitioning used with older Intel Macs is not employed. Therefore, you can boot to Windows and use the Disk Management (an extension of the Microsoft Management Console) to shrink the Windows partition and create free space for a Ubuntu install.

Note: The file I downloaded was named ubuntu-22.04.2-desktop-amd64.iso.

Below are the steps to install Ubuntu. These steps were adapted from the answer posted by guru431.

Note: The last three steps are optional.

The Ubuntu installer always chooses the first EFI partition on the drive regardless of what you choose. This is why step 4 changes the first efi partition to a ordinary FAT32 volume. The installer will then put the Ubuntu boot files in the new EFI partition created in step 6. The first partition is changed back to EFI in step 9, thus undoing step 4. A second EFI partition is added to avoid overwriting a Windows boot file stored in the first EFI partition.

  1. Go into Windows and use Disk Management to shrink its partition. The free space will be used by Ubuntu.

  2. Boot from Ubuntu install flash drive. From the GRUB menu, select Try or Install Ubuntu. If you wait 30 seconds, this will happen automatically.

  3. When the "Install" popup appears, select Try Ubuntu.

  4. Open the Terminal application and enter the following command to change the first partition type from EFI to FAT32.

    sudo sgdisk -t 1:0700 /dev/nvme0n1
    

    When finished, quit the Terminal application.

  5. Open the Install Ubuntu 22.04.2 LTS application and proceed with installing Ubuntu. During the installation, select the following when each appears.

    • Install third-party software for graphics and Wi-Fi hardware and additional media formats
    • Something else
  6. Select the largest amount of free space and create a new partition. Next, click on the + button, then select the following.

    • Size: 315 MB
    • Type for the new partition: Primary
    • Location for the new partition: Beginning of this space
    • Use as: EFI System Partition
  7. Again, select the largest amount of free space and create a new partition. Next, click on the + button, then select the following.

    • Size: Do not change this value.
    • Type for the new partition: Primary
    • Location for the new partition: Beginning of this space
    • Use as: Ext4 journaling file system
    • Mount point: /
  8. Install Ubuntu.

  9. After rebooting, open the Terminal application and enter the following command. This command changes the first partition type from FAT32 to EFI and removes any hybrid partitioning. (Actually, there should be not be any hybrid partitioning to remove. Therefore, most likely the -h EE option does not change anything.)

    sudo sgdisk -t 1:ef00 -h EE /dev/nvme0n1
    
  10. Boot into macOS.

  11. Goto the URL given below, then download and mount mac-icns.

    https://sourceforge.net/projects/mac-icns/
    
  12. Open the Terminal application and enter the following commands to assign an icon and label to Ubuntu:

    sudo diskutil mount disk0s4
    cp /Volumes/mac-icns/OSX10.11.6/os_ubuntu.icns /Volumes/EFI2/.VolumeIcon.icns
    bless --folder /Volumes/EFI2/EFI/BOOT --label "Ubuntu"
    diskutil unmount disk0s4
    

Note: During the installation of Ubuntu, the UUID of the FAT32 volume stored in the second EFI partition is recorded in the /etc/fstab file. This should cause Ubuntu to keep using the second EFI partition even through upgrades and any changes to the Grub configuration.

Mohammad Mahdi Amirian avatar
cn flag
Thank you. Would you give me (as a newbie to EFI) the details of each step? Will bootcamp be responsible for booting into all three OSs at last? BTW, would be installing other linux distributions e.g. Fedora somehow easier than Ubuntu, without the need to these steps?
David Anderson avatar
us flag
Answers with more details have been posted before. For example, see the question [How can I triple boot MacOS Catalina , Ubuntu 18.04, and Windows 10](https://apple.stackexchange.com/questions/375371/how-can-i-triple-boot-macos-catalina-ubuntu-18-04-and-windows-10). Your Mac is a year newer and your macOS is the next released version. However, I believe the steps should be the same, especially since you may need to reinstall Windows. If you find a step that does not work, let me know.
Mohammad Mahdi Amirian avatar
cn flag
Thank you, I had viewed several related posts before, including the above link, but I think my system configuration might be different and needs different instructions as 1) the shrink problem is resolved and no need to reinstall windows, 2) my Macbook 2015 has internal PCIe-based SSD for which the above link has forwarded to a 6-step Ubuntu installation without grub but besides rEFInd: (https://askubuntu.com/questions/1127375/install-ubuntu-18-04-on-mac-mini-2018). I prefer to give all the triple booting role to Apple's boot camp instead of hiring rEFind (if possible)
Mohammad Mahdi Amirian avatar
cn flag
Let me know if I'm doing fine with following steps: 1- Shrink `BOOTCAMP`. 2- Restart with Ubuntu installer USB stick. 3- Choose `Try Ubuntu` instead of `Install Ubuntu`. 4- Launch Ubuntu installer via terminal with the command `ubiquity -b` to ignore GRUB installation. 5- When asked for Installation type, choose `Something else`. 6- Choose the shrink partition and, with type `Primary` (not `Logical`), use it as `Ext4` with mount point `/`. Now I have `/dev/nvme0n1p3 ntfs` followed by the chosen partition `/dev/nvme0n1p4 ext4` 7-Stopped risking here, should I click`Install Now`?
Mohammad Mahdi Amirian avatar
cn flag
I know my scenario is not following your 4-step guidance, because that's too abstract. Please correct mine via hints between the 7-step if the way is totally fine but needs correction, and also guide me with the rest of the steps to make boot camp realize Ubuntu as a third boot partition.
Mohammad Mahdi Amirian avatar
cn flag
Thank you for the detailed instructions. One more choice before installation is displayed: device for boot loader installation. Which one should I choose: /dev/nvme0n1(500GB)APPLE SSD , /dev/nvme0n1p1(314MB)fat32 , or /dev/nvme0n1p4(314MB)efi?
David Anderson avatar
us flag
My experience has been that this setting is ignored. The Ubuntu installer always chooses the first EFI partition on the drive *regardless of what you choose*. This is why step 4 changes the first efi partition to a ordinary FAT32 volume. The installer will then put the Ubuntu boot files in the new EFI partition created in step 6. The first partition is changed back to EFI in step 9, thus undoing step 4.
David Anderson avatar
us flag
You should leave the "device for boot loader installation" as the default, which should be `/dev/nvme0n1(500GB)APPLE SSD`.
Mohammad Mahdi Amirian avatar
cn flag
Great! Boot camp now supports triple boot. Beside your answer that explains WHAT I'm doing, I realized from your last comment WHY I'm doing that, the way you alternate boot partition backup and restore is tricky. I suggest you move that to the body of your answer. Adding a brief description of what boot camp does and how you make it realize Ubuntu would also be perfect to prevent other readers get confused.
Mohammad Mahdi Amirian avatar
cn flag
And please add to the final version of instructions, answer to this question: What should I do for any Ubuntu future upgrade? Should I change the first boot partition type temporarily to fat32 and revert back to efi?
David Anderson avatar
us flag
Any Ubuntu future upgrades should not require changing any partition types. I verified this by installing Ubuntu 20.04.6, then upgrading to Ubuntu 22.04.2 by following [these instructions](https://ubuntu.com/tutorials/upgrading-ubuntu-desktop#1-before-you-start). The EFI partition used by Ubuntu did not change.
David Anderson avatar
us flag
If you feel I answered your question, then you should accept my answer. This will put a green check mark next to my answer. Also, others will see an answer has been found to your question.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.