How do you create a live persistent Ubuntu USB on a Mac that will boot to a Mac or PC?

24,364

Solution 1

Cloning and maybe a second step

You can use a one-step or two step procedure. dd is a powerful but also dangerous tool, that is 'always' available in a MacOS. Be very careful, check and double-check, that everything is correct, before you start the cloning process.

  • One step: If you find a [compressed] image file of an Ubuntu [based] system, that is persistent live, and can do what you want, clone it to a USB pendrive or a memory card. If the downloaded file is compressed, you need to extract it before cloning, for example

    file.img.zip --> file.img

    file.img.xz --> file.img

    Unmount all partitions on the target drive and run dd

    sudo dd bs=1m if=path_of_your_image.img of=/dev/rdiskn
    

    where n is a number (for example, /dev/rdisk4).

    There are tips in this link.

  • Two steps: Download and clone a [compressed] image file of an Ubuntu [based] system, that is persistent live, and contains mkusb.

    Boot from from the USB pendrive or memory card which was made bootable by cloning.

    Download an iso file of the Ubuntu version and flavour, that you want to install as persistent live.

    Run mkusb-dus and create a persistent live drive in another USB drive or memory card.

  • Links

    Installing operating system images on Mac OS (www.raspberrypi.org)

    help.ubuntu.com/community/mkusb

    help.ubuntu.com/community/mkusb/persistent

    Compressed image file with a persistent live system and mkusb

Solution 2

You should be able to accomplish this using diskutil. I last used this method on Sierra, so ymmv on anything later.

$ diskutil list
$ diskutil eraseDisk FAT32 UBUNTU /dev/<YOUR USB DISK ID>
$ diskutil unmountDisk /dev/<YOUR USB DISK ID>
$ sudo dd if=<path to ubuntu live iso> of=/dev/<YOUR USB DISK ID>

Once that completes you need to restart and boot from the live usb.

Once it boots start gparted from the terminal.

Select the USB drive and select the Unallocated partition on it.

Create a new partition, label it ext3/ext4(unsure if other filesystems will work. never tried.) with the label persistence

Exit gparted

Create a mountpoint for your new persistence partition.

$ mkdir -p /mnt/ubuntu_usb $ mount <USB DRIVE> /mnt/ubuntu_usb

TO enable the persistent storage you need a persistence.conf.

$ echo "/ union" > /mnt/ubuntu_usb/persistence.conf
$ umount <DISK>

Restart the mac and hold down the Option key. You should hopefully have an option for Ubuntu (persistence) to boot from now

Share:
24,364

Related videos on Youtube

Jeremy Gleeson
Author by

Jeremy Gleeson

Updated on September 18, 2022

Comments

  • Jeremy Gleeson
    Jeremy Gleeson over 1 year

    Hello I have actually successfully created a live Ubuntu USB (12.04.3 64-bit on 8GB LiveUSB) using unetbootin, however it is not persistent and will not boot on a Mac.

    Or, if anyone has any suggestions on how to edit the .iso file so it boots from a Mac and is persistent, that would be great too. I am running OSX Mavericks so the application would have to run on Mavericks too.

    I tried following http://ubuntuforums.org/showthread.php?t=2174630 ans, as suggested below, chose GUID partition (not MBR) and then add persistent word in grub.cfg file. and after I booted and changed a few settings, I tried to reboot using the restart option in the ubuntu menu, and it didn't work. I manually powered my computer off and on, but when I tried to boot the second time, I got past the Ubuntu logo and then my screen went black. I tried this some more times and got the same result. here is my text from the grub.cfg file:

    if loadfont /boot/grub/font.pf2 ; 
    then set gfxmode=auto insmod efi_gop insmod efi_uga insmod gfxterm terminal_output gfxterm 
    fi 
    
    set menu_color_normal=white/black   
    set menu_color_highlight=black/light-gray 
    
    menuentry "Try Ubuntu without installing" 
    { set gfxpayload=keep linux /casper/vmlinuz.efi persistent file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash -- 
    initrd  /casper/initrd.lz } 
    
    menuentry "Install Ubuntu" 
    { set gfxpayload=keep linux /casper/vmlinuz.efi file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash -- 
    initrd  /casper/initrd.lz }
    
    
    menuentry "Check disc for defects" 
    { set gfxpayload=keep linux /casper/vmlinuz.efi boot=casper integrity-check quiet splash -- 
    initrd  /casper/initrd.lz }
    
    • Jo-Erlend Schinstad
      Jo-Erlend Schinstad over 10 years
      Which version of Ubuntu and what kind of Mac? Are you using 32bit or 64bit image? More details please.
    • Jeremy Gleeson
      Jeremy Gleeson over 10 years
      It is version 12.04.3, and I am using a 64 bit image. I have an 8gb usb drive
    • user2347638
      user2347638 over 5 years
      I'm in a similar boat. Was able to get the boot running but it wasn't persistent and adding "persistent" to my grub.cfg file seemed to make the boot hang at the black screen right after the Ubuntu logo. Were you able to find a fix @JeremyGleeson?
  • Jeremy Gleeson
    Jeremy Gleeson over 10 years
    I tried this and after I booted and changed a few settings, I tried to reboot using the restart option in the ubuntu menu, and it didn't work. I manually powered my computer off and on, but when I tried to boot the second time, I got past the Ubuntu logo and then my screen went black. I tried this some more times and got the same result. here is my text from the grub.cfg file:
  • Jeremy Gleeson
    Jeremy Gleeson over 10 years
    if loadfont /boot/grub/font.pf2 ; then set gfxmode=auto insmod efi_gop insmod efi_uga insmod gfxterm terminal_output gfxterm fi set menu_color_normal=white/black set menu_color_highlight=black/light-gray menuentry "Try Ubuntu without installing" { set gfxpayload=keep linux /casper/vmlinuz.efi persistent file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash -- initrd /casper/initrd.lz } menuentry "Install Ubuntu" { set gfxpayload=keep linux /casper/vmlinuz.efi file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity quiet splash -- initrd /casper/initrd.lz }
  • Jeremy Gleeson
    Jeremy Gleeson over 10 years
    menuentry "Check disc for defects" { set gfxpayload=keep linux /casper/vmlinuz.efi boot=casper integrity-check quiet splash -- initrd /casper/initrd.lz }
  • Jeremy Gleeson
    Jeremy Gleeson over 10 years
    also if you know of a way to make grub so that it automatically boots to the "try ubuntu without installing", that would be appreciated also
  • Derwent
    Derwent about 6 years
    Was anyone able to get this working on mac? I followed these steps but the usb created with mkusb-dus doesn't boot, despite the same image booting when written using another method. :(
  • sudodus
    sudodus about 6 years
    @Derwent, Please describe the method you used with as many details as possible. Which operating system was used in each step. Which tool was used and how was is used in each step? Which operating system and which version did you try to install (which iso file or img file did you use)? Did you try to clone or to create a persistent live system?
  • Derwent
    Derwent about 6 years
    Hey @sudodus I installed mkusb-dus on a Debian Stretch Livedisk, and used that to create a persistence on another USB using the same live image. I used the gnome image here: cdimage.debian.org/debian-cd/current-live/amd64/bt-hybrid Unfortunately it didn't show up as bootable on my Macbook Pro Retina 11,3 Mid-2014 which has special requirements for the partition tables to be able to boot. It will boot a live disk that I dd'd on to the drive but not a drive created with mkusb. Is Mac hardware supported by mkusb? Thanks.
  • sudodus
    sudodus about 6 years
    1. The standard method of mkusb is to clone an iso file or image file. When doing this, it 'only' wraps a safety belt around dd, so it should work in all cases where a cloned image works. In your case cloning with dd works, and cloning with mkusb should work too; 2. The method to create a persistent live drive (in mkusb) is made for PC computers and not tested in Mac hardware. It may or may not work depending on the hardware and UEFI/BIOS system.
  • sudodus
    sudodus about 6 years
    @Derwent, So my answer is that Mac hardware is not supported for persistent live drives. In some cases it works, but it is not actively tested in the development of mkusb. An alternative, that might work is the 'Do it yourself' method described at the following links, help.ubuntu.com/community/Installation/iso2usb and help.ubuntu.com/community/Installation/iso2usb/diy . If you try this method, please share your result, and I will modify my answer.