I have mentioned a number of times that I usually install distros across the USB port on the Mebius, but I haven’t gone into much detail about how that works.
It’s not the best way, probably, to install a full system to a machine this old, but in some senses it’s the only way to do it without running aground on memory limitations, or the need to install from a live system.
In short, you’ll need these things:
- An ISO image for the distro you want to install. You’re going to boot that in an emulator, so you don’t have to burn it to a CD.
- A working, running copy of Qemu on a system that is considerably faster than the target machine. I strongly recommend qemu-launcher too, just because it makes it easier to configure the emulated system to match your target. More on that later.
- A USB port of any speed on the target machine. That’s fairly obvious. Although it is possible to do this by writing an image to a drive in an enclosure, but then why would you be bothering with these instructions? 😛
- A CD copy of Slitaz base, although something like DSL is as usable. This is what will boot the target machine to a live environment, and allow us to write the image to the target drive.
- A USB flash drive of whatever size you prefer.
I use a USB key of 2Gb; that’s more than enough to hold a root filesystem and home directories for most distros, and it only takes about 45 minutes to write all of that across USB1.1. And it’s cheap, which makes it a comfortable compromise between size, price and time.
Start up qemu-launcher and set it to acknowledge your network device and keyboard layout. Depending on the distro you’re installing, it might expect (or even need) network access on start.
Point qemu-launcher at the ISO you’re using, and then for an emulated hard drive, tell it you want a RAW file of the same dimensions of your USB drive. If it’s too big and you end up partitioning a file that doesn’t fit on the drive … well, needless to say that might be a problem.
Now boot the emulated system, and install it to the emulated drive. I can’t help you with that part. 😉
When you’re done, make sure you shut down the emulated system correctly and cleanly. If you close the emulated system without a correct shutdown, the system might not write out its contents fully. And that spells trouble. 😐
Now comes the fun part. Put your USB stick in your fast computer, and check where it appears. Enter this as root:
Watch for the drive assignment that matches your USB stick. Mine is usually /dev/sdb or /dev/sdc. Now write out the file to that device — not a partition on that device, the full device itself. Again, as root:
time dd if=emulated-system.img of=/dev/sdX
where X is the letter assigned to your drive. (
time is just for fun.) Be absolutely sure you have the right drive before you start this command. If you accidentally write it to the wrong place, there is nothing that will recover it for you.
Now wait. Over USB2.0, a 2Gb file writes out in less than three minutes.
From here, we simply reverse the process. Start your target machine with the Slitaz base CD, or boot to a live environment that works for you. (As always, check out PLoP or Smart BootManager if you have a system that doesn’t boot from CD.)
Now insert the USB drive and check the drive assignment again.
Then write the contents of the USB drive to the target drive.
time dd if=/dev/sdX of=/dev/hdY
Again, this can take a while. Drive write times and system speeds come into play here too. A relatively fast drive might be able to write quicker, but an old 4200rpm clunker is going to take forever, and rattle your ears too.
When it’s done, so are you. Bring the machine to a halt gracefully, then cycle the power. It should boot into your emulated, transferred system, unless something went weird.
Which is always a possibility. But just for comparison’s sake, it usually takes about three hours for me to install Debian via netboot to the Mebius, and that’s only to get to a console system. (Just to be clear, downloading the packages takes only about 10 minutes. The other three hours is for installation.)
On the other hand, I can install a console system in an emulator in about an hour on my X60s and write the entire business to the Mebius in about 45 minutes.
So for the time it takes to install Debian once on the host system, I can probably do it once in the emulator, write it across, troubleshoot it, and possibly do it again if I have to.
And the added bonus is that you have a file that represents a clean and pristine system, so if you misconfigure the target or scramble things badly, you’re only an hour away from a clean and fresh system. …
A few final points:
- If you’re installing to a drive larger than your USB key, you can add the home directory later by partitioning the remainder of the drive and editing your fstab to point /home at it. Just as an idea. 😉
- Remember that Qemu (and probably other emulators too) will report your architecture to be the same as the system they’re running on. That’s important for distros like Debian, which will install a system to match your processor. In other words, if you’re using something like Debian for an old, old machine, you want to make sure Qemu is set to emulate an i486. Otherwise, Debian will assume you’re using a modern processor, and install the 686 packages. And your target machine won’t boot. And you will cry. Of course, the other option is to tell Debian you want the expert install, and pick i486. … Congratulations, you’re an expert! 😆
- If you get crafty and think you can keep a library of emulated systems, I recommend against compressing those image files to save space. I tried that once and after decompressing it, it wouldn’t work. Things were really messed up. So just be aware, those image files probably shouldn’t be altered too much. 😉
- Finally, you can try this with Windows as well, but I haven’t had as much luck getting it to boot after writing it into place. It might require reinstalling the master boot record; I don’t have enough interest to chase it that much. 🙄
That’s all. Have fun.
P.S.: Reverse the entire process for system backups … if your system drive isn’t too big. …