#+title: Arch Linux | How to Download the ISO and Create a Bootable USB on macOS
#+date: <2024-10-29 Tue>
#+tags: :arch:

This article is about my experience of making a bootable usb of Arch linux on macOS.

Downloading the Arch Linux ISO and Verifying It

  1. Download the ISO File:

    Head over to the official Arch Linux download page and find a mirror that’s closest to your location. Download the latest Arch Linux ISO from there.

  2. Get the PGP Signature:

    On the same page, look for the PGP signature file (it ends with .sig) corresponding to the ISO you’ve downloaded. Grab that file too.

  3. Place Both Files Together:

    Make sure both the ISO file and its .sig signature file are in the same directory. It’ll make the verification process smoother.

  4. Retrieve the Signing Key:

    Open Terminal and run the following command to fetch the public key of the Arch Linux developer who signed the ISO:

    gpg --auto-key-locate clear,wkd -v --locate-external-key [email protected]
    
  5. Verify the ISO:

    Next, verify the integrity and authenticity of the ISO file by running:

    gpg --keyserver-options auto-key-retrieve --verify archlinux-2023.10.01-x86_64.iso.sig archlinux-2023.10.01-x86_64.iso
    
    • Replace archlinux-2023.10.01-x86_64.iso and .sig with the actual filenames if they’re different.
    • If everything checks out, you’ll see a message like Good signature from "Pierre Schmitz <[email protected]>", which means your ISO is legit!

Creating a Bootable USB Drive

Method 1: Using the Command Line

  1. Ensure You Have the ISO File:

    Make sure you’ve downloaded the ISO file of the Linux distribution you want to install (we’re using Arch Linux here).

  2. Insert Your USB Drive:

    Plug your USB drive into your Mac.

  3. Identify Your USB Drive:

    Open Terminal and type:

    diskutil list
    

    Look through the list to find your USB drive and note its device identifier (something like /dev/disk2).

  4. Unmount the USB Drive:

    Run:

    diskutil unmountDisk /dev/diskX
    
    • Replace X with your USB drive’s disk number.
  5. Write the ISO to the USB Drive:

    Now, be very careful with this command:

    sudo dd if=/path/to/archlinux.iso of=/dev/rdiskX bs=1m
    
    • Replace /path/to/archlinux.iso with the path to your downloaded ISO file.
    • Replace X with your USB drive’s disk number.
    • Using rdiskX (the raw disk device) can speed up the process a bit.

    Enter your password when prompted.

A Few Tips:

  • Check Progress: dd doesn’t show progress by default. If you’re curious, press Ctrl + T to get a status update.
  • Double-Check the Disk Number: Accidentally writing to the wrong disk can be disastrous. Make sure you’re targeting the correct drive.
  • Be Patient: The process can take several minutes, so don’t panic if it seems like nothing is happening.

Method 2: Using a GUI Tool (USBImager)

If you prefer a graphical interface, you can use USBImager.

  1. Download USBImager:

    Visit the USBImager GitLab repository and download the macOS version of the tool.

  2. Fix Permission Issues (If Any):

    You might run into permission errors when launching USBImager. Here’s how to fix it:

    • Option 1: Temporarily set the SUDO_ASKPASS environment variable:

      export SUDO_ASKPASS=/usr/local/bin/askpass
      
    • Option 2: Permanently set it by adding the line above to your shell configuration file (like ~/.zshrc or ~/.bash_profile). Then reload your shell:

      source ~/.zshrc  # or source ~/.bash_profile
      

      You can confirm it’s set by running:

      echo $SUDO_ASKPASS
      
  3. Launch USBImager with sudo:

    sudo /Applications/USBImager.app/Contents/MacOS/usbimager
    

    You’ll be prompted for your password.

  4. Create the Bootable USB:

    • Open USBImager.
    • Select the ISO file you’ve downloaded.
    • Choose your USB drive as the target.
    • Click Write.
    • The tool will write the ISO to your USB drive and verify it afterwards.

Restoring Your USB Drive for Regular Use

After you’re done installing Arch Linux, you might want to use your USB drive for regular storage again. Here’s how to reset it:

  1. Insert the USB Drive:

    Plug the USB drive back into your Mac.

  2. Identify the USB Drive:

    In Terminal, run:

    diskutil list
    

    Note the device identifier for your USB drive.

  3. Unmount the USB Drive (Optional):

    macOS usually does this automatically, but if needed:

    diskutil unmountDisk /dev/diskX
    

    Replace X with your disk number.

  4. Erase and Reformat the USB Drive:

    Run:

    diskutil eraseDisk FAT32 USB_DRIVE MBR /dev/diskX
    
    • FAT32: This sets the file system to FAT32. You can use ExFAT or MS-DOS if you prefer.
    • USB_DRIVE: Choose a name for your USB drive.
    • MBR: This sets the partition scheme to Master Boot Record.
    • Replace /dev/diskX with your USB drive’s device identifier.

And that’s it! Your USB drive is now formatted and ready to be used like any regular storage device.

← All Articles

-UUU:--- blog.stepaniah.me All L1 (Org)
For information about GNU Emacs and the GNU system, type C-h C-a.