1

I am installing Linux on a machine and got the Ubuntu 18.04 LTS image. I formatted a 32 GB Sandisk drive on macOS with MS-DOS (FAT) format and GUID Partition Map scheme.

I found the name of the disk as disk2s2 (either with Disk Utility or diskutil list in Terminal), unmounted and copied the image with dd following these instructions:

diskutil unmount /dev/disk2s2
sudo dd if=~/Downloads/ubuntu-18.04.2-desktop-amd64.iso of=/dev/rdisk2s2 bs=1m

I inserted the USB on the Dell machine, booted, pressed F12 to go into "Boot Once" menu, chose legacy boot with USB, and got

Selected boot device failed. Press any key to reboot the system.

When I follow the instructions from Ubuntu and flash the ISO image on the USB with Etcher, it works and I see an extra option in "Boot Once": UEFI SanDisk, Partition 1, which I chose and was able to try Linux.

What else do I need to create a bootable USB of Ubuntu with dd, or all in the command line?

2

I think you've made a mistake in where you write the image to.

The disk image contains a partition table of it's own so you need to write the image to the disk, not to a partition.

The partition is mounted as disk2s2 so you do need to diskutil unmount /dev/disk2s2 that. You should ensure that no other partitions on the USB drive are mounted as well. Use diskutil list to get the full list of partitions and make sure you have unmounted all partitions on the USB drive.

You then need to overwrite the entire disk (all partitions) with the ubuntu image.

sudo dd if=~/Downloads/ubuntu-18.04.2-desktop-amd64.iso of=/dev/disk2 bs=1m

Note here the partition is called /dev/disk2s2 but the USB disk is called /dev/disk2

I'm less familiar with macs, but if there is a sync command, you should use it before removing the drive. See Why is sync so important when making a bootable linux usb stick?

  • This was the right command, thank you. It took 3 times longer than the command in my question. I tried without && sync at the end out of curiosity and it worked, though I understand it's best practice to add it. I also think that the step of formatting the drive as MS-FAT is unnecessary, since the drive then appears on macOS as Apple HFS. – miguelmorin May 16 at 9:47
  • @mmorin Absolutely. You don't need to format it or change it in any way. Just plug it in, ensure it's not mounted then dd to it. – Philip Couling May 16 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.