What commands should I put in grub.d?

My main OS is Debian 7-amd64 and would like to try FreeBSD 10.1-amd64.

I'm basically trying to dual-boot Debian and FreeBSD.

I've already installed FreeBSD 10.1 to one of the partitions on my HDD. The installation was successful.

I believe what I need to do know is to "chainload" FreeBSD by editing /etc/grub.d/40_custom file in Grub 1.99 bootloader.

I've googled for help and are the entries in 40_custom file below correct?
Code:
menuentry "FreeBSD" {
set root=(hd0,1)
chainloader +1
}
Any help would be appreciated.
 
But no guarantees. :) Still, it's worked pretty consistently for me on laptops, usually with either Fedora or Lubuntu's grub.

But a couple of things.
Firstly, create your own custom.cfg, it seems to work more consistently than the 40 whatever.

Also, the chainloader syntax looks wrong, see the page mentioned for syntax. Yours looks like the old grub syntax and I'm pretty sure the Debian 7 uses the new grub.

My page on legacy grub is at http://srobb.net/grub.html but very dated. By the way, your syntax indicates that FreeBSD is on the first partition of your hard drive, is that correct? (I would think that if you'd installed Debian first, it would be on a different partition.) Remember, grub partitions count from 1, not 0.
 
When I used Arch my grub2 entry for FreeBSD was:
Code:
menuentry "FreeBSD" --class freebsd --class bsd --class os {
  insmod ufs2
  insmod bsd
  set root=(hd0,1)
  kfreebsd /boot/kernel/kernel
  kfreebsd_loadenv /boot/device.hints
  set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ada0s1a
  set kFreeBSD.vfs.root.mountfrom.options=rw
  set kFreeBSD.hw.psm.synaptics_support=1
}
 
Helpful post, but I had to add something.
The problem is that loader.conf is not read, which means no Nvidia module is loaded, which means no GDM is started. This can be changed by adding the Nvidia module, but that doesn't work either, because the Nvidia module needs the Linux module, and this result in a missing dependencies error. So it's necessary to load the Linux module too.

At the end this is my configuration:
Code:
menuentry "FreeBSD" {
  set root=(hd2,msdos1)
  kfreebsd /boot/kernel/kernel
  kfreebsd_loadenv /boot/device.hints
  kfreebsd_module_elf /boot/kernel/linux.ko
  kfreebsd_module_elf /boot/modules/nvidia.ko
  set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ada2s1a
  set kFreeBSD.vfs.root.mountfrom.options=rw
}
This seems to do the job, don't know if it's correct. The lack of documentation about the different GRUB modules is very frustrating.
 
The problem is that loader.conf is not read, which means no nvidia module is loaded, which means no GDM is started. This can be changed by adding the nvidia module, but that doesn't work either, because the nvidia module needs the linux module, and this result in a missing dependencies error.
Alternatively load it from /etc/rc.conf: sysrc kld_list+=nvidia
Modules from kld_list are loaded before the network interfaces are setup (so also before GDM), but after the filesystems are mounted so this won't work for e.g. loading ZFS.
 
Alternatively load it from /etc/rc.conf: sysrc kld_list+=nvidia
Modules from kld_list are loaded before the network interfaces are setup (so also before GDM), but after the filesystems are mounted so this won't work for e.g. loading ZFS.
Thank you, good suggestion. Maybe this should be better documented too.
I actually used the line
Code:
kld_list=nvidia
I think it makes it a bit easier to read. If I understand correctly the only drawback is that the modules in loader.conf are overwritten.
 
If I understand correctly the only drawback is that the modules in loader.conf are overwritten.
No, it uses kldload(8) under the hood, so this is in addition to loader.conf. It is just a way to load modules later after all filesystems are mounted. The loader loads modules before booting the kernel and with kld_list they are loaded afterwards as part of the regular rc(8) startup.
 
No, it uses kldload(8) under the hood, so this is in addition to loader.conf. It is just a way to load modules later after all filesystems are mounted. The loader loads modules before booting the kernel and with kld_list they are loaded afterwards as part of the regular rc(8) startup.
I see, thanks. So why did you use sysrc kld_list+=nvidia if you could use a simpler line?
 
Back
Top