FreeBSD startup freezes after first install

Robby

New Member


Messages: 11

Sorry for my English...

I've installed FreeBSD (FreeBSD-12.1-RELEASE-amd64-disc1.iso) on a multiboot PC (Legacy, GPT, sda3). All seems well, only the DHCP confiuration doesn't work. I added some static values, and hope to correct DHCP later.
In Grub I added:
Code:
menuentry "FreeBSD Loader" {
    insmod bsd
    insmod ufs2
    insmod part_gpt
    set root=(hd0,gpt3)
    chainloader /boot/boot1.efi
}

FreeBSD starts up for the first time with an error: "can't find /etc/hostid." Then it continues and freezes after the line: Masks:

What did I do wrong? Any suggestions?
 

T-Daemon

Daemon

Reaction score: 939
Messages: 1,832

Please boot the xx-disc1.iso, at the installer "Welcome" dialog change to "Shell", plug in a USB stick, mount it, enter gpart show > /path_to_USB/gpart, post gpart.
 
OP
R

Robby

New Member


Messages: 11

Hi T-Daemon,
Thanks for looking into it. I'm not yet that familiar with the shell commands for FreeBSD. lsblk -l in Linux gives this:
Code:
NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda    8:0    0 232,9G  0 disk
sda1   8:1    0     1G  0 part
sda2   8:2    0   512K  0 part
sda3   8:3    0    50G  0 part
sdb    8:16   0 111,8G  0 disk
sdb1   8:17   0   529M  0 part
sdb2   8:18   0   100M  0 part /boot/efi
sdb3   8:19   0    16M  0 part
sdb4   8:20   0    74G  0 part
sdb5   8:21   0  37,1G  0 part /
sdc    8:32   0 465,8G  0 disk
sdc1   8:33   0    16M  0 part
sdc2   8:34   0 465,7G  0 part /mnt/Data
FreeBSD is on sda3 (sda2 seems to be a FreeBSD boot partition) and the usb is /dev/sdd (Ventoy)

Is this the info you need? If it is not, sorry. To do what you need me to do, should I enter the command: mount_msdosfs /dev/daOs1 media/usb
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,744
Messages: 39,332

should I enter the command: mount_msdosfs /dev/daOs1 media/usb
That would be da0 (that's a zero, not the letter O). The numbering follows the same order on Linux, sda = da0, sdb = da1, etc. Where Linux uses letters, a,b,c,d, etc. FreeBSD uses numbers, 0,1,2,3, etc. Note that we start counting disks from zero.

The s1 is the first partition (in BSD lingo, a slice) of an MBR partitioned disk. You said you have GPT then the partitions are named and numbered as p1, p2, etc. The stick is likely MBR, they often are. You can check with the gpart show command.
 
OP
R

Robby

New Member


Messages: 11

Hi SirDice,
Thanks for explaining that. I've 3 physical HDD's. The one with BSD has GPT. (I had to change it from MBR to GPT because I couldn't get BSD running on MBR).
The USB has on /dev/sdd2 (da3s2 ?) a MBR, FAT16. I thought that after the instillation on the HDD it wouldn't matter any more how the original USB was formatted.
 

T-Daemon

Daemon

Reaction score: 939
Messages: 1,832

I'm not yet that familiar with the shell commands for FreeBSD.
No problem. After booting the ISO, enter "Shell", plug in the USB. There should appear messages regarding the USB device, including the device name and unit number (eg.: da0). Check with gpart show the complete name of the device as SirDice explained.

Execute (replace unit number 0 if necessary):
Code:
# mount_msdosfs /dev/da0s1 /mnt
# gpart show > /mnt/gpart
# sysctl machdep.bootmethod > /mnt/bootm
# umount /mnt
Post gpart and bootm files.
 
OP
R

Robby

New Member


Messages: 11

I'm a bit confused. After BSD boots I get the welcome menu. What should I do next to enter "Shell". Typing a "S" results in starting the single user mode. Using f.i. a <space bar> results in leaving the menu. But "Shell" isn't a command. I googled... Sorry for the stupid question but how do I enter "Shell"?
 
OP
R

Robby

New Member


Messages: 11

Ah, that explains it. Well than I've got a problem... Before that point the system freezes. The last line a see in the boot process is: "Masks ..... ....... ..... ..... "
 

T-Daemon

Daemon

Reaction score: 939
Messages: 1,832

I'm a bit confused. After BSD boots I get the welcome menu. What should I do next to enter "Shell". Typing a "S" results in starting the single user mode.
It's not the "Welcome to FreeBSD" boot menu I meant.

FreBSD-Menu.png


You need to boot the FreeBSD installation image (FreeBSD-12.1-RELEASE-amd64-disc1.iso) from which you installed the system. After finishing boot, the "FreeBSD Installer Welcome" dialog is presented as seen in the screenshot. Choose "Shell" to enter the shell to execute the commands.

FreeBSD-Installer_Welcome.png


After you are done with the commands from post #6, to shutdown the system enter poweroff.

Or does the system freeze happens booting the FreeBSD installation image?
 
OP
R

Robby

New Member


Messages: 11

When I boot from the PC I get this (see photo):

I can however boot from USB and then there is no problem. I can hit the Shell option. But as far as I understand this is not what you want me to do, right?
BSD_boot_1.png
 

T-Daemon

Daemon

Reaction score: 939
Messages: 1,832

When I boot from the PC I get this (see photo):
Don't boot from the PC installed system.

I can however boot from USB and then there is no problem. I can hit the Shell option. But as far as I understand this is not what you want me to do, right?
That's exactly what I want.

Boot from the USB, when the "FreeBSD Installer Welcome" dialog appears (the image with the blue background from post #10) hit the "Shell" option, in the shell execute the commands from post #6, afterwards shutdown system by entering poweroff, post gpart and bootm files.
 

T-Daemon

Daemon

Reaction score: 939
Messages: 1,832

At the GRUB menu choose "FreeBSD loader", press the "E" key to edit the menu entry, set

Code:
menuentry "FreeBSD Loader" {
    set root="(hd0,gpt3)"
    kfreebsd /boot/loader
}

Press Ctrl-X or F10 to boot. If the system boot successful edit the linux GRUB configuration accordingly.
 
OP
R

Robby

New Member


Messages: 11

If I do it the way you describe it results in a black screen. If I really update grub than it results in Error: file ‘boot/loader’ not found. So far I can only start BSD with chainloader /boot/boot1.efi or chainloader /boot/loader.efi
 

T-Daemon

Daemon

Reaction score: 939
Messages: 1,832

I'm away and will be away for some time from my systems, can not test in place.

You could use Supergrubdisk2
to determine the correct GRUB menu entry:

Install [ 1 ] the image on a USB stick, boot that stick, let Supergrub2 detect FreeBSD. There will be multiple menu entries for FreeBSD, test the EFI detected. If that doesn't work try the others.

If FreeBSD boots well, reboot into Supergrub2, choose the menu entry booting well, press the 'E' key to enter into editor mode, copy the entry into the on PC installed GRUB's custom configuration file. If you have difficulties following the instructions please ask.

[ 1 ] dd if=super_grub2_disk_hybrid_2.04s1.iso of=/dev/da0 bs=1m conv=sync

Make sure /dev/da0 is the USB stick, change the unit number (0) if necessary.
 
OP
R

Robby

New Member


Messages: 11

I think we are making some progress. This is what supergrub2 makes of it:
Code:
setparams ‘FreeBSD (ufs2 hd1,gpt3) (Default boot loader)’hd1,pgt3’ ‘5ffae7bddec55b14’

set root=”$2”

kfreebsd bootloader

Supergrub2 can start FreeBSD. But I have some problem to set this code to the 40_custom file. This code results in "error: unknown filesystem."

Code:
menuentry "FreeBSD" {

insmod ufs2

set root=(hd1,gpt3)

kfreebsd /boot/loader

}

How should I adjust it?
 

T-Daemon

Daemon

Reaction score: 939
Messages: 1,832

setparams ‘FreeBSD (ufs2 hd1,gpt3) (Default boot loader)’hd1,pgt3’ ‘5ffae7bddec55b14’
set root=”$2”
kfreebsd bootloader
If that's the exact menu entry in Supergrub2 for FreeBSD, set in the 40_custom file:
Code:
menuentry "FreeBSD" {
   set root=(hd1,gpt3)
   kfreebsd bootloader
}
 
OP
R

Robby

New Member


Messages: 11

setparams ‘FreeBSD (ufs2 hd1,gpt3) (Default boot loader)’hd1,pgt3’ ‘5ffae7bddec55b14’
set root=”$2”
kfreebsd /boot/loader

If forgot the / in boot/loader. Sorry. After I add the / in your code, I get the error "unknown filesystem". Because BSD is on hd0,3 and not on hd1,3 I've tried also hd0,gpt3 resulting in a black screen. I'm ready to give up...
 

W.hâ/t

New Member


Messages: 3

You can try this
Code:
menuentry {
    setroot=(hd0, gpt3)
    kfreebsd=/boot/kernel/kernel
}
Or this (not sure this is a working configuration)
Make sure that you have the bootcode written in the freebsd-boot partition.

gpart bootcode -b /boot/pmbr -i 2 -p /boot/gptboot ada0
Code:
menuentry {
    set root=(hd0, gpt2)
}

Look at this thread: https://forums.FreeBSD.org/threads/how-do-i-configure-grub2-to-boot-freebsd-11-1.65992/

If none of this work, you can try to reinstall. Don't give up. FreeBSD is one of the best OS I know!
 
Top