Monday, December 5, 2016

Fun With Multibooting

Fun With Multibooting


Id venture to guess that the overwhelming majority of computer users will never install more than one operating system onto their computer.  Id even go as far as to say that Id be willing to bet that most of those people will probably never even reinstall the same operating system, just letting their Windows install to accumulate more and more dead weight as their registry grows over time and their NTFS disks become further fragmented until their computer becomes all but useless.  Ive known people to literally throw out otherwise perfectly good laptops because their Windows install became infected with a virus rendering their computer unusable.  As ludicrous as this sounds, it is true.
I on the other hand like to tinker.  I typically will have no less than three operating systems on any given computer except maybe on a media server or other headless machine.  I am not a fan of Microsoft and I make every effort to avoid using their products wherever possible.  But alas, this is the real world and the real world runs on Windows.  Time and time again Ive run into compatibility issues where I simply need to be booted into Windows to do something.  When I first discovered Linux I began a personal crusade to rid my systems of all things Microsoft.  However noble my intention was, I rapidly discovered that this was an uphill battle and there was a very good reason why even Apple developed tools like Boot Camp in order to run Windows on their machines.  Sometimes, you just need Windows.  During my early attempts to rid myself Microsoft, in addition to Linux, my initial searches turned up another option.  Googling for "alternative to Windows" will point you generally in the direction of Ubuntu and the like, but will also reveal the seedy underbelly of the Internet and you may catch a glimpse of the once cryptic hacker world of the OSX86 scene.  I say once because back in 2007 when I made the switch to Linux I had also discovered the prototypical hackintosh.  At that point in time, Intel based Macs were still very new, and while it was certainly possible to get OSX installed on non Apple branded hardware, to do so required a much greater skill level than I truly possessed at the time.  "Distros" like Kalyway and iDeneb were the defacto standard way to achieve that end, and compared to the nearly transparent methods today which allow hackers to use legitimately purchased Apple software to install OSX on their PCs, installation of a "distro" is completely illegal (not simply a violation of the Apple End User License Agreement, which is a non legally binding document).  Not only that, but the hackintosh scene was still in its inception and many of the tools available today simply did not exist.  If your computer was not close to Apple hardware, there was virtually no chance of you getting a properly functioning system out of your efforts.  Back then I did dabble with a handful of distros, iDeneb being the most successful venture but lacking proper drivers (kexts) for things like Ethernet and graphics cards caused me to abandon my attempts rather quickly.  Fast forward to today and you will find that not only has third party (read "hacker") hardware support has grown by leaps and bounds, but the sheer number of devices that have been used in actual Apple hardware has increased just by virtue of the fact that more computers have been produced by Apple.  Its difficult to put a number figure on it, but Id be willing to bet that nearly 40% of all personal computer peripherals are compatible with OSX, compared to the relatively slim pickings of just a few years ago.  The odds are not exactly in your favor, but with careful planning and research it is not difficult at all to create a system that is fully compatible with OSX at a fraction of the cost for equivalent hardware from Apple.
Fast forward to today.  As I said, I keep no less than three operating systems on the majority of the computers I own; at least one flavor of Linux, one copy of Windows and a version of OSX.  Every operating system is designed to be a solitary OS, residing on a solitary disk with a solitary partition of whatever native file system it uses without the need to bother with any other operating systems.  An operating system by itself is useless though without a method to boot into it.  With the exception of Linux boot loaders like GRUB, the majority of operating system boot loaders are operating system agnostic (meaning that they dont acknowledge each others existence).  Not only that, but each operating system will typically need to install its boot loader into your hard drives MBR (the first couple of sectors on the disk which contain booting information).  If Windows needs to install its boot loader to the MBR, and Linux needs to install its boot loader to the MBR and OSX although not using a real MBR needs to install its boot loader to the front of your hard drive, how do you get them all to play nice with each other?
Ive experimented quite a bit in this area and there is no one right answer.  The best advice I can give someone is to do what works for them.  That being said though, of all the common boot loaders available, GRUB is the one that is the most flexible, configurable and compatible with multiple operating systems.  While it is certainly possible to boot Linux and Windows from Chameleon or Chimera (the hackintosh boot loader) and with a considerable amount of work you can force the Windows boot loader to load chameleon or grub but I wouldnt recommend it.
Up until recently I was running three operating systems, OSX Lion 10.7.4, Ubuntu 12.04 and Windows 7 on a 1TB hard drive using Chimera 1.9 to select between them at boot.  But then I uncovered an extra 320GB hard drive and decided that it might be useful to have some "legacy" operating systems available (ie; Windows XP because its still the most common OS on the planet and OSX Snow Leopard for Rosetta support).  Yes you read that correctly, I now have 5 different operating systems on my computer on two separate hard drives, one being an MBR disk and the other GUID.  As you can imagine, getting all these systems to play nice with one another is not an easy task.  I started running into all manner of problems right off the bat.  When I installed XP, it borked my Windows 7 boot manager and overwrote the MBR on the WRONG disk.  When I installed Snow Leopard I lost the ability to boot into anything but Snow Leopard.  After booting back into my computer with the aid of my OSX Lion USB install disk using Unibeast, I was able to overwrite all those changes and reinstall Chimera 1.9 to the root of my first hard drive.  Doing that however broke booting into Windows XP and Windows 7.  Chain booting from Chimera into GRUB and then GRUB into XP worked but Windows 7 did not.
In the end, if you plan on installing multiple operating systems, the best advice I can give you boils down to 3 simple rules:
1) Make your multibooting game plan before ever installing anything
2) Always install Windows FIRST
3) Use GRUB as your boot loader.  Unlike Chameleon/Chimera it is very easy to reinstall it when it gets overwritten by another boot loader.  Its easily configurable using a simple text .cfg file (/boot/grub/grub.cfg).

while it is true that GRUB is capable of booting directly into OSX, the vast majority of hackintosh users rely on Chameleon specific workarounds and boot flags to enable hardware to work properly (ie; "GraphicsEnabler=yes"), so booting directly to OSX from GRUB2 is not desireable.  Instead chainloading Chameleon from GRUB is the way to go.  Although the process is more transparent for Windows users, GRUB does in fact chain load the Windows boot loader in much the same manner.

a few notes on configuring GRUB:

the syntax for chain loading Chameleon/Chimera from GRUB looks like this

menuentry "OSX Lion 10.7.4" {
     insmod hfs_plus

     set root=(hd0,1)
     multiboot /boot
}

Just delete all that extraneous stuff from your grub.cfg for the OSX menu entries.  You can prevent from seing both boot loaders by adding

<key>Quiet Boot</key>
<string>yes</string>
<key>Timeout</key>
<string>0</string>

to your /Extra/org.chameleon.Boot.plist on the OSX side.

Before ever messing with multibooting or installing a new operating system, back up all of your important data and be prepared to reinstall more than one OS before all is said and done.  This process is dangerous and relatively experimental, especially when youre attempting to boot more than one or two OSes.


Available link for download

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.