Docs/Howto/Multiboot

From Mandriva Community Wiki

Jump to: navigation, search
Supporting More Than Two Operating Systems

Mandrake only took into account windows, now your linux partitions are recognized !

Contents


To my knowledge, the solution explained in http://qa.mandriva.com/show_bug.cgi?id=4852#c11 by Stephane Gourichon (see below) would also close the following bugs: Image:bug_small.png Bug #5941, Image:bug_small.png Bug #5200, Image:bug_small.png Bug #2373, Image:bug_small.png Bug #8291.

[edit] Bug solved. Good News!

The good news is : the solution is *much* simpler that several solutions proposed to the problem of booting several OSes (#4852, comments #1, #4, #6, #7)

The bad news is : I have a long explanation about it because although the solution is simple, it gives ideas and solutions to other problems that had many Linux user suffer for a long time. For example, what should be done is change a little choice in the Mandrakelinux installer.

The solution in two sentences : each OS installs its private bootloader, on its root partition. Any (or all) OS may install extipl on the MBR of the boot disk. All problems disappear. Period.

[edit] Detailed explanation :

Most of the problems about the complicated work of detecting other OSes could be avoided by taking the right approach for booting from the beginning.

[edit] The theory :

At boot, there are two different steps that, unfortunately, were traditionally mixed as one since lilo was introduced.

Step zero is not Mandrakelinux's job but cited for clarity. It is /machine/-centered : locate a bootable MBR on one of the attached hard disks.

The first step is /hard-drive/-centered : to choose the one partition you're going to boot into. This is what extipl, and other generic boot managers do. Extipl offer a menu showing local partitions and their types, and allow you to choose the partition that holds your OS' bootloader.

The second step is /OS/-centered : once you've chosen a partition (an OS), an OS-specific bootloader will have to locate a kernel and load it, possibly giving the user the choice of kernels and boot options.

[edit] So, what is wrong in installing lilo or grub on the MBR ?

All the problems come from mixing the two steps in one and trying to maintain the mess.

It has been so for a long time because it works well in the simplest case : only /one/ Linux distribution present checks for other OSes (well, the other OS) on other partitions, at its *install* time, and installs its bootloader on the MBR with the choice to boot other OSes.

The important thing is : the one who writes on the MBR is *reponsible* for maintaining it, and access to other OSes. Lilo is especially bad at this. Don't let it take this big responsibility !

[edit] Rant

The problem happens every time the user moves partitions, adds or remove OSes (say, Mandrake cooker or 10.0 community, but keeping the 9.2 because, sadly, the ADSL connection will not work out-of-the-box).

If the new OS writes its bootloader on the MBR, it has to be careful, and still the old one often cannot boot. The newbie drops Linux altogether. The advanced user has to manually tweak the menu to add access to other OSes' kernels, knowing how to explain that at lilo-install-time, the path is /mnt/tmp/boot/mykernel but at boot time it will be different. Everyone who has had two linuxes on the same machine know what I mean. Stop !

[edit] To the solution

The current Mandrake installer considers two alternatives :

  • new user -> recommend installing LILO on the MBR (bad, fragile)
  • experienced user -> you have to know what you do, and you can install the bootloader where you want (ok)
  • recommend to make a boot disk specific to the OS installed (good, safe)

[edit] What should be done IMHO at install time

It is a much more robust solution, and above all, /maintainable/.

  • always install a bootloader for the current OS (GRUB preferred by the way) on the partition containing the to-be-booted kernel (/ or /boot usually). It's a partition dedicated to the current OS, you do what you want with it. It can't harm, and it will magically work with any generic partition chooser.
  • offer the user (and recommend) to install a generic partition chooser (say, extipl) on the MBR, while letting the advanced user say "no thanks I already have my generic bootloader on the MBR".

[edit] On an installed system

  • drakboot should offer to reinstall the generic bootloader at any time. Especially, after booting, Mandrakelinux could notice if the generic bootloader was overwritten (by, say, another evil OS), and offer the user to put back in operation the clean, OS-agnostic generic partition chooser.

[edit] The advantages

  • no OS has to try not to break the bootloading process of the other OSes, because they won't interfere : each OS had its own bootloader on its partition (DOS and Windows 95 did this, BeOS too, only lilo brought the bad habit to install on MBR, because of the lack of a free generic boot partition selector)
  • no OS has to mess up with trying to detect other OSes when installing its bootloader. It's not their job, it's not something to do at bootloader-install-time anyway. At boot time, it's the job of the generic partition selector on the MBR, which mustn't be tied to any specific OS or partition (like lilo).
  • the user doesn't have to rant about each new Linux installation breaking the old one
  • (with drakboot modification) if the user reinstalls Windows, and the MBR is overwritten, (s)he will only have to boot any of his/her Mandrakelinux systems from a boot diskette once, and the generic bootloader may be automatically restored, and restores access to all OSes on the machine.

[edit] The drawback

  • the user-friendliness of the OS selector depends on the bootloader used. If the default extipl configuration is not cute enough, investigate other configurations. Don't use grub for that purpose because it can't scan partitions at runtime.

[edit] Some things that should be known

  • I've installed extipl /once/ on my hard disk MBR about two years ago. Since then I've installed every new version of Mandrakelinux to two different partitions round-robin, installing Grub on the OS's partition (not the MBR !), always reformated the old partition after the new OS worked. Installed once, extipl was always able to boot all OSes without any OS having to care about it.
  • extipl is not visually cute, but the list of choices is built dynamically by scanning the disks at run time.

This is important because whatever the way the disks change after install, it will always be able to locate and boot new OSes.

This also means that if the user adds a second disk on the machine (s)he can immediatly choose to boot from it without first having to boot the-one-OS-that-is-responsible-for-the-MBR and ask it to add a disk, and remove it when the disk is removed.

  • at boot time, the user can ask extipl to boot this partition not only once but remember it from now on (updating the standard active flag in the partition table).

This means extipl needs zero maintenance from installed OSes.

  • don't trust me, think about it, try it, report your experience

[edit] Transitional issues

What do we do about already installed systems ?

  • First, the new solution cannot do as much harm as the old one. The conflict was about who owns the MBR. Using a boot method that doesn't need to own the MBR is always better.
  • Before installing the generic bootloader, maybe inform the user that if they have other OSes that installed a particular bootloader on the MBR, they should ask them to install their bootloaders on their partitions, not on the MBR, and telling that Windows BeOS, etc... are ok so that the newbie stays confident and has actually nothing to do.

[edit] The perfect solution

  • the ultimate generic boot manager would allow OSes to declare short labels, that would be more user-friendly. For example : each partition can hold a short label at a known offset, and the generic boot manager gathers those labels to present a user-friendly choice.

Anyone can help about this ?

[edit] Conclusion

Choosing an OS (MBR, extipl), and choosing kernel and boot time options for the OS (grub, 1st sector of partition), are two different things. Don't mix them, this is the actual source of many difficulties in drakboot and Linux system in general.

At a new OS install time, it is simple, better, and interference-free, to activate the boot partition of the newly installed OS (using the standard active flag in the partition table). This way, extipl (and other generic partition choosers anwyay) automatically boot into the new OS. The user doesn't have to fear anything. Many problems solved.

Personal tools