Non-system disk on non-UEFI systems when booting from USB

I would like to try FreeBSD after I tried out Linux. I have tested FreeBSD earlier on VirtualBox, and it succeeded. I have created my FreeBSD USB using dd as my first attempt on Kali Linux, following the tutorial. I have used FreeBSD-13.0-CURRENT 2019/2/28 memstick.img as my release for testing purposes.

Now here comes the problem. When attempting to boot to USB on my old computer that only supports BIOS, it tells me that the disk that I am booting from isn't a system disk, and to restart, I have to press any key, which leads to booting to the HDD. Output:

Code:
Non-system disk
Press any key to reboot

I thought that was the dd problem, but before doing it in win32diskimage on my Windows XP, I checked the partition table on Kali, and saw that there are 2 partitions: EFI, and FreeBSD. I then tried to make my bootable USB using the app aforementioned after I wiped every partition out using Rufus, and I even checked the SHA256 sum, and they're the same as one provided in the website.

I rebooted to my USB, and it still yields the same error as described. Could it be that my memstick.img doesn't support BIOS? Or can I build the memstick.img with BIOS support without going to FreeBSD? I need suggestions to get it to work on my PC.
 
Hi,

Recheck the image you downloaded and commands you used to transfert on your USB stick.

As far as I know, memstick images are bootable under BIOS.

I would have tested the 12.0-RELEASE... The latest CURRENT is highly experimental and can lead to numerous problems.
 
Just tested FreeBSD-13.0-CURRENT-amd64-20190221-r344398-memstick.img under bhyve. It boots under legacy BIOS (and under UEFI as well).
 
Yes, I have read the handbook, and the dd command that I used is the same as one described in a handbook. But how can I make it work under legacy BIOS?
 
Has your "old computer" ever successfully booted anything from a USB stick or that particular USB stick? Just asking cause I already encountered two old-ish mainboards who would not only refuse to boot from an USB stick but where the BIOS also completely froze when a USB stick was plugged in when booting. The same USB stick booted just fine on two other machines though. After having tried two different USB sticks (USB 3.0 / 2.0) and a myriad of BIOS settings, I finally had to revert to lending my other machine's CD drive and boot FreeBSD 12.0 install from CD.
 
It can boot USB successfully. I have tested several Linux distros and it worked. In order for the USB to show on Boot Menu, the following conditions should be met for my PC:
  • The USB stick should be on the front side
And for the USB to boot correctly, below criteria should be met:
  • USB should be formatted using FAT32 and have a valid boot sector
  • The partition table should be MBR
 
In the 13-CURRENT memstick image you have:

- MBR scheme:
---- [slice1] efi partition (which is a FAT partition but used only for UEFI booting as the name suggests).
---- [slice2 - active] freebsd:
---------- (a) freebsd-ufs (where lies all the system)

I don't see why a BIOS would search a FAT partition before to load the MBR. It just verifies if the MBR has the magic number at its end and sometimes checks if there is an active partition.

The partition scheme (MBR) has nothing to do with file system. Normaly MBR has to be loaded in memory and its boot program executed. Then this code looks for the active partition, load the boot code it finds inside and execute it.

I'm afraid I'm as lost as you.
 
Thank you! I did a partition table listing the last time, and the boot flag was set to UEFI partition. Could setting the boot flag on the freebsd partition help?
 
Yes, and that is maybe the trick. The message you get seems to come from the efi partition.
Non-system disk
Press any key to reboot
As I dump the memstick image, I can see it in the second sector of the disk. I think this is a sort of MBR that prevent to go further in such a case.

That said, if you'd dd'ed the image, you would have the freebsd partition active.
 
OK. I will try to make my FreeBSD partition active after a test. Thank you so much! I will tell you the results.
 
I have set the boot flag as FreeBSD instead of UEFI partition, and it worked on my alternative laptop which is newer (2009), but my old computer still can't boot FreeBSD from USB! It says:

Code:
Non-system disk
Press any key to reboot
 
Maybe it's your old computer which activate the efi partition. After a try on this computer, does the USB stick boot well on your laptop?
 
Yes. It boots well. It shows me the FreeBSD boot screen and when I press Enter, the kernel starts and everything is probed, then it shows me whether to choose Install, or Live CD. The mouse even worked and it showed me a cursor, so my Wireless Mouse is detected. But my main goal is booting FreeBSD on my old PC.

Should I try to boot FreeBSD if the boot flag is set to FreeBSD partition with Plop Boot Manager?
 
You can. :) But until we understand what your old PC does or expects, it's probably in vain.

I installed FreeBSD 12-RELEASE on a Pentium-II 266 based PC (which can't even boot on USB) and it was funny. Once the install done (via cd-rom), the machine didn't allow the hdd to boot because its "MBR" did not have an active partition. In fact, it was the protective MBR of a GPT scheme which actually expose one fake partition but that one hasn't the active flag set. I was obliged to use fdisk in order to make things eventually work.

In your case, it's difficult to guess what your PC does. If I had such a problem, I will modify the MBR program of the USB stick to print something on the screen (or simplier: make the computer hang). Then I will know for sure if it loads the MBR or not.

After that, I will have more ideas about what happen.
 
Last edited:
Thank you! I have installed Plop Boot Manager alongside the Windows XP, and tried to boot from USB using the EHCI driver, but that made Plop freeze, so I tried to force USB 1.1 drivers to load, and it booted successfully, just to find that I have reached to the point where the loading animation, before the FreeBSD intro screen before boot selection, spins for a bit and then freezes. I checked if my entire PC was frozen using Numlock key, and the LED turns on and off normally. Why woud it freeze?

I think the suspect is my BIOS itself. My laptop has detected my USB flash drive as USB HDD (Hard Disk Drive), whereas my PC detects the USB flash drive in the front side as USB RMD-FDD (Floppy disk drive) and if I try to put my USB on the back side, even with non-essential USB devices connected, the BIOS can't see my flash drive with the Legacy USB storage enabled, so I think that's why my laptop would display the FreeBSD installation screen whereas my PC would only tell me that:

Code:
Non-system disk
Press any key to reboot

I will debug the problem if it worked or not using Plop. Which tool allows me to modify the MBR program on the USB flash drive to add some printing codes to see if my PC would load MBR or not?
 
I don't know how Plop Boot Manager works, so I can't answer to your question.

Modify the mbr program of the image file is trivial under FreeBSD. But a disk editor under Windows is more convenient.

Let's hang the mbr code by inserting an infinite loop at the beginning. The assembly is jmp -2. The corresponding machine codes are 0xEB, 0xFE. Simply replace the first two bytes of the memstick image file with 0xEB, 0xFE. Then, you flash your USB key with the modified file.

Under FreeBSD this would be: printf '\353\376' | dd of=image.img bs=2 count=1 conv=notrunc

\353\376 are the octal writings of hexadecimal bytes 0xEB, 0xFE.
bs=2 count=1 for transfering 2 bytes.
conv=notrunc to avoid the ouput file from being truncating after the two bytes.

If your PC displays nothing but a blinking cursor when it tries to boot the modified key, that means it really loads and executes the mbr code. Otherwise, if the output remains the same, this comes from the BIOS.
 
About the Plop Boot Manager thing, I will do some troubleshooting after the hanging one.

About the hanging thing, I made this image using the command that is provided using my Android in Termux because Android is based on Linux. It has all necessary commands like printf, dd, etc.

I burned this image to my USB so the first 2 bytes are modified, retaining the FreeBSD and UEFI partitions, and when I tried to boot from it on my laptop (USB HDD), it only shows the white blinking underscore and hangs. However, I tried to boot from it using my PC (Using both USB RMD-FDD and Plop Boot Manager), it only shows the white blinking underscore and hangs.
 
I burned this image to my USB so the first 2 bytes are modified, retaining the FreeBSD and UEFI partitions, and when I tried to boot from it on my laptop (USB HDD), it only shows the white blinking underscore and hangs. However, I tried to boot from it using my PC (Using both USB RMD-FDD and Plop Boot Manager), it only shows the white blinking underscore and hangs.

Very interesting. That means we can have a control on what happens.

But I have to suppose the BIOS is setting as active the efi partition on the MBR image in memory (and deactivate the freebsd one)... Weird.

I can verify what occurs if I set manually the efi partition as active. I think I will reproduce what you get.

More than that, it's possible to modify the MBR boot code to make it load the freebsd partition no matter if it is active or not. I will try this.
 
Thank you! But, how can I modify the MBR boot code so it will load the FreeBSD partition, no matter if it's active or not? and what is a command to do so?
 
I will, if you leave me some hours / days. Then, I'll give you the new MBR in binary form, so you can patch your memstick image file with dd or the like.
 
OK. Thanks so much! BTW if the new MBR file is finished, should I run like this? Suppose that my USB flash drive is located in /dev/sdb:
dd if=/path/to/mbr.bin of=/dev/sdb
Or should I add extra arguments?
 
Be extra careful with that. The partition table sits right after the MBR code (offset 446). The first 512 bytes of the disk contains both the MBR and your partition tables. Screw up the partition table and your data is gone. Not entirely gone, if you can restore the partition table everything would still be there. But still a pain to have to go through, especially if you don't have a backup of the original partition tables.


Unfortunately UEFI hasn't been added yet but the classic BIOS boot (CSM) is described in the handbook: Chapter 12. The FreeBSD Booting Process.
You will also find lots of information in boot(8), gptboot(8), loader(8) and UEFI(8).

Mandatory reading regarding -CURRENT: Topics about unsupported FreeBSD versions
 
I will try to be extra careful. Also, I have a backup of the memstick.img so that anything goes wrong, I will use it to restore the stick to its original state. Once I finish the Live USB that has CURRENT, I will immediately move to STABLE or RELEASE.
 
Back
Top