Dual-boot issues (grub2, Linux)

I have tried to install FreeBSD at the beginning of my drive twice. During the installation, I chose the "leave MBR untouched" option. Both times, after the installation finished successfully, grub would freeze at the "GRUB loading/Welcome to grub" splash screen. The menu did not load.

I booted a Linux live CD, chrooted into my Linux system, ran e2fsck on my Linux partitions, and re-installed grub2 to the MBR on /dev/sda. After rebooting, Grub would freeze at the splash screen again.

The only way I could fully restore grub was to actually delete the FreeBSD partition, and then re-install Grub to the MBR.

Is it possible for me to install FreeBSD on my first partition, and chainload into it from Grub?
 
Have you tried grub v1? There is a wiki (there are
*several* linux wiki's) that explain chainloading
other OS with grub, they may help. Cannot really
offer any more help than that.
..
OTOH I've not searched the HowTo section in
this forum for your issue(s).
 
Hi. Let me start by taking a guess at what your problem might be. Later on, I will explain how _I_ would configure my system to dual boot FreeBSD and Linux.

When you say this: "The only way I could fully restore grub was to actually delete the FreeBSD partition, and then re-install Grub to the MBR." That makes it sound as if GRUB may be trying to find some of its helper files in the first partition of your hard drive. With FreeBSD in your first partition, Linux would presumably be the second partition. When you delete the FreeBSD partition, Linux presumably becomes the first partition, even though it won't begin anywhere near the beginning of your hard drive.

Are there some configuration options in a GRUB install/configuration file that tell it which partition to look in for its helper programs? You probably need to change that number for that partition when you reserve the first partition for FreeBSD. I don't know too much about GRUB, but I do know that it depends heavily on additional complex boot steps and complicated ways of loading extra files during those boot steps. It's really annoying.


Now, here's what _I_ would do. Back when I had a dual boot of Linux and FreeBSD, it's the way I did it.

I would use the FreeBSD boot manager on the MBR of your hard drive. I think it's called boot0 or something, and you basically need to copy 400 some odd bytes to the MBR. I'm sure there's a documented way to install it.

Anyhow, the FreeBSD boot manager is very elegant and simple, and is the most effective and beautiful boot manager that I know of. When it gets executed, it simply does something like this:

1. Reads the partition table to see how many partitions your hard drive has (e.g. one FreeBSD partition, one Linux partition).
2. Presents a menu whereby you press a function key (F1, F2, etc.) to select which partition to boot into.
3. When you press a function key (F2 for example to boot into your Linux partition), the MBR program basically executes the boot program located in the boot record of the selected partition (the elegance is that the boot record of a partition is in a fixed location relative to the partition). So it's kind of like chaining.

Now, when you install a fresh Linux distrubution that uses GRUB, the boot record on your primary Linux partition is usually not touched. GRUB will usually be installed into the MBR, and will load grub files sitting in your partition directly. However, when you indtall GRUB (or, "flash" your hard drive with the GRUB binary), there is an option to install it as the boot record of one of the partitions. If you are using the FreeBSD boot manager to chain to GRUB like described above, then you want to flash GRUB to the boot record of the partition to which you will be chaining to.

The method described above worked for me better than any other I tried.

Let me point out a couple more things. When you "install" GRUB (like in Debian, for example, installing a .deb package) it may not actually "flash" the MBR or other area of the hard drive. Installing a GRUB package on a Linux distribution will typically, I think, only install the files necessary to actually install GRUB. In Debian for example, there are commands "update-grub" and "grub-install", I'm not sure which is which, but they do something, and one of them flashes your hard drive with GRUB.

The second thing worth mentioning is why I don't like GRUB on my MBR in a dual boot situation. GRUB will depend on files sitting in one of your partitions to function. In your case, it will depend on your Linux partition. Well, what happens when you uninstall Linux from your second partition, and FreeBSD still remains on your first partition? The answer is that GRUB will cease to function correctly. That is, the program that is used to boot an OS depends on files in that OS. Kind of a circular dependency. It's ugly. Grub needs your Linux install to function, even if all that it's doing is booting FreeBSD.
 
jb_fvwm2: chainloading is not the issue. I know how to set up grub2 to chainload into other operating systems. However, when the grub menu does not load, it is useless.

rambetter: There is nothing pertinent to grub on sda1. I have had no trouble using grub2 to boot into my linux system on sda2 when sda1 is a blank partition, another linux system, or even MS Windows.

When I say that I re-installed grub after installing FreeBSD to the first partition, I mean that I used the command "grub-install --root-directory=/mnt /dev/sda" from a live linux CD when /dev/sda2 was mounted at /mnt.

I will consider using the FreeBSD boot manager, but I would prefer to stick with grub because it is what I know. I have used FreeBSD before but not nearly to the extent that I have used Debian (my primary OS for several years). Perhaps I should simply stick with it on my laptop, and use another, non-production machine to run FreeBSD.
 
Back
Top