For further discussion: why booting via USB is problematic.

Hello Guys !!

I would like to create a complete copy of the FreeBSD on a USB disk drive so to have a bootable device to use "on the fly" for some needs.

To do this, I've installed FreeBSD onto it, disconnected it from the system where I generated it, so that I can connect it to the "system under test", and boot from it when I need.


As USB drive I choose two devices:

1 - A USB stick

2 - A SATA Hard Disk using an external sata-to-usb case (as depicted by the attached photo).

(I've installed the FreeBSD from my usual installation DVD).


IMG_20180912_105314.jpg


To boot from my USB drive I usually inform the BIOS, setting the USB drive as booting drive.

However, booting via USB is sometimes problematic.
It happens that the booting process works for some PC's and doesn't start on some other platforms. The boot process seems to stop.

This is very strange.


VERY IMPORTANT NOTE ABOUT THE INSIDE HARD DISK OF THE PC:
It must remain a not mounted memory device.


QUESTION.
Tips are welcome.
 
Last edited:
A more likely scenario is that the disk isn't named the same on different systems. So it might be ada0 on one system but da0 on another.

The boot from hard disk is not completely performant on all the platforms. There are machines where the boot from HD doesn't work on every machine.
"It doesn't work" doesn't tell us much, what exactly doesn't work? Can't even boot? Failing to mount partitions?
 
If I understood, you installed FreeBSD on a SATA disk connected to a SATA controller (inside of the PC), the removed from the PC and enclosed into an external sata-to-usb case .

If this is the case, the problem is because the names of the devices are different when connected to a SATA controller (adaX) o by USB (daX).

You need to use labels in the /etc/fstab file to avoid this problem.

Connect again the disk to the SATA controller in the PC and boot FreeBSD

Confirm that the file /boot/loader.conf contain glabel_load=”YES”, if not add it.

Use tunefs(8) to assign labels to all the partitions, example: tunefs -L [COLOR=Red]rootfs[/COLOR] /dev/ada0p1

Change the reference to all devices in the /etc/fstab file, example:

Rich (BB code):
# Device           Mountpoint   FStype  Options   Dump   Pass#
/dev/ufs/rootfs   /             ufs     rw        1      1

More info in 18.7. Labeling Disk Devices
 
If I understood, you installed FreeBSD on a SATA disk connected to a SATA controller (inside of the PC), the removed from the PC and enclosed into an external sata-to-usb case .
No ! Never !
I've installed FreeBSD on a SATA disk puts inside an external sata-to-usb case and connected to the usb port of the PC.
Exactly what he said.

On the machines where it correctly boots as system disk, it is seen as da0, that is the label assigned by default by the installation process. I generally install FreeBSD by a DVD.
That (da0) is not a label. It's a disk device node. For a USB-connected device: your SATA disk in its USB enclosure.

Labels help you avoid booting problems when changes in device types (ada0 vs da0) and order (da0 vs da1) occur.
 
A more likely scenario is that the disk isn't named the same on different systems. So it might be ada0 on one system but da0 on another.

If I understood, you installed FreeBSD on a SATA disk connected to a SATA controller (inside of the PC), the removed from the PC and enclosed into an external sata-to-usb case .

If this is the case, the problem is because the names of the devices are different when connected to a SATA controller (adaX) o by USB (daX).


When the scenario you described happens, the FreeBSD notifies the disk is not named the same on different systems and stops the boot phase showing the mountroot prompt, as you can see in the attached picture.

IMG_20180913_172400.jpg



So it is not a label problem in this case.


What is the output of gpart show da0
Share us the content of your /etc/fstab


When a PC can correctly boot from USB the

gpart show and /etc/fstab are congruent as you can see below in the picture.

IMG_20180912_162335.jpg




So , please, let me give a proposal solution:

the problem to correctly boot from USB is correctly set the BIOS'es parameters.
If they are not correctly setted to boot from USB, there could be problems and the boot process doesn't start.


QUESTION.
Is it possible do more strong and predominant the USB boot process ?
Like it happens when you boot from an internal installation DVD.
It seems that the DVD controller is predominant on USB controller.
 
When you boot in the other PC, where it stop? Do you see something on the screen?
You are booting from a USB with MBR scheme, are both PC BIOS or UEFI?
 
Hello Martin !

where it stop
Immediately after I finished to press the power on button.

Do you see something on the screen?
Yes, a black screen.

You are booting from a USB with MBR scheme
Yes.
are both PC BIOS or UEFI?
Both PC BIOS.


Comment:
I was happy if you can confirm a BIOS instability or a wrong configuration setting.
I don't think that is a FreeBSD instability.
I've seen that correctly configured, the second/third times I push the power button, the USB starts (the FreeBSD starts to boot from USB).
BIOS and UEFI microcode are out of my experience zone.

Note: I'm speacking about a series of 50 brand new PCs Fujitsu Esprimo (Intel Core i5, 7th Gen).

QUESTION (surely is a out of mind question).
Is it possible do more strong and predominant the USB boot process over other booting peripherals ?
Like it happens when you boot from an internal installation DVD.
It seems that the DVD controller is predominant on USB controller.


Could be usefull read:

USB Devices stop BSD from booting?

ralphbsz says:
"Completely not normal .....
Either your motherboard is borken, or your BIOS is misconfigured, or you are using a kernel build that is borken, or one of your USB devices is borken. "


Bye bye !!!!
 
I was happy if you can confirm a BIOS instability or a wrong configuration setting.
I don't think that is a FreeBSD instability.

Install BootEasy /boot/boot0 with gpart bootcode -b /boot/boot0 da0

Booting the other PC with BootEasy should displays something like

Code:
F1 FreeBSD

Default: F1

If you see that in your screen, then the BIOS did it's job (read sector 0 of disk and run that code).

Selecting an option, make the sector 0 (/boot/boot1) of the slice/partition to be read and executed. This part and the rest of the boot process is FreeBSD specific.

If the black screen continues, then the BIOS/UEFI bootstrap y hanging (wait for 30 min to see if the boot process continues).

More info in BootEasy: https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/boot-introduction.html#boot-boot0

Note: I'm speacking about a series of 50 brand new PCs Fujitsu Esprimo (Intel Core i5, 7th Gen).

Brand new?, then, all of them should be UEFI, you can find a lot of information about UEFI here

Could be usefull read:

USB Devices stop BSD from booting?

@ralphbsz says:
"Completely not normal .....
Either your motherboard is borken, or your BIOS is misconfigured, or you are using a kernel build that is borken, or one of your USB devices is borken. "

For me, the problem in that post is with the BIOS/UEFI code (a timeout to long), an update to the BIOS/UEFI should be tried and if the problem persist the manufacture should be contacted.

A PC with Windows 7 in the job has the same problem, it is configured to boot from HHD, but if a USB stick is connected when the PC is power on, it hang (the user has 3 USB connected)

The problem was with 1 specific USB (the PC can boot from HDD with the other 2 USB stick connected)
 
For me, It is UEFI

If you read, there is a line "Compliancy UEFI 2.5; PI 1.4".

most EFI-based x86-64 computers provide a Compatibility Support Module (CSM), which is essentially a BIOS emulation mode. Some EFI implementations are in fact built atop a conventional BIOS, and retain BIOS's boot abilities via this underlying code. Thus, it's possible that you're currently booting a modern EFI-capable computer in BIOS mode.

Check that it is configured in BIOS mode

I would prefer to stay in the UEFI mode (disable the compatibility), but that implies changing everything (you need GPT, an EFI partition an use the EFI code that is in FreeBSD, an other post is recommended).
 
I have encountered some USB devices that take a really long time to enumerate, and I have also encountered some BIOSes that are buggy about enumerating slow USB devices (they don't wait long enough).

I have had some success in the scenario you describe by setting this flag in /boot/loader.rc:
Code:
set kern.cam.boot_delay=10000

This might help; as I say, it has worked for me sometimes.
 
Back
Top