How to install Linux over USB-ZIP from Mac OS X

I love my Macbook, but every now and then I get the urge to dig out an old computer and install Linux on it. This usually entails a look into the contemporary state of Linux, even if my immediate project is then hampered by the state of the outmoded hardware (lol).

My first Linux install was Slackware onto a 486 desktop more than 10 years ago. It was an OK machine, except for the lack of an ethernet card, and ISA cards were available even then mostly only used or as NOS. The current project is a homemade desktop we bought used maybe five years ago. It’s a machine probably built in the early 2000s and consistently upgraded with then-high-end CPU/memory/hard drives over the Aughties: the video card is ancient and the hard drives cramped, but it’s otherwise surprisingly up to date. At the time, I installed Ubuntu Studio (based on Ubuntu 8.04.04 Hardy Heron) to dual-boot with the pre-existing Windows XP install (always complaining about the validity of its license). But I never ended up using it much.

So a week ago I decided to wipe the drive and install a fresh Linux on it. Sadly, due to user error (i.e, the use of the Debian net install ISO instead of the Debian CD 1 ISO while offline), the install quit after partitioning the disk (and thus wiping GRUB), but before installing the new OS. For some reason, this also coincided with the DVD drive becoming unable to boot optical disks. This became, um, rather frustrating.

On the upside, this gave me some extra time to distro-surf in virtual machine installs while trying to figure out how to make the old desktop bootable (eventually torn between CrunchBang and ArchBang ). It was completely unresponsive to any CD or means of install. After giving up on CDs, I started trying to install on USB disks. The BIOS recognized USB, but every attempt to actually boot failed. Moreover, since so much of the Linux ecosystem is geared around converting Windows PC hardware, most of the recovery tools are set up to run on Windows or Linux. UNetbootin has a Mac client, but the menus were buggy and it wouldn’t recognize my USB flash drive.

Eventually I realized that the BIOS didn’t permit standard USB-HDD boots, but only boot from USB-ZIP: old Zip drives. Setting these up are a little tricky, and what worked for me probably wouldn’t work for others, and I’m sure there’s a better way to do it. So, how do you do this from a Mac? I don’t think you can, but you can use virtual machines running Linux and USB passthrough. I used an Ubuntu Live/install disk (and later a CrunchBang install in another VM) running in VirtualBox to write a working USB.

Getting USB passthrough to work requires not only the Oracle VirtualBox app, but also the proprietary extended tools. Using VirtualBox can be a little tricky, and I had some trouble installing to VMDK virtual drives instead of VDI. Set up the virtual machine, go to Settings > Ports > USB, make sure that Enable US Controller and Enable USE 2.0 (EHCI) Controller are checked, then create an empty filter (New Filter 1) and make sure it’s checked. Activate the VM, then plug in the USB drive. Now you can open a terminal in the virtual Ubuntu and start typing.

    sudo ls -l /dev/disk/by-id

This will list attached hard drives and USB drives. The USB drive can be identified by the USB IDs. In this case, the 2-GB USB drive is at /dev/sdb .

Find out some stuff about the disk.

    sudo fdisk -l /dev/sdb

responds with

Disk /dev/sdb: 2059 MB, 2059403264 bytes
255 heads, 63 sectors/track, 250 cylinders, total 4022272 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optional): 512 bytes / 512 bytes
Disk identifier: 0x0000000
   Device Boot     Start        End     Blocks    Id  System
/dev/sdb1             63    4022234    2011086     b  W95 FAT32

The Ubuntu Live disk includes syslinux (including the mkdiskimage script). If it’s not installed and you’re using Debian, just install syslinux with the package manager apt-get. Now convert the USB drive to Zip disk format:

    sudo mkdiskimage -4 /dev/sdb 2059 64 32

I had to specify 2059 cylinders rather than 0 (as this page suggests), possibly because of the large partition size. The script warns that not all BIOSes will be able to boot a device more than 1024 cylinders (1 GB). Fortunately, my BIOS was OK with it. Now check the disk again:

    sudo fdisk -l /dev/sdb

The partition is now at /dev/sdb4 , not /dev/sdb1 . Thus, the next step is:

    sudo syslinux /dev/sdb4

Now that the USB drive is prepared, you need an ISO, a kernel, and some other files. These can be put on the disk with cp or a GUI file manager (but not, say, dd). Point Firefox at a mirror (the current stable Debian is wheezy), download the files vmlinuz (the kernel) and initrd.gz, and put them on the mounted USB drive. Then, open a plain text editor, create a file named syslinux.cfg, and add two lines to the file:

    default vmlinuz
    append initrd=initrd.gz

Without syslinux.cfg, you can boot the kernel vmlinuz at the prompt, but it will immediately panic because it can’t find its initial ramdisk image.

Finally, you need the ISO you are going to install. I used the CrunchBang waldorf i486 ISO. However, the Ubuntu Live Disk didn’t have enough space to torrent the ISO, so I had to switch over to a different VM with CrunchBang installed in order to have enough space to download the ISO and copy it to the USB drive. At this point, there are four files on the USB disk.

And finally, I got a USB drive that would boot and eventually install a working operating system. Make sure to note the physical disks and where they are mounted during disk discovery/partitioning, because in this case GRUB needed to be installed on the disk with the existing Windows install. But finally: done, it worked.


Leave a Reply

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

You are commenting using your 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

%d bloggers like this: