Creating a Multiboot USB Stick under macOS

This is an old post!

This post is over 2 years old. Solutions referenced in this article may no longer be valid. Please consider this when utilizing any information referenced here.

Here’s a quick article about how to make a multiboot USB stick under macOS. These are useful in a lot of situations - such as for doing system installs or system rescues - because you can boot a wide variety of live OSs from a single stick.

There are a lot of guides out there for doing this on Linux, and a lot of software for automating it on Windows, but not a lot of guides for doing it on macOS. Fortunately, it is pretty straightforward as the instructions will be broadly similar to doing it on Linux.

Prerequisites

This guide assumes you have Homebrew installed. If you don’t, you will need to install it. If you are using MacPorts or another package manager, the initial instructions might be slightly different.

You will also, obviously, need a USB stick.

Creating the Stick

First, we will need the grub package:

$ brew tap nativeos/i386-elf-toolchain
$ brew install i386-elf-grub

Next, we need to identify what node your USB stick came up as:

$ diskutil list

In my case, this came up as disk6. Be very careful here. If you are not paying attention you might accidentally wipe your system drive.

$ brew install i386-elf-grub
$ USBDEV=disk6  # this will be whatever your USB stick came up a$
$ sudo diskutil unmountDisk $USBDEV
$ sudo diskutil eraseDisk FAT32 MULTIBOOT MBR $USBDEV
$ sudo diskutil mountDisk $USBDEV
$ sudo /usr/local/opt/i386-elf-grub/sbin/grub-install --force --no-floppy --boot-directory=/Volumes/MULTIBOOT/boot /dev/r$USBDEV
$ cd /Volumes/MULTIBOOT/boot/grub

So what we did here was wipe the USB stick and create a new FAT32 partition with a Master Boot Record partition table and we installed Grub on it. So now it should be fully capable of being booted, though there’s nothing to boot yet.

Next, download a Linux ISO or some other things you might like to boot. Some useful ones to download might be:

Any image you download, put in the root of the USB drive.

Next, in /Volumes/MULTIBOOT/boot/grub, create a file called grub.cfg. Here’s an example based on the links above:

set timeout=60
set default=0

menuentry "Ubuntu 20.04.3 (AMD64) Desktop Live Boot" {
    set gfxpayload=keep
    set iso_path="/ubuntu-20.04.3-desktop-amd64.iso"
    loopback loop ${iso_path}

    linux   (loop)/casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper iso-scan/filename=${iso_path} noeject noprompt splash --
    initrd  (loop)/casper/initrd
}

menuentry "Ubuntu 20.04.3 (AMD64) Server Install" {
    set gfxpayload=keep
    set iso_path="/ubuntu-20.04.3-live-server-amd64.iso"
    loopback loop ${iso_path}

    linux   (loop)/casper/vmlinuz file=/cdrom/preseed/ubuntu.seed boot=casper iso-scan/filename=${iso_path} noeject noprompt splash --
    initrd  (loop)/casper/initrd
}

menuentry "DBAN 2.3.0 (i586)" {
    set iso_path="/dban-2.3.0_i586.iso"
    loopback loop ${iso_path}

    linux   (loop)/DBAN.BZI nuke="dwipe" iso-scan/filename=${iso_path} silent --
}

menuentry "memtest86+ 5.31b" {
    linux16 /memtest86+-5.31b.bin
}

So for each ISO you add to the stick, add a menu item to the list so that you can boot it. You may have to fiddle with the config a bit to get it right, but the instructions should be generically similar for most.

That’s it! If everything went correctly, you now have a bootable USB stick that can do multiple things. One thing I noticed is that it does take several seconds, depending on the speed of the USB stick and the speed of the target machine, for the actual Kernel startup to happen. On an older machine I was installing this on, after hitting enter on the Ubuntu image, it just sat there for about 20 seconds with a flashing cursor before the init happened. So you might need to just give it some time.

Attributions

Most of these instructions came from these two links:

The rest was trial and error. For instance the grub.cfg file from Pendrive is incorrect and will not boot Ubuntu.

About the Author

Hi, I'm Rob! I'm a blogger and software developer. I wrote petfeedd, dystill, and various other projects and libraries. I'm into electronics, general hackery, and model trains and airplanes. I am based in Huntsville, Alabama, USA.

About Me · Contact Me · Don't Hire Isaiah Armstrong

Did this article help you out?

I don't earn any money from this site.

I run no ads, sell no products and participate in no affiliate programs. I do not accept gifts in exchange for articles, guest articles or link exchanges. I don't track you or sell your data. The only third-party Javascript on this website is Google Analytics.

In general I run this site very much like a 1990s homepage or early 2000s personal blog, meaning that I do this solely because it's fun! I enjoy writing and sharing what I learn.

If you found this article helpful and want to show your appreciation, a tip or donation would be very welcome. Feel free to choose from the options below.

Comments (0)

Interested in why you can't leave comments on my blog? Read the article about why comments are uniquely terrible and need to die. If you are still interested in commenting on this article, feel free to reach out to me directly and/or share it on social media.

Contact Me
Share It

Interested in reading more?

Home Assistant

Hacking a Z-Wave Door Sensor Into a Mailbox Sensor for Home Assistant

My mailbox - yes, my physical mailbox where I receive actual mail - is one of the things that has stubbornly resisted my attempts to automate it. I’ve tried a few different solutions. Third party proprietary chimes. A Z-Wave tilt sensor on the door. But nothing has worked long-term.
Read More
Hardware

Remotely Controlling a DeLonghi Oil Radiator using Home Assistant, ESPHome and ESP32

So here we are in October. COVID-19 is still with us and I am still working from home. Meanwhile, summer has quickly changed to autumn. The leaves are falling as are the temperatures. My house was the model home for our neighborhood, and what would have been the garage was finished in and used as a sales office. So when we bought the house, I was like, perfect, a perfect spot for an office! But the problem is that, because it was a garage, it’s not connected to the house’s HVAC system. In the summer there is a mini-split that keeps the whole area cool. But it’s kind of loud. However, I do have some of these DeLonghi Oil Radiators to use in the winter which provide abundant, silent heat without using very much power. But the downside is that they take awhile to warm up. Wouldn’t it be cool if I could have them turn on an hour early and “pre-warm” the office? Well, to get the obvious part out of the way, yes, there is timer functionality, but that is not nearly as cool as tying it into the rest of my smart home. But it has a remote. What if I could find a way to use Home Assistant to send IR commands to the heater? Turns out you can!
Read More
Raspberry Pi

Using the DS3231 RTC (Real Time Clock) with Raspberry Pi

In my last post about building the pet feeders, I alluded to one of the limitations of the Raspberry Pi has: it lacks a real time clock. This is an understandable omission. They take up extra space and cost, are not needed for a lot of applications and can be pretty easily added if they are. One of the limitations I found is that, if there is a power outage that lasts a significant amount of time - long enough for the UPS batteries that keep the wireless up go dead, for instance - that the Raspberry Pi’s may “lose” track of time if they can’t reconnect to wifi and, thus, sync up by NTP.
Read More