How to install GRUB on FreeBSD 11.1

B

BSDAppentic3

Guest


Anyone has any idea of how can I install GRUB here?
Thanks!
 
OP
OP
B

BSDAppentic3

Guest


I didn't get this. Why should I see the wiki of Arch? I will install some systems of Linux. I know a lot, and in the web,there are much more.
Edit: Arch is fine. But it is, meh. I'll run it in virtualbox instead.
Do you know Qubes OS? Perhaps I'll download it and installed it. Yep, one of the most hard systems EVER.
 
OP
OP
B

BSDAppentic3

Guest


shepper
Sorry. But using pkg I have nothing, and using make, well, it shows me a couple of errors. Like 127, like error 1. I can't do ctrl+c and ctrl+v to show you because I'm using xterm and it doesn't allow me to copy-paste like the traditional terminal or konsole.
 

Sensucht94

Well-Known Member

Reaction score: 402
Messages: 389

I didn't get this. Why should I see the wiki of Arch? I will install some systems of Linux. I know a lot, and in the web,there are much more.

Edit: Arch is fine. But it is, meh. I'll run it in virtualbox instead.

Do you know Qubes OS? Perhaps I'll download it and installed it. Yep, one of the most hard systems EVER.

You were pointed the Arch wiki because the GRUB2 (and actually SysLinux too, which I prefer, but never tried with FreeBSD: sysutils/syslinux)

port you can find in the FreeBSD repo is exactly the same piece of software you can install on any Linux distribution: it's third party software, it doesn't belong to any OS (rather,it's FSF's "property") and as such it's basically always the same,no matter the OS you're installing it from ;).


There are various examples of working Grub2 menuentries for FreeBSD on this forum, for all the possible sets and circumstances, and it should be easy for you to find and 'steal' them, but it's a advisable to read the grub-install(8) man page thoroughly.

official and exhaustive documentation is available on gnu.org

SysLinux provides an official wiki too, which is extremely well thought, and proved in my case very useful, both on Linux, and FreeDOS, where SysLinux has been ported too.

Finally, if you need to set up a dual/multi-boot environment on a MBR disk, rather than GPT, then FreeBSD natively provides the lightweight boot0cfg(8) boot manager
 

shepper

Aspiring Daemon

Reaction score: 274
Messages: 797

The Arch link explains the basic commands and gives a decent review of how the boot process works.

pkg should install the software but you need an additional steps to install and configure the bootoader. I copied/pasted the commands from the Arch wiki and changed the partition names to those used in FreeBSD.
If your system is i386/amd64 with a legacy (MBR) BIOS, you need to run this command:
# grub-install --target=i386-pc /dev/da0
If you have a newer amd64 system with EFI/GPT BIOS then you run this command:
# grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id=GRUB.
If you're multibooting different OS's additional programs can be helpful.

Note the partition names are different in FreeBSD
http://wonkity.com/~wblock/docs/html/disksetup.html.
Once the grub code is written to the boot sector, then you need to run a second command that again depends on your BIOS:
For an MBR bios the second command to configure grub is:
# grub-mkconfig -o /boot/grub/grub.cfg
 

hotaronohanako

Member

Reaction score: 14
Messages: 31

shepper
Sorry. But using pkg I have nothing, and using make, well, it shows me a couple of errors. Like 127, like error 1. I can't do ctrl+c and ctrl+v to show you because I'm using xterm and it doesn't allow me to copy-paste like the traditional terminal or konsole.
Make some efford in reading the documentation you have been refered to ! the info provide is already pretty specific to your case.

rtfm
 

balanga

Son of Beastie

Reaction score: 137
Messages: 3,059

I struggled, but eventually succeeded, it getting the sysutils/grub2 pkg installed on a disk and was able to boot on both UEFI and non-UEFI systems and was able to boot around 10 systems from it. Unfortunately I broke something recently and am struggling to find the right incantations to get it set up again. I did think I had mastered it, but can't figure out what I'm doing wrong in trying to rebuild that disk.
 

drhowarddrfine

Son of Beastie

Reaction score: 1,219
Messages: 3,239

I have not dual-booted in almost 15 years but, when I tried, FreeBSD had its own method that worked quite well. Does that not still exist? If so, why use grub at all?

Of course, I think dual-booting is silly to begin with so I wouldn't know.
 
OP
OP
B

BSDAppentic3

Guest


I only have to add this in grub2.cfg :
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
}
So thanks.
But I need to install it, no more.
 

michael_hackson

Active Member

Reaction score: 83
Messages: 149

Hello! Nice timing with the thread since I am in the middle of setting up grub2 myself.

I have set up a bios-boot partition with gpart assigned as /dev/ada0p4.
Used /sbin/newfs to make a ufs2 and now when I am about to use # grub-install /dev/ada0p4 I get this:
Code:
/usr/local/sbin/grub-bios-setup: error: hostdisk//dev/ada0 appears to contain a ufs2 filesystem which isn't known to reserve space for DOS-style boot.  Installing GRUB there could result in FILESYSTEM DESTRUCTION if valuable data is overwritten by grub-setup (--skip-fs-probe disables this check, use at your own risk).
And when I use the --skip-fs-probe it is said that there is no such option. I found a patch to a Linux binary adding that option in the util/grub-install.in; not really helping my case.

How can I take it further from here? Haven't tried with FAT32 on /dev/ada0p4 yet because the manual for /sbin/newfs_msdos doesn't make it for me at 4:00 AM.

Thanks!
 

michael_hackson

Active Member

Reaction score: 83
Messages: 149

Will add that why I can't stay true to the document in ArchWiki is because I use Legacy BIOS and GPT.
 

michael_hackson

Active Member

Reaction score: 83
Messages: 149

Nvm, I read up properly and have some more things to try out. With more questions I'd rather post a proper thread.
 
Top