Solved /boot/loader.conf is not working

I'm new to FreeBSD and am currently dual-booting linux and FreeBSD.
freebsd has nvme0p6 mounted as /boot/efi and linux has it as /boot
I have chainloaded freebsd in grub like this:
Code:
menuentry "FreeBSD" {
    insmod part_gpt
    insmod fat
    set root='(hd0,gpt6)'
    chainloader /EFI/freebsd/loader.efi
}
Any changes I make to the /boot/loader.conf or to the /boot/defaults/loader.conf does not take effect.

Related problems:
i have ufs but it always on boot tries to mount zfs:root something and then fails, I have tried adding 'vfs.root.mountfrom="ufs:/dev/nda0p2"' in /boot/loader.conf but doesnt works but in the loader prompt if i set vfs.root.mountfrom="ufs:/dev/nda0p2" then it boots correctly no issue.
 
Any changes I make to the /boot/loader.conf or to the /boot/defaults/loader.conf does not take effect.
Don't attempt to edit /boot/defaults/loader.conf.

Anything in /boot/defaults/ nor in /etc/defaults/ are not at all intended to be edited other than any of valid upgrading procedures (source upgrading, freebsd-update or pkgbase).
You can override anything in them via the same-named files in their parent directory (/boot/ or /etc/ repsectively).

i have ufs but it always on boot tries to mount zfs:root something and then fails, I have tried adding 'vfs.root.mountfrom="ufs:/dev/nda0p2"' in /boot/loader.conf but doesnt works but in the loader prompt if i set vfs.root.mountfrom="ufs:/dev/nda0p2" then it boots correctly no issue.
It should mean you're NOT booting via Root on ZFS, but UFS.

If your root partition / pool cannot be properly found by grub (I've never tried grub, so I could be mis-understanding), you'll need to specify rootdev (or currdev) via EFI\freebsd\loader.env in FAT{32|16|12} formatted ESP as T-Daemon noted.

If you want Root on ZFS boots, and EFI\freebsd\loader.efi in FAT{32|16|12} formatted ESP can sanely find /boot/loader.conf but unable to mount root properly, you need to specify actual dataset (if you have pool zroot and bootfs of the pool is specified as zroot/root/default, vfs.root.mountfrom="zfs:zroot/root/default" line in your /boot/loader.conf would be needed.
 
Raghav, is there any reason why you need/want to use grub instead of letting UEFI handle booting?

The boot is failing because loader.efi(8) used directly is looking for a ZFS pool to boot from.
You can try setting rootdev=disk0sXX in /boot/efi/freebsd/loader.env to find the root disk.
Since you're on UFS, you can boot with gptboot.efi(8).

The best option is just to use UEFI boot manager, though.
 
Back
Top