How to Fix boot, FreeBSD 14

My 1st post, and I'm trying to follow the rules, sorry if I make any mistakes, as my English is not good.

I'm a beginner at FreeBSD, and knowing how to fix the boot and configure it is the basics of the basics to move on to greater challenges later

MAIN OBJECTIVE: Know how to fix FreeBSD boot

REASONS: I want to adopt FreeBSD as my main system of use. For general desktop use and programming in C, C++. Because I believe that FreeBSD is more stable in relation to changes, more solid, more faithful to the unix system, which I couldn't find in the Linux world.

I have 3 HDs in my notebook:
Hdd0:
nvme 2TB with Arch Linux installed
Hdd1: nvme 512Gb with FreeBSD I'm trying to fix
Hdd2: SSD with another FreeBSD, which can be ignored, I didn't delete it because I need to get some files on it

The Layout I used on the HD was: UEFI, GPT, UFS
nda0p1 = freebsd-boot = 260MB, Fat16 (Created by FreeBSD installer) I fixed it below, because I reported it wrong here
nda0p1 = efi = 260MB, Fat16 (Created by FreeBSD installer)
nda0p2 = freebsd-ufs = 30GB, Mount Point: /
nda0p3 = freebsd-swap = 100GB

How did I lose the boot?
With the other HDs disabled in UEFI, I installed FreeBSD 14 on Hdd1 (512GB). Then I disabled them all and enabled only Hdd0 (Arch Linux), and I needed to fix the Arch Linux boot that uses GRUB.
So again I disabled all HDs, enabling only Hdd1 (FreeBSD 14), and it doesn't boot.

Then my doubts began.
I noticed that the default installation of FreeBSD 14 creates a Fat16 boot partition with the flags esp, boot.
I tried using LicveCD the command:
Code:
bsdinstall bootconfig
It didn't return any errors, but it didn't do anything either

Question 1: Does the FreeBSD installation use GRUB? Or is it a different bootloader?
Question 2: What is the correct way to repair the boot? And what commands should I type to do this?
Question 3: With all the HDs connected, how can I make FreeBSD allow me a menu, where I can choose the operating system to start?

What I understood so far was that from the LiveCd I would have to chroot my system. I have no idea how to do this!
And then use the commands that I don't know to fix the boot, and or, fix the boot and recognize the other operating systems. I have no idea how to do this.

I encountered a lot of difficulty, trying to help with chatgpt, which provided more than 117 answers, all incomplete and with commands that don't exist.
On Google, I only found answers for the ZFS system, and I use UFS. And many answers talk about different methods, which I couldn't understand which is correct.
Obviously because of my difficulty with the English language.

Thank you to everyone who can help by contributing any information!
 
If you are using UEFI then you need ESP partition (EFI partition) but in your post you are having freebsd-boot which is legacy BIOS (CSM) so i'm a bit confused how is your bios configured to boot is it set to boot via UEFI or Legacy BIOS you need to check that first. Then boot using USB LiveCD and show us the output of the gpart show command when you have only the disk with your FreeBSD attached that you want to fix.
 
If you are using UEFI then you need ESP partition (EFI partition) but in your post you are having freebsd-boot which is legacy BIOS (CSM) so i'm a bit confused how is your bios configured to boot is it set to boot via UEFI or Legacy BIOS you need to check that first. Then boot using USB LiveCD and show us the output of the gpart show command when you have only the disk with your FreeBSD attached that you want to fix.
I am using UEFI, GPT
 

Attachments

  • gparted.png
    gparted.png
    40.4 KB · Views: 33
  • boot.jpg
    boot.jpg
    248.6 KB · Views: 31
  • boot-error.jpg
    boot-error.jpg
    661.3 KB · Views: 30
  • gpart-show1.jpg
    gpart-show1.jpg
    652.2 KB · Views: 34
  • gpart-show2.jpg
    gpart-show2.jpg
    323.6 KB · Views: 36
If you are using UEFI then you need ESP partition (EFI partition) but in your post you are having freebsd-boot which is legacy BIOS (CSM) so i'm a bit confused how is your bios configured to boot is it set to boot via UEFI or Legacy BIOS you need to check that first. Then boot using USB LiveCD and show us the output of the gpart show command when you have only the disk with your FreeBSD attached that you want to fix.

FreeBSD is at nda1
 

Attachments

  • gpart-show3.jpg
    gpart-show3.jpg
    233.1 KB · Views: 27
  • hds.jpg
    hds.jpg
    238.9 KB · Views: 22
I needed to show images, because I still don't know how I can post the output in a file, since I don't know how to write it to the FreeBSD boot pendrive. Because I created the Pendriver following FreeBSD instructions and it mounts it as read without any partition available for use
 

Attachments

  • pendriver.png
    pendriver.png
    30.4 KB · Views: 25
In my eyes you also may consider to revisit the partition sizes.
Depending on what you're going to install 30G for / can become a bit tight.
But 100G for swap are definitely overkill.
 
In my eyes you also may consider to revisit the partition sizes.
Depending on what you're going to install 30G for / can become a bit tight.
But 100G for swap are definitely overkill.
There are reasons:
30GB because I use most of the programs running portable on the data partition.
So these 30GB are just the basic system with xorg and xfce

100GB for swap because I do super-compression, even though I have 32GB of RAM at the moment, depending on what is running on the PC at the same time as super-compression, there is a need for 100GB of swap. Because when the RAM memory runs out, if I don't have swap, the system closes the applications that are running, or sometimes it doesn't let me use the PC due to lack of memory.

For normal use, desktop programs only, swap is not required
 
You can fix it by editing your /etc/fstab and change nda0 to nda1. You can do this via the LiveCD by mounting your /dev/nda1p2in /mnt and edit /mnt/etc/fstab or manually boot using ufs:/dev/nda1p2 at the boot prompt and edit it directly from the running system.
 
You can fix it by editing your /etc/fstab and change nda0 to nda1. You can do this via the LiveCD by mounting your /dev/nda1p2in /mnt and edit /mnt/etc/fstab or manually boot using ufs:/dev/nda1p2 at the boot prompt and edit it directly from the running system.

That was the problem. It was incorrectly entered in fstab. This obviously occurred because it was installed with the HD alone, and that's how it was before nda0
 
Your system tries to boot on nda0p2 whereas it should be nda1p2.
Type ufs:/dev/nda1p2 at mountroot prompt.

How many disks do you have? There is also ada0 with a MBR scheme which mimics more or less nda1.
ada0 is an old wrong freebsd installation, it was not deleted because it still has files that I will save. It does not interfere with booting.
As I said in the question, there are 3 discs on laptop.

I didn't understand the command: ufs:/dev/nda1p2
Type it into the prompt resulted in: su: ufs:/dev/nda1p2: not found

Anyway, I solved it by editing fstab
 
Even though the problem is solved by editing fstab, I would also like to know how to solve it by fixing the boot, reinstalling the entire boot, as a problem may occur where there will be a need to reinstall the boot. If anyone knows, and can explain to me how I would fix the boot, reinstalling it from the pendriver, I would be grateful.
 
You can fix it by editing your /etc/fstab and change nda0 to nda1.
apprentice, it's better to use GPT labels in a multi disk environment. That way you don't need to worry about disk names when the boot order of disks change.

A guided Root-on-ZFS installation (but not UFS installation) labels the partitions as follows:
Code:
% gpart show -l
=>       40  500118112  ada0  GPT  (238G)
         40     409600     1  efiboot0  (260M)
     409640       2008        - free -  (1.0M)
     411648    4194304     2  swap0  (2.0G)
    4605952  209715200     3  zfs0  (100G)

GPT labeled /etc/fstab would be:
Code:
/dev/gpt/efiboot0 /boot/efi    msdosfs       rw         2         2
/dev/gpt/zfs0     /            ufs            rw        1         1
/dev/gpt/swap0    none         swap           sw        0         0

To set GPT labels afterwards see gpart(8) modify. Instead of zfs0 ufs0 might be appropiate.
 
I needed to show images, because I still don't know how I can post the output in a file,
For future use, send the file to the https://termbin.com text storage site.

Assuming the system can connect to the internet, when in LiveCD of the installer image, run:
dhclient em0 (change em0 to network interface of your system). This will get an IP from the DHCP server of the internet router.

gpart show | nc termbin.com 9999
This command will send the output of gpart(8) to the text storage site.
 
apprentice, it's better to use GPT labels in a multi disk environment. That way you don't need to worry about disk names when the boot order of disks change.

A guided Root-on-ZFS installation (but not UFS installation) labels the partitions as follows:
Code:
% gpart show -l
=>       40  500118112  ada0  GPT  (238G)
         40     409600     1  efiboot0  (260M)
     409640       2008        - free -  (1.0M)
     411648    4194304     2  swap0  (2.0G)
    4605952  209715200     3  zfs0  (100G)

GPT labeled /etc/fstab would be:
Code:
/dev/gpt/efiboot0 /boot/efi    msdosfs       rw         2         2
/dev/gpt/zfs0     /            ufs            rw        1         1
/dev/gpt/swap0    none         swap           sw        0         0

To set GPT labels afterwards see gpart(8) modify. Instead of zfs0 ufs0 might be appropiate.

Using label is an interesting idea. I managed to learn how to use it and did a test on virtualbox and it works!
 
Back
Top