Dual boot MacOS and Ubuntu

Step-by-step instructions on how to install macOS and Ubuntu on a Mac computer.
There are four parts:

  1. Prepare Your Stuff
  2. The Mac Side
  3. Install Ubuntu Mate
  4. Post Installation

01: Prepare Your Stuff

Requirements

  1. A 4GB or larger USB flash drive to create a bootable image
  2. (Optional but recommended) Another 4+GB USB drive or external HD to store the files that you will download later
  3. At least 40GB free on the Mac HD

Downloading Files
Download the following files from labdoo@ftp.labdoo.org:/macOS-ubuntu:

  • refind-bin-0.12.0
  • ubuntu-mate-20.04-desktop-amd64.iso
  • unetbootin-mac-681.dmg

It is strongly recommended that you install and use a download manager software (e.g. FileZilla) to download the files since the iso file is huge, and the download manager can resume the download just in case you lost the connection. Save the files to a USB drive or external HD. Below is a screenshot using FileZilla:

ftp.labdoo.org

Create Bootable USB
Do the following on a working Mac. Otherwise, complete “The Mac Side” section and come back here.

  1. Insert a blank USB
  2. Double click on the file unetbootin-mac-681.dmg that you downloaded earlier
  3. unetbootin

  4. Right-click and select Open
    unetbootin2
  5. Click the Open button
    unetbootin3
  6. Enter the password if prompted. The UnetBootin application will open. Select “Disk Image” option and the Ubuntu ISO file you downloaded earlier
    unetbootin4
  7. Click OK. UnetBootin will extract and copy a bunch of files to the USB drive.
  8. When it’s done, eject the USB drive by clicking on the Eject icon:
    unetbootin5

The USB drive now can be used to boot any Mac.

02: The Mac Side

If MacOS is missing
You will need to have Wifi and internet access to reinstall macOS.

  1. Booting the laptop.
  2. If it prompts you to install a new OS, simply connect to your WiFi and follow the screen
  3. Otherwise, reboot the laptop, holding both the Command and R keys until you see the Apple logo. Then select “Reinstall macOS” from the menu

If MacOS is present
If you know the password of the admin user, congratulations!. Otherwise, follow these steps to reset the password:

  1. Reboot the laptop, hold the Command + R keys until the Apple logo appears.
  2. Select Utilities -> Terminal to launch a terminal.
  3. Type resetpassword (yes, one word) at the terminal. Follow the screen to reset the password for each existing account.
  4. Restart and log in using the new password

“Labdooing” the Mac
Create Labdoo Accounts
You will use the existing admin account to create two new accounts: “student” and “labdoo” and then remove all non-labdoo accounts.

  1. Log in as the current admin account
  2. Select “System Preferences” -> “Users & Groups”
  3. Click the lock icon to unlock. Type password when prompted
  4. Click ‘+’ to add a new account. A new account form will pop up
  5. Create “labdoo” account - fill in the form with the following values:
    1. New Account: Administrator
    2. Full Name: labdoo
    3. Account Name: labdoo
    4. Password: labdooadmin
    5. Verify: repeat the password
    6. Password hint: can leave blank
  6. Create “student” account - fill in the form with the following values:
    1. New Account: Standard
    2. Full Name: student
    3. Account Name: student
    4. Password: labdoo
    5. Verify: repeat the password
    6. Password hint: can leave blank

Delete Non-labdoo Accounts

  1. Log in as “labdoo”
  2. Select “System Preferences” -> “Users & Groups”
  3. Click the lock icon to unlock. Type password when prompted
  4. Select a non-labdoo account, click the ‘-’ to remove the account
  5. Select “delete user directory” option. Confirm deletion when prompted
  6. Repeat step 4 and 5 for all remaining non-labdoo accounts

Change the Computer Name:
We will change the computer name to the labdoo Tag ID:

  1. Generate a tag ID for this computer if it doesn’t have one yet
  2. Click “System Preference” -> “Sharing”
  3. Change the computer name to labdoo-000xxxxxx, where xxxxxx is the tag ID.

Create a Partition for Ubuntu

  1. Run Disk Utility: Select Go -> Utilities -> Disk Utility
    utilities
  2. Disk Utility screen
    disk utilities
  3. Click “Partition”. A dialog box will pop up. Click Partition again
    partition
  4. Click the ‘+’ sign. A new partition will be added. We now have 2 partitions, each occupies 50% of the disk space. Name the new partition “UBUNTU” and set its format to MS-DOS(FAT).
    new partition
  5. Click Apply
    partition
  6. Click Partition
    partition4
  7. Click Continue. The process may take a while.

We are now ready to install Ubuntu on the new partition. But there is one task left: to install a boot manager.

Install rEFInd Boot Manager
Disable SIP (System Integrity Protection)
SIP protects critical areas on the disk from being altered, and rEFInd needs to write to one of those areas. Thus, we need to disable SIP before installing rEFInd

  1. Check to see if SIP is enabled or disabled. Open a Terminal and type “csrutil status”
    csrutil
  2. If it says “enabled” like in the capture above, follow the steps below to disable it

  3. Reboot and hold the Command + R key until you see the Apple logo. It will boot into Recovery mode.
  4. Select “Utilities” -> “Terminal”
  5. At the terminal, type csrutil disable
  6. Reboot and log back in as labdoo

Installing rEFInd

  1. Open a Terminal
  2. Open the folder where you downloaded the files earlier
  3. Arrange the Terminal window and the folder window so you can see both at the same time:
    refind install
  4. Drag and drop the “refind-install” file into the Terminal folder
  5. In the Terminal window, hit Enter or Return key to execute the command. Enter the password when prompted
    refind install command

We are now ready to install Ubuntu.

03: Install Ubuntu Mate

  1. Insert the bootable USB drive that you created earlier
  2. Reboot. The rEFInd boot menu will show
  3. Select EFI\BOOT\grubx64.rfi from {your USB drive name} and hit Enter
  4. Select “Try Ubuntu MATE without installing”
  5. After a few minutes or so, you should see the Ubuntu desktop
  6. Click on Install Ubuntu MATE 20.04LTS
  7. Follow the screens to complete the installation. IMPORTANT:
    1. Under the “Updates and other software” screen, make sure you select “Install third-party software for graphics and WiFi hardware and additional media formats”. Click Continue. Then connect to your WiFi network when prompted.
      ubuntu install
    2. Under the “Installation Type” select “Something else” option
      ubuntu install
    3. Select the partition with format fat32 which we created earlier using Disk Utility
      ubuntu install
    4. Double-click the highlighted entry. A dialog box will pop up. Select:
      Ext4 journaling file system
      Check “Format the partition”
      Mount point: /
      ubuntu install
  8. Click OK
    ubuntu install
  9. Click “Install Now” and follow the screens to complete the installation. At the “Who are you” screen, create the labdoo account and use the tagID for the hostname:
    ubuntu install
  10. When the installation completes, click restart to reboot the system. Hold the Option key while the system reboots until you see the original boot menu

    IMPORTANT NOTE:
    The installation of Ubuntu overwrites the EFI boot area that we created earlier in the “Installing rEFInd” section. But without the EFI boot area, the Ubuntu installation would fail for some reason that I haven’t figured out. Thus, we’ll have to install rEFInd again.

  11. Select booting from macOS partition and hit Enter key
  12. Repeat the steps in the Installing rEFInd section again

04: Post Installation

Enable SIP

  1. Reboot into recovery mode: hold Command + R key while rebooting until the Apple logo appears
  2. Select Utilities->Terminal to open a terminal
  3. Type “csrutil enable” and hit Enter key
  4. Reboot