How Not to Install an Operating System

by Tom Richards

Saturday, January 04, 2014

I hate it when software triple-checks you before performing a potentially risky operation. Operating system install tools are especially bad about this. Sometimes, they prevent you from installing the OS altogether.

# /usr/bin/set-computer-on-fire-tool
Are you sure (yes/no)? y
Please type 'yes' or 'no': yes
Are you really sure you want to do this (yes/no)? yes
Please confirm your confirmation: yeswhatintheactualfsck

Of course, this is a parody, and I can’t think of a reason why anybody would want to run a program whose name implies that it can set things on fire…

In any case, I don’t know what the developer was thinking when they wrote the piece of code to get user confirmation over 9000 times. I do know this: each time I encounter a program with similar behavior, it frustrates me.

Part One, Linux

I obtained an old server a while ago and decided to finally set it up. Almost every peripheral device it has does not work (CD drive is bad, floppy drive is bad, can’t boot frum USB). Suffice it to say that I had to do some acrobatics in order to install the latest version of Arch Linux on it.

  1. dd ISO onto a physical hard drive… Check.
  2. Boot from the hard drive, which is now masquerading as a CD-ROM… Fail.
  3. Set up PXE in order to actually boot the installer… Check.
  4. Rearrange disks such that the target disk is the one I originally booted from… Check.
  5. Run through the usual install process, expecting to have a usable machine in a matter of minutes… Fail.

At the very end of the install, GRUB decided to pitch a fit:

# grub-install --target=i386-pc /dev/sda
grub-setup: error: /dev/sda appears to contain a iso9660 filesystem which isn't
known to reserve space for DOS-style boot.  Installing GRUB there could result
in FILESYSTEM DESTRUCTION if valuable data is overwritten by grub-setup
(--skip-fs-probe disables this check, use at your own risk)

Don’t talk back to me, GRUB. I know what I want. I’m sure this error message was printed to the screen with the best of intentions, but I assure you, I know what I’m doing. The disk might have previously had an ISO on it, but it isn’t there anymore. # sgdisk -Z /dev/sda took care of that, right?

Ahem. We’ll just slap some --skip-fs-probe in there, and

# grub-install --target=i386-pc --skip-fs-probe /dev/sda
grub-setup: error: /dev/sda appears to contain a iso9660 filesystem which isn't
known to reserve space for DOS-style boot.  Installing GRUB there could result
in FILESYSTEM DESTRUCTION if valuable data is overwritten by grub-setup
(--skip-fs-probe disables this check, use at your own risk)

How nice of you grub. You just gave me that same error message, only this time it is completely useless. Well, the switch for “please destroy the filesystems, I know what I’m doing” doesn’t work. It’s time to put in some elbow grease. In this case, elbow grease is otherwise known as my old buddy, the --force switch.

$ grub-install --target=i386-pc --skip-fs-probe --force /dev/sda
grub-setup: error: /dev/sda appears to contain a iso9660 filesystem which isn't
known to reserve space for DOS-style boot.  Installing GRUB there could result
in FILESYSTEM DESTRUCTION if valuable data is overwritten by grub-setup
(--skip-fs-probe disables this check, use at your own risk)

You’re kidding me, right? I just want a dang bootloader already.

By this point, I’ve spent entirely too much time getting the dang thing to boot, and I certainly don’t want to research the iso9660 filesystem to find whatever remnants it left on my hard drive…

$ dd if=/dev/zero of=/dev/sda bs=16M oflag=sync
(a few hours later... success)

I wipe the disk completely, and run through the install process again to find that GRUB is happy with my newly zeroed disk. No complaints, great success.

Solution

Use a program like dd or wipefs to remove all filesystem signatures from the disk.

…Go scratch, GRUB.

Part Two, Windows

Same story, different operating system.

I rarely use optical media these days, so in place of a DVD drive, my laptop has an adapter which accepts a SATA drive. This allows me to dual boot easily without having to worry about windows overwriting my bootloader on the other disk.

However, while installing Windows 8 on the second disk, the installer pulled one over on me:

couldnt-create-new-partition

…Setup log files? It would certainly help if I knew what “Setup log files” were or where they resided. Fortunately, Dr. Google was more than delighted to teach me more than I ever wanted to know about Windows and its “Setup log files”.

Here’s the relevant portion of setupact.log that explained why the Windows installer wouldn’t let me install to my second hard drive:

Info IBSLIB CanBeSystemVolume: Volume at disk [1] offset [0x0] doesn't meet criteria for system volumes...
Info IBSLIB DiskRegionSupportsCapability:Disk [1] is BLOCKED against capability [CanBeSystemVolume] for the following reasons...
Info IBSLIB LogReasons: [BLOCKING reason for disk 1: CanBeSystemVolume] The selected disk is not the computer's boot disk.

The drive I want to install Windows to is not the computer’s boot disk. You don’t say! I don’t quite understand why this is a criteria for installing an operating system. I’d like to selectively boot into Windows when I want, and let it default to Arch otherwise. Why is this difficult? I understand that installing Windows is a multi-reboot process. When the installer says something like, “Your computer must be restarted to continue installation”, I know that I should boot from the Windows hard drive, and not the other one.

Example BIOS configuration

Anyway, setting the second hard drive as the ‘boot’ drive in the BIOS allowed me to continue installation. It also allowed me to remember why I stopped using Windows as my primary OS.

Solution

Set the install drive as the boot drive and/or temporarily remove other disks while re-installing. Sometimes, fighting with Windows is a fool's errand.

…Go scratch, Windows 8.