Ubuntu Dmg

This guide covers the verbatim copying of a DMG image to a USB thumb drive using only Linux (no need to find a Mac). If the DMG was intended to be bootable then the resulting USB will be bootable.

Convert to ISO

Linux doesn’t much care for DMG files. Sure, it’ll play nice with them. But we don’t just want to play nice. We want to copy a DMG image to a USB drive and keep it as verbatim as computationally possible. In order to do this, we’re first going to convert the image to a format that’s a little more universal: ISO.

We’re going to use dmg2img to convert the DMG to an ISO image. If you already have dmg2img, great. If not, install it using your distribution’s native package management system.

On Ubuntu, you’d do it like this:

Once you have dmg2img installed, begin converting the DMG file:

Ubuntu Dmg

After a few minutes, you should have a second file called image.img. This file can be used like an ISO. All we have to do is change the extension. Use mv to do this:

Converting a Mac DMG image to ISO in Ubuntu. Mac DMG images are practically unusable in a non-Mac system in that format. They can be converted to ISO images in Ubuntu for easy burning, mounting, or use in a virtual machine. Once you have the DMG file you want to convert to an ISO file, you need to install dmg2img. Linux doesn’t much care for DMG files. Sure, it’ll play nice with them. But we don’t just want to play nice. We want to copy a DMG image to a USB drive and keep it as verbatim as computationally possible. If the DMG was intended to be bootable then the resulting USB will be bootable. Linux doesn’t much care for DMG files. Sure, it’ll play nice with them. But we don’t just want to play nice. We want to copy a DMG image to a USB drive and keep it as verbatim as computationally possible.

Make sure you specified “image.img” and not “image.dmg”! Working with three different file extensions can get kind of confusing.

Ok, so we should now have a file called “image.iso” which is just “image.img” with a different extension.

Now we want to write “image.iso” to our USB drive. I used “lsblk” to figure out how the system was identifying my drive. The lsblk command lists all disks connected to the system. It’s usually pretty easy to figure out which disk is which based on their size. Just be sure you’re sure. This process is going to overwrite the target disk with the contents of our DMG image file. Any preexisting files on the target disk will be lost. As usual, make sure you have a proper backup.

Make sure the target drive isn’t mounted. Unmount the drive with your distribution’s GUI.

Or you could just unmount it from the terminal:

Most systems seem to mount external drives in /media. Sometimes the drive might be mounted in /mnt or elsewhere.

Write the ISO image to the USB drive like this:

Replace “X” with the appropriate letter. For example “/dev/sdb”. Be sure to use the drive directly and not a partition within the drive. For example, don’t use “/dev/sdb1”.

This will probably take a little while to complete. I’m using a Kingston DataTraveler DTSE9 and it took about 24 minutes 30 seconds to write 4.9GB.

Your new USB stick should now be bootable, assuming that was the intended purpose of the DMG.

Contents

UNetbootin for Mac OS X can be used to automate the process of extracting the Ubuntu ISO file to USB, and making the USB drive bootable. The resulting USB drive, however, can be booted on PCs only. If attempting to make a USB drive that can be booted from a Mac, follow the instructions below.

We would encourage Mac users to download Ubuntu Desktop Edition by burning a CD for the time being. But if you would prefer to use a USB, please follow the instructions below.

Note: this procedure requires an .img file that you will be required to create from the .iso file you download.

TIP: Drag and Drop a file from Finder to Terminal to 'paste' the full path without typing and risking type errors.

  • Download the desired file
  • Open the Terminal (in /Applications/Utilities/ or query Terminal in Spotlight)

  • Convert the .iso file to .img using the convert option of hdiutil

  • Note: OS X tends to put the .dmg ending on the output file automatically.
  • Run to get the current list of devices

  • Insert your flash media
  • Run again and determine the device node assigned to your flash media (e.g. /dev/disk2)

  • Run

    (replace N with the disk number from the last command; in the previous example, N would be 2)

    • If you see the error 'Unmount of diskN failed: at least one volume could not be unmounted', start Disk Utility.app and unmount the volume (don't eject).

  • Execute (replace /path/to/downloaded.img with the path where the image file is located; for example, ./ubuntu.img or ./ubuntu.dmg).

  • Using /dev/rdisk instead of /dev/disk may be faster.

    • If you see the error dd: Invalid number '1m', you are using GNU dd. Use the same command but replace bs=1m with bs=1M.

    • If you see the error dd: /dev/diskN: Resource busy, make sure the disk is not in use. Start Disk Utility.app and unmount the volume (don't eject).

  • Run and remove your flash media when the command completes

  • Restart your Mac and press alt while the Mac is restarting to choose the USB-Stick

Please notice: While all of the info and above commands are executed properly on a MacBook Air 3,2 (that is the 2010 version 13' version of the Air) the end result will not produce a bootable USB device, at least not with the image for Ubuntu 10.10 64-bit. When booting of the USB device the following message or something similar will appear: 'Missing operating system' and the process is auto-magically halted.

To get the USB device (e.g. a USB stick) to show up at all in the boot menu you also may have to reboot/turn on/off the computer a couple of times and also resync the partition tables using rEFIt. After doing this the USB should then appear as a bootable device while holding in the alt or c key when you are rebooting the computer. Notice that both the computers built in bootloader and rEFIt will identify the USB device as a Windows device, but that's not a problem and expected.

A workaround to the-usb-device-is-not-booting-problem is to:

  • Install rEFIt.
  • Create a bootable start disk using Ubuntu and a USB stick.
  • Create a separate partition on the Airs HD.
  • dd the whole USB stick to that partition.
  • Resync with rEFIt. Turn power off and on.
  • Select Pingo/Windows logo: Install should start. (Here you might want to press F6 to change parameters, e.g. use nomodeset)

Alternatively, burning a CD and installing via an external CD-drive will work fine on the Macbook Air 3,2.

(Moved from Installation/FromUSBStick)

We would encourage Mac users to download Ubuntu Desktop Edition by burning a CD for the time being. But if you would prefer to use a USB, please follow the instructions below. Note: this procedure requires an .img file that you will be required to create from the .iso file you download. TIP: Drag and Drop a file from Finder to Terminal to 'paste' the full path without typing and risking type errors.

Ubuntu Dmg

Ubuntu
  • Download the desired file
  • Open the Terminal (in /Applications/Utilities/ or query Terminal in Spotlight)

  • Convert the .iso file to .img using the convert option of hdiutil (e.g., hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/ubuntu.iso)

Note: OS X tends to put the .dmg ending on the output file automatically.

Ubuntu Dmg File

  • Run diskutil list to get the current list of devices

  • Insert your flash media
  • Run diskutil list again and determine the device node assigned to your flash media (e.g., /dev/disk2)

  • Run diskutil unmountDisk /dev/diskN (replace N with the disk number from the last command; in the previous example, N would be 2)

  • Execute sudo dd if=/path/to/downloaded.img of=/dev/rdiskN bs=1m (replace /path/to/downloaded.img with the path where the image file is located; for example, ./ubuntu.img or ./ubuntu.dmg).

  • Using /dev/rdisk instead of /dev/disk may be faster.

  • If you see the error dd: Invalid number '1m', you are using GNU dd. Use the same command but replace bs=1m with bs=1M.

  • If you see the error dd: /dev/diskN: Resource busy, make sure the disk is not in use. Start the 'Disk Utility.app' and unmount (don't eject) the drive.

  • Run diskutil eject /dev/diskN and remove your flash media when the command completes

  • Restart your Mac and press Alt while the Mac is restarting to choose the USB-Stick