zerotoroot - My Journey to Becoming a Hacker

zerotoroot - My Journey to Becoming a Hacker


Follow the path to becoming a hacker!

Julius
Author

Share


Subscribe to zerotoroot - My Journey to Becoming a Hacker


Subscribe to my newsletter to receive article notifications and regular updates.

Tags


How to Create a Bootable Debian USB Drive on MacOS

There are some things, which are more difficult than they initially seem. This is true for creating a bootable USB drive on Mac with a Linux distro on it. In th…

JuliusJulius

There are some things, which are more difficult than they initially seem. This is true for creating a bootable USB drive on Mac with a Linux distro on it.

In this article, we will go through each step necessary to come out with a bootable Linux USB drive.

Let's begin!

1. Download Debian and Verify the Source

Download the Debian ISO (or any other Linux distro) as well as the signature and checksum files.

Since we are trying to become more security-aware, it's important to verify the checksum and signature of the Debian image, before continuing.

GPG does just that for us.

$ gpg --verify SHA256SUMS.sign SHA256SUMS
gpg: Signature made Sun May  7 20:28:23 2017 CEST using RSA key ID 6294BE9B
gpg: Good signature from "Debian CD signing key <debian-cd@lists.debian.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: DF9B 9C49 EAA9 2984 3258  9D76 DA87 E80D 6294 BE9B

If you get the same "Good signature", you should be on the safe side.

Converting the Debian ISO to an IMG File

In order for the copying to work, we first need to convert the ISO to an IMG file. This can be done using the hdiutil command.

$ hdiutil convert -format UDRW -o /path/to/output-file.img /path/to/input.iso

I had the file in the folder I was in, thus, I inputted:

$ hdiutil convert -format UDRW -o ./debian-8.8.0-amd64-DVD.img debian-8.8.0-amd64-DVD-1.iso
Reading Driver Descriptor Map (DDM : 0)…
Reading Debian 8.8.0 amd64 1             (Apple_ISO : 1)…
Reading Apple (Apple_partition_map : 2)…
Reading Debian 8.8.0 amd64 1             (Apple_ISO : 3)…
Reading EFI (Apple_HFS : 4)…
Reading Debian 8.8.0 amd64 1             (Apple_ISO : 5)…

.......................................................................................
Elapsed Time: 15.632s
Speed: 243.7Mbytes/sec
Savings: 0.0%
created: ~/Downloads/debian-8.8.0-amd64-DVD.img.dmg

The resulting file, might also have .dmg appended to it, as is the case above.

One more step is missing before we can write the file to the USB drive. We first need to unmount the USB drive.

Run diskutil list to see what disk the correct one is. If you are unsure, run the command twice. Once without USB drive plugged in, once with.

$ diskutil list
/dev/disk0 (internal, physical):
  #:                       TYPE NAME                    SIZE       IDENTIFIER
  0:      GUID_partition_scheme                        *251.0 GB   disk0
  1:                        EFI EFI                     209.7 MB   disk0s1
  2:                  Apple_HFS Macintosh HD            210.8 GB   disk0s2
  3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1 (external, physical):
  #:                       TYPE NAME                    SIZE       IDENTIFIER
  0:      GUID_partition_scheme                        *30.8 GB    disk1
  1:                        EFI EFI                     209.7 MB   disk1s1
  2:                  Apple_HFS Debian Boot             30.4 GB    disk1s2

In this case, it's /dev/disk1. Then unmount it.

$ diskutil unmountDisk /dev/disk1
Unmount of all volumes on disk1 was successful

Write the Operating System to the USB Drive

Now this is the step, where you really need to pay attention. Writing to the wrong disk could cause your operating system to be overwritten. Thus, backup before and double check that the output file is the correct disk.

$ sudo dd if=/path/to/inputfile.img of=/dev/rDISK bs=1m

An r is placed before the disk-identifier, because using it during writing will speed up the process. Everything else is the same as above.

$ sudo dd if=debian-8.8.0-amd64-DVD.img.dmg of=/dev/rdisk1 bs=1m

It will take a bit, till it's finished. Once it is, two things will happen:

  1. You will see a popup such as this:

    Ignore it for now.

  2. In the console you will see an output similar to this:

    3809+1 records in
    3809+1 records out
    3994091520 bytes transferred in 74.693837 secs (53472839 bytes/sec)

Meaning the program has finished writing. First, eject the USB drive.

$ diskutil eject /dev/disk1
Disk /dev/disk1 ejected

Then choose ignore on the dialog box option.

You are now all set. Plug in the USB drive the next time you want to boot from it or install the operating system.

Resources

Julius
Author

Julius

View Comments