UFS Unable to boot FreeBSD

balanga

Son of Beastie

Reaction score: 137
Messages: 3,059

Some time ago I installed Ubuntu into some free space on a disk which had FreeBSD on it. Ubuntu installed Grub but did not include an entry for FreeBSD. In an attempt regain boot access to FreeBSD I ran boot0cfg() hoping it would provide boot options for both FreeBSD and Ubuntu. Instead, the boot prompt consists of:-
F1 ?
F6 PXE
Boot: F1
Pressing F1 simply produces "###'s"

If I boot from a Super Grub USB stick I can select either Ubuntu or FreeBSD.

What should I do to get a boot menu installed on the hard disk?
 

T-Daemon

Well-Known Member

Reaction score: 100
Messages: 297

You could boot from Super Grub into Ubuntu and run from there grub-install /dev/sdX [ 1 ] to install Grub again, afterwards edit /etc/grub.d/40_custom file, insert the FreeBSD menu entry (example here, pick from Super Grub, or web search), run update-grub [ 2 ]. This will genarate a /boot/grub/grub.cfg file with the FreeBSD menu.

If you have problems booting FreeBSD from Grub, choose the menu entry, press 'e'. This will display the menu entry code. There you can change the settings and try the code without the need to edit the 40_custom file. Aftere the settings are right modify them in the custom file, run update-grub again.

If grub has problems finding the FreeBSD root device, drop at the Grub menu into grub command line pressing 'C', typing 'ls' will display all available devices. Pick the FreeBSD root device, return to the FreeBSD menu entry, hit 'e', modify root device, try new settings, modify 40_custom file, run update-grub.

[ 1 ] grub-install
[ 2 ] update-grub
Grubs list of command-line and menu entry commands
 
OP
OP
B

balanga

Son of Beastie

Reaction score: 137
Messages: 3,059

I booted Ubuntu from the Super Grub USB stick, ran grub-install /dev/sda, edited /etc/grub.d/40_custom , ran update-grub, rebooted, but the system booted

Now if I boot from the Super Grub USB stick it doesn't find any bootable partitions and if I go to the grub> prompt and type ls it returns
error: disk 'hd0' not found.
Something is well and truly fu'ed.

I guess I'll try reinstalling the FreeBSD bootloader.

Thinking about the problem... I should probably have specified '--target' when running grub-install....
 

T-Daemon

Well-Known Member

Reaction score: 100
Messages: 297

I'm sorry my suggestion cause more trouble then helped. What comes to my mind is that the boot code took damage somehow, but I'm guessing here. According to boot0cfg(8) it was designed for i386 machines. To my understanding not for an amd64. If you have a amd64 machine and you installed boot0cfg, if this is even possible, that might caused the trouble. And is the machine BIOS or UEFI. If it's UEFI that needs to be specifide installing Grub. You could try restoring the boot code and try Grub again.
 
OP
OP
B

balanga

Son of Beastie

Reaction score: 137
Messages: 3,059

I'm sorry my suggestion cause more trouble then helped.
No worries. Thanks for the suggestion. It's all part of the learning curve. For the time being I restored the FreeBSD bootloader

gpart bootcode -b /boot/pmbr -p /boot/gptboot-i 1 ada0

Ubuntu was just an experiment. It's already installed and I may try booting it by installing sysutils/grub2, or TrueOS's boot manager.

The main problem I have at the moment is trying to get it to boot on a ThinkPad X220 which has a BIOS bug preventing FreeBSD booting from a GPT partition - see Thread 70865 Maybe a boot manager can overcome the problem.
 
Top