Hello everyone. I have a computer with Windows, Arch and Lubuntu and all these systems are booting from a Multi-Boot. Recently, I decided to download freebsd for some tests and decided to put the OS in my multi-boot. I allocated 20 GB, installed in UEFI/GPT and made 3 partitions from UFS installation: freebsd-boot, freebsd-swap and freebsd-ufs. When I boot the GRUB or rEFInd or Boot Priority from BIOS MENU, the freebsd doesn't appear, even installed on my computer. I opened gparted on Lubuntu and the 3 partitions (ufs, boot and swap) appear without any problem.

Using the single user in FreeBSD installer, I executed these two commands:

gpart set -a active /dev/ada0
gpart set -a bootme -i 13 /dev/ada0 (my freebsd-boot is installed on ada0p13)

Now Windows, Arch and Lubuntu boot systems do not appear in the BIOS menu, although nothing from the HD was deleted.
I believe the freebsd boot is forced to be in the top position at boot, but no system now boots, including freebsd.

Can I recover other OS boots besides freebsd, without needing to format the entire HD and be able to boot freebsd?

Sorry if this sounds like a noob question, because as the HD partitions hasn't been deleted, to recover the files I can use a Linux distro and access the partitions without any problem (if there is no other way to fix).

I used the commands from these links:
 
For UEFI boot you need to copy /boot/loader.efi to the efi partition. Typically saved as EFI/BOOT/BOOTx64.EFI, but you might have other files there already for Windows and/or Linux. So save it as FreeBSD.efi for example and configure rEFInd to load it. Another option is to use efibootmgr(8) (Linux should have a similar tool) and configure EFI to load the correct loader.

The freebsd-boot partition is for a traditional CSM boot.
 
For UEFI boot you need to copy /boot/loader.efi to the efi partition. Typically saved as EFI/BOOT/BOOTx64.EFI, but you might have other files there already for Windows and/or Linux. So save it as FreeBSD.efi for example and configure rEFInd to load it. Another option is to use efibootmgr(8) (Linux should have a similar tool) and configure EFI to load the correct loader.

The freebsd-boot partition is for a traditional CSM boot.
then for some reason while I was trying to fix the boot issue, the computer lost booting operating systems. Do you have another suggestion that can be done by the shell installer? Because it doesn't seem to be able to access /boot/loader.efi
 
I'm guessing that, because you included a freebsd-boot partition, your FreeBSD install did not put an entry in your main drive's EFI partition, and so will probably need to be re-done. In other words, your FreeBSD install is trying to use MBR booting instead of UEFI booting, whereas all your other installs are still trying to use UEFI booting. I'm also guessing that something you've done has switched one of your BIOS settings away from using EFI booting methods, over to using the legacy MBR booting protocols, and that's why you no longer see their entries in your BIOS boot menu.

I have a multi-boot system with UEFI booting, and Windows 10 plus several FreeBSD, Debian, Ubuntu, and Linux Mint installs, all installed on different GPT partitions, and bootable via the Debian 10 install's grub2 menu. Right now I'm running my system from the freebsd-ufs partition on partition 10, and you can see my UEFI boot partition on /dev/ada0p2, and my root (/) partition on /dev/ada0p10, in the following df output:
Code:
root@mate:~ # df
Filesystem   1K-blocks     Used   Avail Capacity  Mounted on
/dev/ada0p10  24361884 15875004 6537932    71%    /
devfs                1        1       0   100%    /dev
/dev/ada0p2     262152    43748  218404    17%    /boot/efi
Notice the "Mounted on" /boot/efi column for partition 2.

When I look at the boot options menu for my EFI booting scheme in the BIOS setup, I see entries for "Windows Boot Manager", "FreeBSD", "debian", and "ubuntu". When I look at ls output for my running FreeBSD system, I see the following directories in my /boot/efi path:
Code:
root@mate:~ # cd /boot/efi
root@mate:/boot/efi # ls -l
total 16
drwxr-xr-x  1 root  wheel  4096 Dec 21  2014 BOOT
-r-xr-xr-x  1 root  wheel   512 Jan 22  2016 BOOTSECT.BAK
drwxr-xr-x  1 root  wheel  4096 Dec 21  2014 EFI
drwxr-xr-x  1 root  wheel  4096 May 23  2018 System Volume Information
root@mate:/boot/efi # cd EFI
root@mate:/boot/efi/EFI # ls -l
total 20
drwxr-xr-x  1 root  wheel  4096 Dec 21  2014 Boot
drwxr-xr-x  1 root  wheel  4096 Dec 21  2014 Microsoft
drwxr-xr-x  1 root  wheel  4096 Apr  4 21:03 debian
drwxr-xr-x  1 root  wheel  4096 May 28 08:02 freebsd
drwxr-xr-x  1 root  wheel  4096 Mar 29 13:56 ubuntu
root@mate:/boot/efi/EFI #
These last 4 directories all have corresponding entries in my BIOS boot option menu. They were put there by each system's installers. All my FreeBSD installs share the same freebsd directory/entry. Windows 10 uses the Microsoft entry, Debian 9 and Debian 10 installs use the debianentry, and Ubuntu and Linux Mint share the ubuntu entry. Whichever Linux was the last one installed is the one which winds up "owning" the associated directory.

If I were in your situation, I'd try to reinstall FreeBSD, this time deleting and omitting the freebsd-boot partition from the install. Use the bsd installer to "M"odify the EFI partition, changing nothing in it, but making sure that it starts showing the mount path of /boot/efi for that partition in the partition menu, before committing your changes. That way you can be reasonably certain that it's doing an EFI install instead of an MBR-type install. Take extra care not to delete or modify your EFI partition!

Afterwards I would use Debian to reinstall grub2, and add the following menuentry to /etc/grub.d/40_custom in order to boot FreeBSD:
Code:
menuentry "FreeBSD" {
  insmod ufs2
  root=(hd0,gpt10)
  chainloader /boot/loader.efi
}
You may prefer to use Arch Linux or some other Linux for this purpose. I use Debian. Sometimes it might be necessary to reinstall Debian also, but usually not. I would not use Ubuntu or a derivative for this purpose, because Ubuntu will no longer boot FreeBSD for me, but that's a subject for a different topic, and it's a topic which likely might not be appropriate for this forum in any case, anyway.

Edited to add: Instead of root=(hd0,gpt10) you will likely need to specify some other partition number.

Edited again: Probably the best thing to try first is just check your BIOS to see if it's been switched over from EFI to legacy or MBR booting protocols. All this stuff is risky-- good luck!
 
Suggestion: (or what I would try in such situation). Anyway, hard to affirm that you can just follow some recipe to fix your particular situation.

1- Check what boot mode is configured in the firmware (old BIOS menu) if UEFI or Legacy, or mixed (UEFI with CSM e.g.). Change that to UEFI exclusively.
2- Boot Ubuntu (or Lubuntu I dont know) from a recovery/live CD.
3- While in the prompt check your GPT partitions sanity with gdisk.
4- While in Ubuntu Check the presence/sanity of your UEFI partition. You need at least (and preferably) one UEFI partition to chainload boot all the OS's you have installed. Can try 'How to restore Ubuntu’s EFI partition' tutorials if need.
5- While in Ubuntu check computer's firmware entries sanity/presence using 'efibootmgr' command. You can try checking/adding for windows boot entry too (considering your UEFI partition was not damaged previously)
6- While in Ubuntu reinstall grub (in EFI mode)

If you managed to restore Ubuntu/Lubuntu boot:
You can try booting from a Windows recovery CD to restore Windows boot. This can override your Ubuntu boot I think (not sure). Anyway at this point you had checked already for disk sanity, firmware sanity etc. So just boot ubuntu and recovery grub again with the live CD to have both (ubuntu/windows) working.

7- In Ubuntu delete all the FreeBSD partitions (you dont need a freebsd boot partition in EFI mode). Recreate 2 partitions one for file system other for swap. You can share a single swap partition for ubuntu and freebsd if you want to.
8- Install FreeBSD. I suggest formatting/installing as UFS file system (for simplicity). When prompted to install a boot manager choose NO if:

... if you decide doing like me: For simplicity I prefer booting FreeBSD from grub (instead of the EFI partition directly). So after installing FreeBSD in this way:

9- Boot Ubuntu again and edit /etc/grub.d/40_custom, adding a entry for FreeBSD. What works for me is:

Code:
menuentry "FreeBSD" --class freebsd --class bsd --class os {
insmod part_gpt
insmod ufs2
insmod bsd
chainloader (hd0,gpt5)/boot/boot1.efi
boot
}

10- Do 'update-grub' command to update/add the freebsd option.

Hope everything is fine :) good luck
 
WhatsApp Image 2021-07-07 at 5.52.51 PM.jpeg


Yeaaaah...
I reinstalled all OS in my computer and installed FreeBSD Boot on same partition as Windows Boot Manager, but still not working. It doesn't find the FreeBSD UFS partition (in this case, /dev/sda9), despite adding the FreeBSD option to GRUB.

1625694308617.png


1625694398893.png


On file /etc/grub.d/40_custom, I tested the 2 forms of FreeBSD menuentry (the posts DanDare Vull )
 

Attachments

  • 1625694237682.png
    1625694237682.png
    20.5 KB · Views: 142
On file /etc/grub.d/40_custom, I tested the 2 forms of FreeBSD menuentry (the posts DanDare Vull )
The problem looks like it might be the space after the comma in root=(hd0, gpt9) ... I would try changing that to root=(hd0,gpt9) with no spaces, and change chainloader /boot/loader.efi to chainloader /boot/boot1.efi ...

I don't have Lubuntu, but got this to work on Linux Mint 20.1, which is a derivative distribution of Ubuntu 20.04:
Code:
menuentry "FreeBSD-13.0-RELEASE" {
  insmod ufs2
  root=(hd0,gpt10)
  chainloader /boot/boot1.efi
}
... You might also find this thread interesting: Thread how-do-i-configure-grub2-to-boot-freebsd-11-1.65992

Edited to add: Hello again, megarubber. I followed T-Daemon's advice in the thread linked above, and changed /boot/boot1.efi to /boot/loader_4th.efi in my Linux Mint 20.1 boot-loader /etc/grub.d/40_custom file. It indeed does work better this way-- it is faster, works without generating error messages, and is capable of booting multiple FreeBSD partitions from a single boot menu, so I now would recommend using this menuentry instead of the one I previously recommended:
Code:
menuentry "FreeBSD" {
  insmod ufs2
  root=(hd0,gpt9)
  chainloader /boot/loader_4th.efi
}
Thanks for the follow-up post and I hope it all goes well for you.
 
Last edited:
Back
Top