# FreeBSD 9.0 grub2 doesn't find Ubuntu on other drive



## jtl (Feb 10, 2012)

Apologies if this has been answered elsewhere - I've looked through many posts but haven't found quite the same issue.

I have FreeBSD 9.0-RELEASE installed on one drive and Ubuntu 10.04 LTS installed on a second drive. My BIOS looks at the FreeBSD drive first when booting, and doesn't have the ability to specify a boot order among different drives. Historically (pre-FreeBSD 9.0), I installed grub on the FreeBSD drive from Ubuntu, added a FreeBSD entry to the grub.d directory on Ubuntu and I had a nicely working multi-boot system.

Since FreeBSD 9.0 now uses a GUID partition table, Ubuntu is unable to install grub on the FreeBSD drive. I figured no problem - I'll use FreeBSD's grub2. I installed grub2 on FreeBSD and it works great except that there's only a single menu entry for FreeBSD. I had hoped that grub2 might find Ubuntu on the other drive, but it didn't. Is there an OS prober for FreeBSD?

How do I add an entry for Ubuntu to my FreeBSD grub.d directory? Maybe I should be asking this question in the Ubuntu forums? Thanks for any help.


----------



## T-Daemon (Feb 11, 2012)

Try this: To avoid overwriting, check what scripts resides in /usr/local/etc/grub.d, copy the OS prober script  /etc/grub.d/30_os-prober from the Ubuntu installation to there and run the update-grub command.

Or: For the BIOS unable to determine a boot order, interchange the interface connectors of the hard drives, making the Ubuntu disk the first one (this may break disk namings in both fstab files, rendering the OS's not bootable, can be fixed by renaming). That way you can put Grub from Ubuntu to the drive where it is installed, adding easily an FreeBSD entry.


----------



## jtl (Feb 13, 2012)

Thanks. FreeBSD already had a 30_os-prober file in grub.d. I copied over the Ubuntu version and tried that version too, but it didn't help. I noted that FreeBSD doesn't seem to have os-prober installed anywhere, nor is it a recognized package. I don't see how the 30_os-prober can work without os-prober, but I don't know where to get it.

I also thought about swapping the disks like you suggested, but was hoping to avoid that. Since I've had no luck getting FreeBSD's grub to find Ubuntu, I've gone ahead and swapped them anyway. Now the machine boots with Ubuntu's grub menu, but the entry for FreeBSD no longer works.

Here's the output from *parted -l*

```
Model: ATA WDC WD1002FAEX-0 (scsi)
Disk /dev/sda: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system     Flags
 1      32.3kB  994GB   994GB   primary   ext4
 2      994GB   1000GB  6153MB  extended
 5      994GB   1000GB  6152MB  logical   linux-swap(v1)


Model: ATA ST3160815AS (scsi)
Disk /dev/sdb: 160GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name  Flags
 1      17.4kB  82.9kB  65.5kB
 2      82.9kB  156GB   156GB
 3      156GB   160GB   4295MB
```

Here's my grub.d entry for FreeBSD

```
menuentry "FreeBSD 9.0-RELEASE" {
set root=(hd1,1)
chainloader +1
}
```

The only change I made was that hd1 used to be hd0, but that hasn't helped. Do you have any suggestions for how to correct that entry?


----------



## jtl (Feb 14, 2012)

I've come up with a solution, though it's not quite everything I would like. It turns out that swapping the disks didn't bother Ubnutu, but FreeBSD 9.0 was very unhappy, so I swapped them back to the original order. I then added an entry to FreeBSD's grub menu that just chainloads to the Ubuntu drive. I also added an entry to Ubuntu's grub menu that just chainloads to the FreeBSD drive. I can now bounce back and forth between the two grub menus until I make up my mind about what OS to boot into.

I have one remaining issue. Altough I've installed grub2 on FreeBSD 9.0, I can find no grub file in either /etc/default or /usr/local/etc/default. Where does grub-mkconfig expect this file to be on FreeBSD? I'd like to be able to configure some of grub's behavior. Thanks for any help.


----------

