# Multiboot installation troubles



## freethread (Feb 15, 2010)

hi to all, I run in troubles partitioning and installing a triple-boot system. I'm not a computer expert and my experience in unix is poor.

I try to install Windows XP pro, FreeBSD 8.0 and Fedora 12 Linux on a 80 GB HD. I already have a system (PII 466MHz) with FreeBSD 7.1 as unique OS, so I roughly know how to install FreeBSD.

I started installing Windows (this is my habitat), I partitioned HD in this way

   1st partition: 33GB (planned for Windows XP)
   2nd partition: 16GB (planned for FreeBSD /)
   3rd partition: 16GB (planned for Fedora Linux /)
   4th partition: 2GB (planned for FreeBSD swap)
   5th partition: 2GB (planned for Fedora Linux swap)
   6th partition: about 8GB (planned for Windows swap)

After this poceeded with installing Windows. All done right, win starts. open Disc Manager and see:

   1st partition: primary system
   2nd partition: extended
      1st volume: 16GB
      2nd volume: 16GB
      3rd volume: 2GB
      4th volume: 2GB
      5th volume: about 8GB

well, I do not care of the extended partition and proceed to install Fedora Linux on the 2nd partition 2nd and 4th volumes. The installation done right and at that point GRUB starts and I can see and run the two OSs.
Now I proceed registering and updating Windows OS with SP3 and main components. Last step was to install FreeBSD but due to partition organization I do not see (in FreeBSD label) the space to install it, I see that 16GB+16GB+2GB+2GB in one chunk.
Mmmmmmmm... no matter, I remove the extended partition and leave all space free (in Windows Disk Manager):

   1st partition: 33GB primary system (untached with Windows already installed)
   free space: about 47GB

I restart system with FreeBSD CD and create a 18GB partition with label of type FreeBSD and two slices: 16GB / and 2GB swap and install FreeBSd with multiboot MBR.
Restart the system and I see

   F1 Win
   F2 FreeBSD

all right, I press F1 and Windows starts. Exit from windows. At next boot I press F2 and system hangs, nothing happen, FreeBSD does not start. This is the first issue.
Next I decide to let FreeBSD stew in his own juice for a while and try to install Fedora to see if GRUB can start FreeBSD. Reboot, start with Fedora LiveCD, create partitions / and swap, install it, reboot and the screen is black, no boot, nothing happens.
Now I go crazy to find a method to restart the system cos I already has Windows installed, registered and updated and I do not want loose it. I try to restore MBR with Windows installation CD but it doesn't statr! It seems that if the MBR on HD cannot start the system also the installation CD does not start.
Panic.
Idea, I reinstall FreeBSD with multiboot MBR. Right, I now can restart Windows.

Well at the end of the story I created and destroyed many times partitions to try to have FreeBSD and Linux on same HD with no success

Anyone know how can I solve this drama without touching the 1st windows partition? Or, as last resort, wipe all disk and reinstall all.


----------



## Speedy (Feb 15, 2010)

Why you need that much swap? Anyhow, that's not important.
If I had such a setup I'd install GRUB on MBR (after Windows is installed) and FreeBSD bootloader on partition. I'd use GRUB to chainload ntloader and booteasy.
Or, variant 2. Install Windows, Linux with GRUB on partition, FreeBSD with booteasy on partition, GAG bootloader to chainload ntloader, GRUB, booteasy.
Take your pick.


----------



## Oxyd (Feb 15, 2010)

Speedy said:
			
		

> Why you need that much swap? Anyhow, that's not important.
> If I had such a setup I'd install GRUB on MBR (after Windows is installed) and FreeBSD bootloader on partition. I'd use GRUB to chainload ntloader and booteasy.
> Or, variant 2. Install Windows, Linux with GRUB on partition, FreeBSD with booteasy on partition, GAG bootloader to chainload ntloader, GRUB, booteasy.
> Take your pick.



Or variant three, the one that I'm using: Install GRUB (after having installed Windows), don't install booteasy, let GRUB load /boot/loader on its own.

For the record, here's my menu.lst:
	
	



```
timeout 3
default 0

title FreeBSD
    root (hd0,2,a)
    kernel /boot/loader

title Windows Vista
    rootnoverify (hd0,0)
    chainloader +1
```
GRUB's (hd0,2,a) is the equivalent of FreeBSD's ad0s3a.


----------



## freethread (Feb 15, 2010)

Ok, I do not know how to install a bootloader or what is better for me. The FreeBSD bootloader is a good solution, it see primary partition OSs, but now windows is the only one OS I can start.

The 80GB HD is as follow (at this time):


```
-----------------------------------------------------
| 32GB primary    | 18GB primary | 26.34GB free     |
|  Windows XP     |  FreeBSD     |  not partitioned |
-----------------------------------------------------
```

The FreeBSD multiboot MBR shows:


```
F1 Win
F2 FreeBSD
```

If I press F1 windows starts, if I press F2 FreeBSD does NOT start, the screen stay as is and when keyboard buffer is full starts beeping.

I installed FreeBSD creating the 18GB partition (fdisk), set the boot flag, then press A (auto) for slices (label).

The bootloader is last my trouble. My first issue is to have, at this moment, Windows and FreeBSD boot, no matter for the boot loader.

If I can install Win, FreeBSD and Linux and boot each one correctly I can use GRUB in Win, I see an example elsewhere:

`dd if=/dev/da0 of=/grub.bin bs=512 count=1`

copy grub.bin in windows C:, add it at the end of boot.ini. Anyways I can use FreeBSD bootloader, is not so beautiful to see but is very powerful, it does not depend on any partition.


----------



## J65nko (Feb 15, 2010)

The MBR only allows 4 partitions (FBSD calls them slices) and there are only two types:


*primary partition*

You can have 0 to 4 of these partitions


*extended partition*
You only can have one single extended partition.Or none of course.
An extended partition can be subdivided in multiple sub-partitions. called logical partitions.

While Linux can be installed in logical partitions of an extended partition,FreeBSD cannot. FreeBSD needs to be installed in a primary partition. 

You tried to install FBSD in a logical partition which is not recommended.There is long thread on the forum here about installing FreeBSD in a logical partition, but is seems not be very easy to do.

Your original plan which did not specify the partition types:

```
1st partition: 33GB (planned for Windows XP)
2nd partition: 16GB (planned for FreeBSD /)
3rd partition: 16GB (planned for Fedora Linux /)
4th partition: 2GB (planned for FreeBSD swap)
5th partition: 2GB (planned for Fedora Linux swap)
6th partition: about 8GB (planned for Windows swap)
```


My suggestion, preserving the sizes, but now with the exact partition type

MBR entry 1 : primary partion for Windows XP 
size: 33 GB


MBR entry 2 : primary partition for FreeBSD 
size: 16 GB + 2 GB swap = 18 GB

Reason: FreeBSD can subdivide a primary partition (called a slice by FBSD) in different FreeBSD partitions for separate file systems as well as for swap. The *bsdlabel* program is used for this.

FreeBSD will see this MBR partition as slice 2


MBR entry 3 : extended partition for Linux and Win XP swap
size : 16 GB (Fedora /) + 2 GB (Fedora swap) + 8 (XP swap) = 26 GB


MBR entry 4 : empty


----------



## freethread (Feb 15, 2010)

J65nko said:
			
		

> ...
> 
> My suggestion, preserving the sizes, but now with the exact partition type
> 
> ...



Thanks for your suggestions, this is what I would do, with a little variation. The Linux boot partition must be primary to have FreeBSD bootloader see it, so the result is

- primary: Win
- primary: FreeBSD (internally sliced with label)
- primary: Linux (/ root dir)
- extended: Linux swap + Windows swap and temp


----------



## freethread (Feb 16, 2010)

Well, I'm not be able to install a 2nd OS with right boot. It could be that an antivirus interfere in changing MBR (and boot) sector?

The only one installation gone right was after I start this task:
- Installed Windows
- Installed Fedora Linux
the GRUB shows and the two OSs worked as usual. This was a test to see if I was able to easly install Win & Linux. After that I updated Windows with SP3 and installed antivirus sw. Finally I changed the disk partition layout (an error?) and start to install FreeBSD with multiboot (without restore MBR, another error?). From this point I was not be able to start nothing other than win and only after reinstalling FreeBSD with multiboot screen.

Now I installed the windows recovery console locally (The windows installation CD no more run) and before to start to install a secondary OS I execute FIXMBR & FIXBOOT.

So, I break something after install Linux the very 1st time or I need more knowledge about MBR sector, boot sector, multiboot & co. I googled but found none about.


----------



## Speedy (Feb 17, 2010)

> Finally I changed the disk partition layout ...


How? GNU Parted? Windows-based tools will probably screw up. Why not partition the drive before installing anything? This is what I'd do if I wanted multiboot (I don't).
Multiboot really is simple. MBR is what BIOS reads after POST. Whatever is on MBR gets executed. So you want it to be a bootloader. Bootloader can load a kernel (OS) or it can chainload another bootloader. Say, you have GRUB on MBR and Windows on first partition. GRUB cannot load Windows kernel, so you let it chainload ntloader from first partition, which loads Windows kernel.
Linux would go to second partition. You probably want to use it's automatic GRUB installation rather than installing GRUB by hand.
You can have FreeBSD on third partition. Which would be a wise choice, it has to be primary partition. You can use GRUB to chainload BSD bootloader which loads kernel, or you can let GRUB load FBSD kernel directly.
Fourth primary partition is for logical partitions. Data storage, swap, etc.

Edit: Just saw J65nko post which is very good.


> The Linux boot partition must be primary to have FreeBSD bootloader see it, so the result is ...


Why should FreeBSD bootloader see Linux?
Anyhow, you can install all operating systems with their bootloaders on respective partitions and use GAG bootloader to chainload them. GAG does not require separate partition. It resides on MBR.


----------



## freethread (Feb 17, 2010)

Speedy said:
			
		

> How? GNU Parted? Windows-based tools will probably screw up. Why not partition the drive before installing anything? This is what I'd do if I wanted multiboot (I don't).
> Multiboot really is simple. MBR is what BIOS reads after POST. Whatever is on MBR gets executed. So you want it to be a bootloader. Bootloader can load a kernel (OS) or it can chainload another bootloader. Say, you have GRUB on MBR and Windows on first partition. GRUB cannot load Windows kernel, so you let it chainload ntloader from first partition, which loads Windows kernel.
> Linux would go to second partition. You probably want to use it's automatic GRUB installation rather than installing GRUB by hand.
> You can have FreeBSD on third partition. Which would be a wise choice, it has to be primary partition. You can use GRUB to chainload BSD bootloader which loads kernel, or you can let GRUB load FBSD kernel directly.
> ...



I made more than one mistake and my english is not so good. In the other posts I explained how I initially partitioned the disk. The first partioning was at windows installation from cd, so the partitions was:


```
primary bootable (33GB windows)
extended
   logical 16GB
   logical 16GB
   logical 2GB
   logical 2GB
   logical about 8GB
```

During win setup, I not seen if partitions was primary or extended, I only seen:


```
1st 33GB
2nd 16GB
3rd 16GB
4th 2GB
5th 2GB
6th 8GB
```

After win installation (in windows) I seen the 'real' partition organization in disk manager, grafically. After that I installed Fedora Linux on *3rd* and *5th* partitions. The last thing of the Linux installer was the grub configuration, I accepted the default:

```
[ ] Other
[x] Fedora Linux
```
All go right, at that point the system did boot with grub and both Linux and windows able to booting. Update windows (SP3) and install AV.
FBSD was the last OS to install. Insert the Disk1 CD and reboot.
Select country and language and start a custom installation, but in fdisk there is no space (partition and/or free space) where I can install FBSD, I must create a primary partition, so the layout created during win installation is wrong.
Reboot the system in windows and delete the extended partition (windows disk manager):

```
1st partition primary (33GB Win)
free space (about 47GM)
```
now create another partition layout

```
1st primary (33GB win untouched)
2nd primary 16GB
3rd primary 2GB
extended
   4th 16GB
   5th 2GB
   6th about 8GB
```
So, at this point the MBR was as Linux installation leave it, with grub 1st stage. Reboot with FBSD Disk1 and install it on 2nd and 3rd partition with MBR boot. After reboot the choice was as expected

```
F1 Win
F2 FreeBSD
```
Windows booted, FreeBSD didn't booted.
This is what I can surely remmember, after that point I deleted and created partitions using windows disk manager, FreeBSD fdisk and a disk partitioner in Fedora Live CD (menu application, System), reinstalling Linux and FBSD many times, neither Linux nor FBSD start at boot, with grub or FBSD bootloader and the windows CD no more boot.
To boot in windows I reinstall FBSD with MBR multiboot, reboot, press F1 and windows starts, next go in windows recovery console and restore windows boot loader (FIXMBR).

At this moment my disk layout is:


```
1st primary (33GB win untouched)
2nd primary (16GB Linux)
3rd primary (18GB FreeBSD)
extended
   4th (2GB Linux swap)
   5th (about 8GB NTFS)
```

with Linux and FBSD installed and windows MBR, so I only boot in windows.

Now I'm trying to reinstall linux (in its partitions) and write the grub MBR on a USB disk instead, then copy it as grub.bin and insert in the list in boot.ini

The solution (I guess) is to cancel all partitions and go to start, but as I said, I want to preserve the already installed Windows.

*Note*. In one occasion I boot with Linux live CD with FBSD already installed. Opened the Linux disk partitioner program and seen that FBSD partition has the bootable flag off. I turned it on, press apply and the program hanged.

Thanks to you all for the help. What I want to do is an easy task, but for I don't know why and how is turned in a nightmare. And it has nothing to do with FreeBSD


----------

