Installing distros on USB sticks with Unetbootin
Little Boots

© Andrew Horwitz, 123RF
Unetbootin lets users set up almost any distribution on a bootable USB stick.
Vampire hunter Van Helsing always has some holy water along for emergencies; Daywalker Blade relies on silver stakes. Experienced Linux users are more likely to resort to Linux on a USB stick to exorcise viruses from infected Windows computers. Thanks to Unetbootin, setting up an electronic emergency tool on a stick does not take much time. The installer lets you install various Linux distributions quickly and securely on an empty USB stick. Then you can use the stick to boot other computers.
Unetbootin will roll out live versions as well as installation and netboot variants. If you are not happy with the default selection of distributions supported by Unetbootin, you can feed the tool an ISO file for your favorite distro. Time-consuming workarounds necessitated by alternative tools such as Pendrivelinux [1] are thus a thing of the past.
To install Unetbootin, copy unetbootin-linux-323 (from the DVD that came with this issue or from the website [2]) to your home directory and make it executable:
$chmod u+x unetbootin-linux-323
The "Installing Unetbootin" box describes the steps for setting up Unetbootin in openSUSE 11.1 and Ubuntu 9.04. These steps should work for other distributions as well.
Installing Unetbootin
In openSUSE 11.1, make sure you have administrative privileges by typing su root, then type ./unetbootin-linux-323 to launch the file. For the sake of completeness, you might prefer running YaST and installing the p7zip package before you start, although the software will run without this dependency.
On Ubuntu 9.04, working with a normal user account, type your administrative password after launching Unetbootin with the ./unetbootin-linux-323 command. Additionally, you can use Synaptic to install the p7zip-full package, which the software requires.
Preparing the USB Stick
Before you dive into Unetbootin, you might want to prepare your USB stick for installation by deleting the existing data and reformatting the stick. On openSUSE, type su root to become root; on Ubuntu, add sudo to the start of the command line.
To start, type sudo umount /dev/sdb1 to mount the stick, replacing /dev/sdb1 used in this example with the correct mount point. To discover the mount point ID, launch a terminal and type tail -f /var/log/messages shortly before unplugging the stick. The sdb: sdb1 line tells you that your system has assigned a device file of /dev/sdb to the stick, which has a partition called /dev/sdb1.
Now, working as root, type fdisk /dev/sdb to launch the Fdisk partitioning tool; the tool is controlled from the keyboard. Type P to discover how many partitions are on the stick. Then press D and type the partition number to delete the partitions. If the stick only contains one partition, you do not need to specify a number. After deleting the partitions, press N to create a new partition; it needs to be a primary partition (P). To use the first partition, select -1 then press Enter twice to use all the sectors on the stick. Pressing A and -1 enables the partition you created by setting the boot flag; now finish the preparation work by pressing W (for "write"). Fdisk now writes all the changes to the stick; you can cancel at any time before this.
The next step is to format the empty – and still unmounted – partition with the ext3 filesystem. To do so, become root and type mkfs.ext3 -b 4096 /dev/sdb1, again replacing sdb with the device file for your USB stick. Linux will now write a fresh filesystem to the stick; this can take a couple of minutes. Linux writes blocks of 4KB (as defined by the -b 4096 option) to speed up the process. If you want to store Windows files on the stick, you need to run the mkfs.vfat -F 32 /dev/sdb1 command to create a FAT32 partition. The drawback to this option is that FAT32 does not support files of more than 4GB.
After completing the format, unplug the stick, plug it back in to the USB port, and make sure the system mounts it again. In the file manager, you should now see a Lost+Found folder – but nothing else.
Unetbootin in Action
With the empty, mounted stick prepared, it is now time to launch Unetbootin. In the Distribution pull-down menu select your favorite distribution and the matching version number on the right (Figure 1). The small text box below this tells you something about your choice of distribution. At the bottom, select USB drive as the Type, and select the newly created sdb1 partition from the drop-down menu to the right. If you choose Show all drives, Unetbootin will list other drives – this is useful if you are not sure you have found your USB stick. Pressing OK launches Unetbootin – sink or swim time (Figure 2).

If everything goes as expected, the software will download an ISO from an FTP server, unpack the ISO, copy it to the stick, and generate a matching configuration file for the Syslinux bootloader. Unetbootin then finishes the transaction with a message and presents the buttons Reboot now and Finish. That's all there is to it. As your final trick, you can check to see whether the image really does boot properly from your stick.
Fast and Manual
Downloading the files can take some time. To speed up the process, pass in the ISO file manually. To do so quickly, download the ISO via BitTorrent and, in the Unetbootin GUI, specify the path to the ISO file as your Image. If you want, you can even specify the kernel and initrd file versions. This makes sense if you use a non-standard kernel with a specific feature or one that works better with your hardware.
Often, it is quite useful to add a couple of Options to the boot process to make sure that Linux works with your hardware. Favorite kernel parameters in the case of hardware problems include ide =nodma (for problematic IDE drives) and acpi=off (to avoid trouble with non-functional or missing power management).
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.
News
-
Fedora 39 Beta is Now Available for Testing
For fans and users of Fedora Linux, the first beta of release 39 is now available, which is a minor upgrade but does include GNOME 45.
-
Fedora Linux 40 to Drop X11 for KDE Plasma
When Fedora 40 arrives in 2024, there will be a few big changes coming, especially for the KDE Plasma option.
-
Real-Time Ubuntu Available in AWS Marketplace
Anyone looking for a Linux distribution for real-time processing could do a whole lot worse than Real-Time Ubuntu.
-
KSMBD Finally Reaches a Stable State
For those who've been looking forward to the first release of KSMBD, after two years it's no longer considered experimental.
-
Nitrux 3.0.0 Has Been Released
The latest version of Nitrux brings plenty of innovation and fresh apps to the table.
-
Linux From Scratch 12.0 Now Available
If you're looking to roll your own Linux distribution, the latest version of Linux From Scratch is now available with plenty of updates.
-
Linux Kernel 6.5 Has Been Released
The newest Linux kernel, version 6.5, now includes initial support for two very exciting features.
-
UbuntuDDE 23.04 Now Available
A new version of the UbuntuDDE remix has finally arrived with all the updates from the Deepin desktop and everything that comes with the Ubuntu 23.04 base.
-
Star Labs Reveals a New Surface-Like Linux Tablet
If you've ever wanted a tablet that rivals the MS Surface, you're in luck as Star Labs has created such a device.
-
SUSE Going Private (Again)
The company behind SUSE Linux Enterprise, Rancher, and NeuVector recently announced that Marcel LUX III SARL (Marcel), its majority shareholder, intends to delist it from the Frankfurt Stock Exchange by way of a merger.