Getting Arch on USB: A journey

This week I decided to finally realise something I had planned for a rather long time… buy a USB stick and install Arch on it. Now, enthusiastic as I might be towards Linux generally and Arch specifically, I’m not as blind not to know that most people I want to get data to or from are using window$.

So I decided that the stick should be partitioned in three partitions: One to hold Arch, one (potentially encrypted) home partition and a large FAT32 partition, which is supposed to be accessible from various operating systems. Never having installed Linux on a USB stick before (except with a premade image file), I reckoned that this would take some time. I was wrong… not with the fact that it would take long, but with what exactly would take long.

Making use of the tremendous Arch Linux Wiki, I was able to install and set up Linux on the USB stick within a mere hour, including qingy, which I had never used before. The whole process is incredibly easy if you have an already running Arch system at hand. The following guide is almost exclusively based on the two Arch Linux wiki entries here and here, I just shortened, merged and modified them a little to the needs of this task:

  1. Partition your USB stick with fdisk or cfdisk and create the filesystems using mkfs. (Spoiler: see below for why you should make the FAT32 partition the first one on the stick). I suggest to use ext2 as the filesystem for your Arch partition(s) and set it/them up not to check itself/themselves regularly, saving stick-lifetime (remember to replace /dev/sdb2 with your Arch partition(s)):
    tune2fs -i 0 -c 0 -L ArchLinux /dev/sdb2
  2. Mount the stick (I’ll use /dev/sdb2 as the Arch partition and usbroot as the directory where it is mounted to, adapt as needed), install the base system and chroot:
    mount /dev/sdb2 usbroot
    mkdir -p usbroot/var/lib/pacman
    pacman -Sy base -r usbroot --ignore kernel26
    for a in {dev,sys,proc}; do mount /$a usbroot/$a --bind; done
    cp /etc/resolv.conf usbroot/etc/
    chroot usbroot /bin/bash
    grep -v rootfs /proc/mounts > /etc/mtab
  3. Now that you are in your system, install the kernel26 package if it’s necessary (for me, the --ignore kernel26 option above didn’t do what it implied) and all the other packages you want to have on the stick system. Don’t forget to create a user and set a root password!
  4. Continue setting up the system as described here. Before calling grub however, note that you need to run grub-install (I found that this wasn’t made very clear in the guide).
    I strongly advise you to use UUIDs instead of device names, as the latter might change depending on the system you are booting the stick on. A description on how to do this can be found here.
    Also edit /etc/mkinitcpio.conf, changing the hooks to include (at a minimum): “base ide usb filesystem” and also lvm2 if you want to use encrypted file systems. Then, regenerate the kernel image:

    mkinitcpio -k $(uname -r) -c /etc/mkinitcpio.conf -g /boot/kernel26.img

Now your system should be ready to go, as was mine. I rebooted my machine, told my computer to boot from the stick and everything was fine. I was very happy with how easy Arch was to set up on a USB stick and how helpful the Arch wiki was during this task. I already had a feeling that it was too good to be real…

So I booted to window$ to test whether it could read the stick as well and what do you know? It immediately presented me the partition I installed Arch on (I have an ext2 driver on my window$ installation). But it didn’t allow me to access my FAT32 partition. No matter what I did (and I did a lot), it just wouldn’t let me assign a device name to the partition.

I spent many hours (like 4 or 5) googling for this, rebooting to the three different operating systems now available on my system, double- and tripple-checked everything and even downloaded tools to read and modify the stick’s partition table, but to no avail…

So I gave up, backed up my linux installation on the stick and would have window$ do the partitioning of the stick. Maybe then it would work… As I tried, I stumbled upon creating the partitions under window$. I thought I was dumb, because I didn’t know how to do it and started googling for that only to find out that window$ doesn’t know how to create more than one partition on a USB stick, except if you administer some cruel hardware-hack which is supposed to let window$ think the USB stick was an external hard drive…

This got me thinking then… if window$ isn’t able to create more than one partition on a USB stick, maybe it also isn’t able to recognize more than one partition? So I started Arch again, partitioning the stick so that the FAT32 partition would be the first partition and got the backup I made on the other partition (btw: that last thing worked flawlessly! Don’t try this with window$, kids!).

I rebooted to window$ and what do you know? It let me use the FAT32 partition, but not the other two. I slapped my head. Such incapability from an operating system which is available since 8 (in words: eight!) years now. I couldn’t believe it.

But Micro$oft still had a laugh on hold for me as I tested the stick at work on vi$ta the other day: That new “operating system” can’t use the other two partitions either. Welcome in the year 2009…

Leave a Reply

You must be logged in to post a comment.