Create a Linux live USB

No special apps or some other nonsense required. The CLI already provides everything we need for this task.

2018-09-21
2023-03-14
linux
usb
cli

Download a Linux ISO image

The XFCE Desktop from Manjaro is a good one.
Download the latest image from here.

If you want to verify the .iso image, you can also download the checksum (.sha512) and signature (.sig) files.

Verify the checksum

Verify the ISO image against the .sha512 file like this:

sha512sum -c manjaro-xfce-22.0-221224-linux61.iso.sha512

If everything is all right, you’ll see: manjaro-xfce-22.0-221224-linux61.iso: OK.

Verify the signature

Download the keys from the Manjaro developers from GitLab:

wget gitlab.manjaro.org/packages/core/manjaro-keyring/-/raw/master/manjaro.gpg

Then import all the public keys into a dedicated keyring:

export GNUPGHOME="$HOME/tmp/keyrings/manjaro" && mkdir -p "$GNUPGHOME" && chmod 0700 "$GNUPGHOME"

# wget https://raw.githubusercontent.com/manjaro/packages-core/master/manjaro-keyring/manjaro.gpg

gpg --import manjaro.gpg

Finally, verify the .iso image:

gpg --verify manjaro-xfce-22.0-221224-linux61.iso.sig

You should see something like:

gpg: assuming signed data in 'manjaro-xfce-22.0-221224-linux61.iso'
gpg: Signature made Sun 29 Dec 2019 07:38:21 AM CST
gpg:                using RSA key 39F0EC1AE50B37E5F3196F09DAD3B211663CA268
gpg: Good signature from "Bernhard Landauer <oberon@manjaro.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: 39F0 EC1A E50B 37E5 F319  6F09 DAD3 B211 663C A268

Prepare the medium

Let’s find the right letter for your device.
Insert the stick into a port and get a list of connected devices with this:

sudo fdisk -l

Identify the letter for your drive on the output, in my case the drive I’m looking for is this one:

Disk /dev/sdc: 14.3 GiB, 15376318464 bytes, 30031872 sectors

I can tell because it’s —supposedly— a 16GB device, look at the 14.3 GiB size reported above.

In this example, the letter for the drive is the c from sdc.
It could have been a, b, d or something else.
Just make sure that it is indeed the drive you want to trash.
You won’t be able to recover anything from it once it’s been zeroed.

Zero the bits out of the USB drive

Now, let’s zero the drive out.

This serves as a security measure and also it allows you to tell if the drive is still functioning well.
If the drive is dying, the process will take an unusually long time, or it’ll get stuck before reaching the end.

That’s a sign that you need to get a new one.

Write zeros all over the USB drive with:

sudo dd if=/dev/zero of=/dev/sdc bs=32M status=progress conv=fdatasync oflag=direct

NOTE: Remember that the command above is considering that the USB is located at: /dev/sdc.
Make sure you have the right path for yours!

Copy the ISO image to the USB drive

When finished, go to the directory where you downloaded the .iso file and transfer it to the USB drive like this:

sudo dd if=manjaro-xfce-22.0-221224-linux61.iso of=/dev/sdc bs=32M status=progress conv=fdatasync oflag=direct

That’s it, now you should have a bootable USB with Linux in it!