Wednesday, May 23, 2018

Booting Linux from a USB stick – a beginner’s guide

On a forum thread regarding being tracked by cookies on the soon to be mandatory Universal Jobmatch website, and the pitfalls of having to use unsecured wireless access points after having had your broadband cut off due to benefit sanctions, someone mentioned that it is possible to boot your laptop into Linux from a USB stick!

But how easy is it to actually achieve this? Well not very, I am a computing professional and it took me 3 or 4 hours to successfully load my chosen Linux Distribution onto a USB stick and boot from it. I took about 5 attempts using several different utilities before I finally achieved what I had set out to do. So, to save yourself a lot of frustration, annoyance and worry please learn what you can from my mistakes:

First of all you are going to need a USB stick or flash drive, I suggest you use a 4GB or larger, however most Linux distributions will fit on a 1GB. Some Linux distributions will not boot from a drive that is NTFS format, so FAT32 is preferred. If you want to reuse an old USB stick you may be tempted to reformat it using windows, DON’T. Windows (at least XP) seems to only be capable of formatting a USB stick up to 1GB with the result that a 4GB will be reformatted to 1GB by windows. If you must reformat your USB stick, perhaps because you partitioned it or whatever try using one of these:

RMprepUSB : This is able to do the entire job for you as well as preparing the USB stick(formatting) however it is far from the simplest to use. It also depends on Grub4dos, which I can not recommend unless you are already familiar with it.

BootICE : This will enable you to restore your USB stick to its original format, for example if your 4GB has been turned into a 1GB due to formatting it in windows.

Assuming that you have a fresh or reformatted USB stick ready to go you then need to look at what flavour of Linux you want to use. There are several utilities that claim to do this for you, however each one seems to favour its own selection of Linux distributions. If you try to use them to setup a Linux distribution ISO that you have downloaded, and its not one that the particular utility favours it may try to install it for you but there is a good chance that it won’t work when you come to boot from it. There are other considerations which need to be taken into account also, some of these utilities are designed to build ‘Multiboot’ USB drives, allowing you to boot into any of several flavours of Linux, and/or utility boot images such as ‘partition magic’.

XBOOT is one such utility, however the selection of Linux distributions that it supports is limited, and it tries to get around this problem by enabling you to load whatever ISO you have downloaded using Grub4dos emulation, which I do not recommend as mentioned above. Grub is not for novice users!

Another situation where it is possible to go horribly wrong in trying to create a Bootable Linux install on your USB stick is where the utility offers you to select the flavour you want from its list, saying it will download and install it for you to your USB drive.

UNetbootin is one of these. You would expect that such a program would download the ISO image to your hard drive under windows first, but this is not so. Like many bootloader utilities it installs its bootloader onto the USB, then expects you to reboot into the USB drive, where upon it tries to download and install the ISO. Which is fine if you have a hard connection to the net, but if you are on a wireless laptop you are in trouble! The instructions for this one, in this situation give the host name of the download server, but when you are booted from the USB and trying to download the ISO the bootloader wants the IP address, any you may well have no means of obtaining that without rebooting back into windows. This utility also allows you to create a bootable Linux distribution from an already downloaded ISO, but again unless it’s one that it explicitly supported by  UNetbootin, the USB may well not work, due to missing kernel components and so on. For example using UNetbootin to make a bootable USB stick with openSUSE-12.2-GNOME-liveCD-ISO (the latest version as of time of writing) the operation was successful however booting from the USB failed at boot time because the boot loader could not find the kernel image ‘gfxboot’.
The best utility for the beginner, and the one that I recommend is;

Universal USB installer from pendrivelinux.com ! This utility is simple, straightforward, and easy to use and supports almost all of the Linux distributions that can be loaded from a USB stick. It expects you to have downloaded your chosen ISO image already, and if you place the ISO in the same folder as its executable it will pick it up for you automatically. It does NOT support multiboot, i.e. it can only create a bootable USB using one ISO image, which is its only major drawback, but I suggest that ‘multiboot’ is something for the expert, and not for the beginner!

All of the above may well have problems if you are trying to make a USB with the very latest version of the Linux distribution you want, since they will all lag behind the distribution’s development cycle, that’s to say that the utility developer will most likely not have had time to update their product, so you should choose an older version of the ISO in this case, perhaps the most recent stable release rather than the current beta version.

Finally, You can’t accidentally damage your windows laptop by booting it from a USB stick unless you are really stupid! for example by formatting the wrong drive letter during the setup, or by attempting to use the USB to install Linux on the hard drive of your computer into the partition used by windows operating system.

You may be wondering by now how the hell you make your computer boot from the USB drive rather than the hard drive. The thing is that precisely how you do this depends not on what operating system you want to use but on what BIOS your computer has installed, and the exact procedure varies from BIOS to BIOS. In general the first screen that loads during the boot process is a placeholder for the BIOS, and usually this screen will tell you that such and such an ‘F’ key will allow you to enter the setup screen for the BIOS. On most PCs this is F8, on laptops (such as Toshiba) it may be F2. You will have only a couple of seconds in which to press it. On PCs the setup screen will allow you to specify which drive letter to boot from, or will allow you to enable booting from drive letters other than the default (C:). Or as on Toshiba laptops you can specify which devices can be booted from. This will enable the boot menu, which on a Toshiba is accessed by pressing F12 on the first screen. This allows you to select the device you want to boot from at startup. However every make of computer seems to have a different BIOS, and you should refer to your machines user manual to get the exact procedure for your machine.

1 comment:

  1. Look for Easy2Boot on the rmprepusb website. Once you have prepared your USB drive, all you have to do is copy the ISO you want to boot to a folder on the USB drive (as many as you like). That's it! 99% of ALL linux liveCD ISOs work and most other ISOs too, no matter what version or flavour. There is also a YouTube video on Easy2Boot too.

    ReplyDelete

Please do not spam comments onto my posts, all comments are moderated and only genuine 'on topic' comments will be published. Anyone repeatedly trying to spam the same off topic links into comments will be reported to Google/blogger .