Unetbootin has been giving me issues lately. After starting up my newly-burned Antergos LiveUSB on a testbed, the system halted with a weird error as it was mounting the drive:

[    8.755116] FAT-fs (sdb1): IO charset iso8859-1 not found
mount: wrong fs type, bad option, bad superblock on /dev/sdb1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so
ERROR; Failed to mount '/dev/disk/by-label/ANTERGOS'
   Falling back to interactive prompt
   You can try to fix the problem manually, log out when you are finished
sh: can't access tty: job control turned off
[rootfs /]#

Very, very weird. There was little else I could do that wouldn’t result in an instant kernel panic. Since I was testing an unstable pre-release image, I decided to boot into Windows, deep format the drive as FAT32, and use Unetbootin to burn an older stable copy of Antergos that I knew worked.

Unetbootin and formatting process

I booted it up, and to my surprise, I came up with the same error again! I tried using LiLi instead, but it still didn’t work. I even tested my images with VirtualBox to check if they were clean, and sure enough, they were. Frustrated, I wrote down the error and Googled it. It seems to be a particularly nasty bug with Unetbootin that has apparently affected others.

I decided to write the ISO directly to the flash drive without using Unetbootin nor LiLi as my middle-man. Let’s get our hands dirty in the terminal.

How to make it

This is where the awesome power of dd comes into play. This command allows you to copy a file from one location to another while pristinely preserving its structure during the process down to the last byte. Together we will unmount our flash drive, wipe it, and copy the ext2 filesystem snapshot from the Linux ISO to our flash drive using dd. Let’s get started.

Identify the drive

First, plug in your flash drive into a GNU/Linux or BSD system and fire up your favorite terminal emulator.

Since we’re using Linux in this example, we’ll use dmesg | tail to see the most recent I/O events triggered by our USB drive. When a drive is inserted and automounted by udev, the /dev ID should be buried somewhere in there like below:

user@linuxbox:~ $ dmesg | tail
[29713.907796] sd 28:0:0:0: [sdb] Assuming drive cache: write through
[29713.910730] sd 28:0:0:0: [sdb] No Caching mode page found
[29713.910736] sd 28:0:0:0: [sdb] Assuming drive cache: write through
[29713.929124] sdb: sdb1
[29713.931125] sd 28:0:0:0: [sdb] No Caching mode page found
[29713.931133] sd 28:0:0:0: [sdb] Assuming drive cache: write through
[29713.931138] sd 28:0:0:0: [sdb] Attached SCSI removable disk

So, we see that our flash drive has been given the /dev ID “sdb” and has one partition on it called “sdb1”. These details will come in handy later, so don’t forget them.

Wipe it down and write the image

Next, we wipe the flash drive if it had any data on it. Mine was corrupted from Unetbootin, so I formatted it with sudo fsck -f /dev/sdb (you can also do this graphically in your desktop environment’s file manager). You may skip this step if the flash drive is empty.

Now that the drive is clean, we’ll unmount it from our system.

user@linuxbox:~ $ sudo umount /dev/sdb

With our volume safely unmounted, we’re ready to actually write the ISO snapshot to the drive. Double and triple check that you’ve identified the right /dev ID and you’re not about to wipe your internal drive’s filesystem by accident. If you’re all set, then let’s do it!

user@linuxbox:~ $ sudo dd bs=4M if=/path/to/linux.iso of=/dev/sdb

The imaging process might take a bit of time to finish, so be patient. You may want to invest in a USB 3.0 flash drive if you don’t already own one, they make a world of difference in terms of speed (tens of seconds rather than several minutes).

Cool, it boots!

As soon as control is returned to your prompt, just eject the flash drive and you’re done!

user@linuxbox:~ $ sudo eject /dev/sdb

4 thoughts on “Make a Linux LiveUSB without Unetbootin

  1. I wasn’t able to edit my comment, so hereby I post again. Hope you don’t mind.

    Anyway, the reason I’m posting is that Cnchi wrecked my world. Okay, enough exaggeration. It f***ed up my MBR, although I explicitly told *not* to do so, but luckily enough the partitions are intact. Will try and see what boot-repair does.

      1. Hi!

        Luckily, it was a rather painless procedure. Only the boot flags were broken, but the partition layout (they’re all parts of an ordinary MBR, right?) was intact. I dd’d Kubuntu on my USB drive after installing Antergos, installed aforementioned boot-repair, and everything was automagically repaired. Okay, I had to set GRUB location and stuff, but it was quite a breeze, although an unnecessary inconvenience.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s