Uniting the Tribes: Triple Booting Windows, BSD, and Linux


Last Cyber Monday I fell for a deal from Dell: a Vostro 2520 15.6″ laptop with Intel i3 processors, 4GB RAM, 500GB hard disk and CD/DVD burner, plus WiFi, camera, USB ports, SD port, HDMI port, etc., with Ubuntu Linux preinstalled for $279 Cdn. It’s not a powerhouse, but was too good a deal to pass up. It’s a lot zippier than my old Dell Inspiron 1520. Two days ago it arrived, booting up perfectly with Ubuntu 11.04 64-bit and the unit even had a little Ubuntu sticker on the case instead of the usual Windows sticker.1

Because I’ve started preliminary work for a possible book on Unix and Unix-like operating systems, I needed a good lab computer — a unit to turn into a sandbox where I could play around with stuff and not worry about my critical data if something breaks. It’s a good thing too because, as you’ll see, I managed to trigger a superb messup along the way.

The reason I need Windows in the mix is to test out the capabilities of Cygwin, the project whose motto is “Get that Linux feeling — on Windows.” Cygwin provides a Unix-like environment running in Windows itself without the need to install a parallel operating system. I’ve used it once or twice in the past and liked it and can see how it could be a highly useful tool both in itself and as a vehicle to learn Unix concepts.

So, when creating a multi-boot environment, it’s always a good idea to start with Windows first because if you don’t, Windows will blow away any boot menu you’ve set up in the MBR (Master Boot Record) of your drive, claiming the space as its own. Windows does not play nice with other operating systems.

I installed Windows 7 into a 100GB partition. I thought of installing Windows 8, but I already had a Windows 7 license and I had enough new learning on my hands without experiencing the weird aggro of Windows 8. While partitioning my drive (blowing away the Dell installation) I used Windows to create an extra 80GB partition for PC-BSD. PC-BSD doesn’t care what kind of file system is there initially, but it has no partitioning tools at this time and requires a primary partition to be available to install into.

PC-BSD? I’ll admit this one sneaked up on me. I used to install FreeBSD servers in one of my IT jobs and I really liked BSD (another Unix-like operating system similar to, but different from, Linux). What PC-BSD is, is FreeBSD with desktop enhancements to make it attractive as a workstation computer as well as a server. I hadn’t heard of it until recently so I wanted to include it in my studies and tests. PC-BSD 9, 64-bit, installed cleanly from DVD and all was well until I tried to reboot after installation and the system went straight into Windows instead. Evidently PC-BSD’s boot menu routine wasn’t up to the task. Later, I thought. I’ll deal with the boot issue later, because I have one more operating system to go.

My third operating system on the Dell unit was Ubuntu Linux, but version 12.10 rather than the 11.04 Dell had installed. As always, Ubuntu behaved well for me and installed nicely, taking the rest of the available disk. I expect to spend most of my Unix time in Ubuntu (unless my time on my intrepid Mac counts as Unix time, but I think that’s a bit of a stretch, despite the Mac’s BSD underpinnings).


The GRUBby details

I had rather hoped that Ubuntu would sniff out PC-BSD as well as Windows and add it to GRUB (GNU GRand Unified Bootloader), the current Linux boot manager. It didn’t. It certainly picked up Windows and I had a fine dual-boot computer working, with no apparent access to the BSD installation.

I figured I could fix GRUB manually so I did a little googling and found some recipes for booting PC-BSD. GRUB has changed substantially since I last used it and the /boot/grub/menu.lst file is no longer hand editable. I had to add the BSD stanza to /etc/grub.d/40_custom, which I did, finishing off with a $ sudo update-grub command to insert the new boot menu into the MBR.

When I rebooted there was an entry for PC-BSD, but it didn’t work. I chased a number of red herrings trying to get it working, including reinstalling the OS in case I’d done something wrong. During installation I thought, with an increasingly fatigued mind, that if I put the /boot partition in the MBR, it would solve the boot issue. It did. Boy did it! It booted beautifully, but took over the entire hard disk, wiping out both the Windows and the Ubuntu installations. It wouldn’t have been quite as painful if I hadn’t gone through the gruelling process of “first update” of Windows software: 139 slow, slow, slow updates. (It’s this sort of thing that turns me off Windows). But, the fault lay with me, so I had a good laugh and started over.

Last night I got everything installed again, with the same initial result. PC-BSD wouldn’t boot from GRUB. Somewhere along the line something I read niggled at my brain and I read more about GRUB, learning that between the last edition, which I’ve used, and this one, they changed disk numbering. Numbering of the first partition used to start at 0, second partition at 1, third partition at 2, etc., so for the BSD partition at partition 3, I was using 2. It’s been changed to simply 1, 2, 3, etc., without starting at 0. That was one I wouldn’t have anticipated.

When I fixed the number, changing it from a 2 to a 3, PC-BSD booted perfectly. For the record, this is the stanza that worked for me:

menuentry "PCBSD 9.0" {
set root=(hd0,3)
chainloader +1

Simple math, if you know the rules.

Now that the Cyber Monday special is up and running, I can compare and contrast the three OSes and the type and quality of Unix experience they provide.

More later.

1. Lest anyone think the acquisition was perfect, let me admit that the Dell Vostro 2520 has a crappy keyboard. It’s cheap and bounces easily resulting in multiple characters per keystroke. Worse it has the dreaded Canadian English-French keyboard layout that shrinks the left shift by putting an extra key in the way. Instead of shifting, you get a string of backslashes unless you type very carefully. I use a USB keyboard and mouse in place of the built-in stuff. [Jump back to footnote 1]