Is it possible to create a bootable FreeBSD media using only a partition of a USB stick?

Pretty much what the title says. I do have a USB (sdc). I created two partitions. The first one (sdc1) is formatted to ext4 and the second one (sdc2), I let it be used as the partition to create bootable images. I had the idea, literally right now after Ventoy failed to boot FreeBSD (14.0), and after I searched on the internet that this is possible (tho, no instructions on how to do it, so I simply figured it out myself). I "burned" the FreeBSD ISO, using the instructions shown in the Handbook, using dd and sdc2 as the option of "of".

Now, I am able to boot using the second USB partition, but FreeBSD shows the output in the image I have attacked. Isn't that possible with FreeBSD or I did something wrong? Anyone else was able to achieve what I tried? Thanks for the help, and let me know if you need more information to be provided!
 

Attachments

  • freebsd_error.jpg
    freebsd_error.jpg
    1.9 MB · Views: 38
I am able to boot using the second USB partition, but FreeBSD shows the output in the image I have attacked. Isn't that possible with FreeBSD or I did something wrong?
I "burned" the FreeBSD ISO, using the instructions shown in the Handbook, using dd.
I assume the iso was copied into partition sdc2.

What happened here is that the FreeBSD loader (from sdc2) can't find a kernel to load. I suspect the loader can't handle such a disk topography.

Try following: At the 'OK' loader prompt enter lsdev, look for the FreeBSD partition, set the default device , i.e. set currdev=disk2p2 (or similar), then boot.

I think, if you create a ESP (EFI System Partiton) on the USB disk and copy loader.efi(8), that should boot the FreeBSD installer.
 
I assume the iso was copied into partition sdc2.

Yes! Sorry for forgetting to mention it. I updated the post to make it more clear to everyone else.

Try following: At the 'OK' loader prompt enter lsdev, look for the FreeBSD partition, set the default device , i.e. set currdev=disk2p2 (or similar), then boot.

Thanks! I did, and it boots, so there is progress! I do however get errors and the system automatically reboots at some point (where I cut the video). The error can be seen here, in case you can understand something. I had the same error (from what I remember) with Ventoy.

I think, if you create a ESP (EFI System Partiton) on the USB disk and copy loader.efi(8), that should boot the FreeBSD installer.

How will I get this file, by unpacking the ISO? After than, how will I treat the ESP partition? Will I just "drop" the file in that partition? I'm sorry if I'm making too many questions, but I'm not aware of the process...

Thank you so much for your help!
 
I do however get errors and the system automatically reboots at some point (where I cut the video). The error can be seen here, in case you can understand something. I had the same error (from what I remember) with Ventoy.
The recording is not very clear, under these circumstances, it is very difficult to make an analysis. The last messages seen looks like da0 been probed repeatedly. It could be hardware related, a problem with the USB disk maybe, considering it also happens with Ventoy.

Try another USB port, if that doesn't work, another USB disk.

How will I get this file, by unpacking the ISO? After than, how will I treat the ESP partition? Will I just "drop" the file in that partition? I'm sorry if I'm making too many questions, but I'm not aware of the process...
No need to apologize.

No unpacking necessary, mount the ISO and copy the loader over. The ESP must be FAT(32) file system, create a directory hierarchy as follows:

(assuming the ESP partition is mounted at /mnt and the ISO at /media)
Code:
/mnt/efi/boot
/mnt/efi/freebsd

cp /media/boot/loader.efi /mnt/efi/boot/bootx64.efi
cp /media/boot/loader.efi /mnt/efi/freebsd

Thank you so much for your help!
No problem, you're welcome.
 
I don't know the layout of the FreeBSD install media but it was intended to be written to disk directly so those steps may be trying to put a partition table into the partition.

If you look into easy2boot, it seems to do repartitioning on the fly to make an ISO or other disk image file on a filesystem into a partition for booting from. I think it was around FreeBSD version 9 that the .iso files were no longer compatible though I though the memstick images worked but I haven't followed that in a while. If you haven't done so, I'd give the memstick images a try instead if you are trying to have install media as files within a filesystem be bootable.

An alternative is using devices like iODD mini which allows you to create emulated hard drives and optical drives from files on a hard drive. If I recall, having multiple drives detected can cause booting to fail for FreeBSD from such a device, but on the iODD mini I can enable/disable multiple virtual drives and access to the real drive itself which worked around it easy enough.

If you don't need to boot various random ISOs/images and just want FreeBSD there, you could install FreeBSD into a partition on the USB stick and run it from there though booting likely involves mbr / geom boot / uefi boot space too. Most USB sticks are horrible for performance and durability when using them to boot images and operating systems; consider making sure any needed write space is a ram based disk instead of an area of the flash drive to minimize damage/wear if running a general operating system from it.

Main thing I see in the output is it looks like FreeBSD is having trouble with USB communication; as a nonexpert I'd remove all other USB devices and would even try looking over BIOS settings for USB changes that can be toggled or additional things that can be disabled. If it is USB3, slowly plugging it in past where it first makes connection can leave USB2 only connected and may change results if it is a USB3 related issue. Normally once initial connection is established and running you can plug it in the rest of the way; I had a USB3 stick where the 3.0 portion of it failed and I can still use it with USB3 computers but only if I insert it slowly enough that the handshake sets it up for USB2.
 
The recording is not very clear, under these circumstances, it is very difficult to make an analysis. The last messages seen looks like da0 been probed repeatedly. It could be hardware related, a problem with the USB disk maybe, considering it also happens with Ventoy.

Try another USB port, if that doesn't work, another USB disk.


No need to apologize.

No unpacking necessary, mount the ISO and copy the loader over. The ESP must be FAT(32) file system, create a directory hierarchy as follows:

(assuming the ESP partition is mounted at /mnt and the ISO at /media)
Code:
/mnt/efi/boot
/mnt/efi/freebsd

cp /media/boot/loader.efi /mnt/efi/boot/bootx64.efi
cp /media/boot/loader.efi /mnt/efi/freebsd

No problem, you're welcome.

Following your instructions (with the difference that my ESP was fat(16) because I made a mistake and I thought of trying first before changing it), it now detects the bootloader, and it boots, but I do have the same problem in the end. I tried to change USB ports but nothing. Also, I remember that when I first used Ventoy, it worked when the only added thing in the first, big partition was FreeBSD, but then, when I added another directory, it stopped working again. When I removed the directory, it didn't start working, unfortunately...
 
I don't know the layout of the FreeBSD install media but it was intended to be written to disk directly so those steps may be trying to put a partition table into the partition.

If you look into easy2boot, it seems to do repartitioning on the fly to make an ISO or other disk image file on a filesystem into a partition for booting from. I think it was around FreeBSD version 9 that the .iso files were no longer compatible though I though the memstick images worked but I haven't followed that in a while. If you haven't done so, I'd give the memstick images a try instead if you are trying to have install media as files within a filesystem be bootable.

Unfortunately, easy2boot is only available on Losedows, so I'll have to pass on it. But it seems like a cool project!

An alternative is using devices like iODD mini which allows you to create emulated hard drives and optical drives from files on a hard drive. If I recall, having multiple drives detected can cause booting to fail for FreeBSD from such a device, but on the iODD mini I can enable/disable multiple virtual drives and access to the real drive itself which worked around it easy enough.

It seems cool, but I think it's a little bit overkill for what I'm trying to do. But thanks for mentioning it nonetheless!

If you don't need to boot various random ISOs/images and just want FreeBSD there, you could install FreeBSD into a partition on the USB stick and run it from there though booting likely involves mbr / geom boot / uefi boot space too. Most USB sticks are horrible for performance and durability when using them to boot images and operating systems; consider making sure any needed write space is a ram based disk instead of an area of the flash drive to minimize damage/wear if running a general operating system from it.

Actually, I wanted to have one partition to write ISOs (one at a time, I don't mind) and another one to be able to have files that will not be deleted every time I'll think of trying a new OS. Of course, practically speaking, the last time I wanted to try an ISO on real hardware was many months ago and If I like FreeBSD, I will stay on it so, it's not practically a problem, but it's still nice to have. Another real problem, however, could be when formatting the USB again and again, it will at some point reach its EOL. Something that did happen with a very old USB and that's when I searched and learned that this is a problem. So yeah, there are some reasons for what I'm trying to do what I'm trying to do...

Main thing I see in the output is it looks like FreeBSD is having trouble with USB communication; as a nonexpert I'd remove all other USB devices and would even try looking over BIOS settings for USB changes that can be toggled or additional things that can be disabled. If it is USB3, slowly plugging it in past where it first makes connection can leave USB2 only connected and may change results if it is a USB3 related issue. Normally once initial connection is established and running you can plug it in the rest of the way; I had a USB3 stick where the 3.0 portion of it failed and I can still use it with USB3 computers but only if I insert it slowly enough that the handshake sets it up for USB2.

Well, what I can tell you from experience is that my USB 3 ports SUCK HARD! They don't work properly, and I know that because I had 2 specific problems (at least from what I remember). First, connecting my phone to front USB 3 port, it causes it to enter a "connect-disconnect" cycle and keep looping. Another phone, it just charges but cannot see the menu to select to transfer files or use it as a MIDI. 2nd problem is that connected my new mouse on USB 3 ports (this time, have tried the back ones), it causes the PC to have problems at detecting the device when booting up. Including my OS booting, but no mouse (and keyboard for some reason) doing anything when I use them. The PC freezing on BIOS screen. The PC suddenly rebooting, etc. Changing that mouse to USB 2 fixes all the problems!

I think I'll keep your solution! I will install it in a USB, I will configure it and do what I want and then, I'll use calamares to install it to my Hard Drive after that. From there on, I'll experiment and if I like it, I'll make a custom ISO and install it on my SSD.
 
Unfortunately, easy2boot is only available on Losedows, so I'll have to pass on it. But it seems like a cool project!
https://easy2boot.xyz/create-your-website-with-blocks/make-using-linux/ disagrees. I haven't attempted to run or port it to FreeBSD. It often uses other opensource tools like grub, CloverBootloader, etc. that are usually thought of outside the Windows circles and has bundled some windows things like wincontig, snappy driver installer origin, etc. as a common use for it is carrying/launching Windows installers. Undesired and unneeded parts can always be removed too. Using systems like this (its not the only game in town) gives you the ability to not worry about having a partition for the ISO that you delete + recreate for every disk change as you can load a flash drive with ISOs and now just pick them from the boot menu. For ISOs you only delete when you don't want that ISO, are updating it, or ran out of space and want something else. You can create image files that are used as read+write partitions for use with ISOs too, though those cause more wear according to their activity.

USB3 communication frequencies can compete with radio links like wireless mice. More advanced wired mice may show as multiple devices for things like macros, programmability, etc. and even have a way to update firmware. Some computers in recent years have had trash USB support be at least partially addressed by BIOS/UEFI updates. USB3 has a more complicated driver+handshake that takes place which can sometimes be worked around with BIOS USB settings to a degree.
 
Uhhh... I think what OP is looking for is called 'Creating multi-boot USB sticks'.

Ventoy does have very easy-to-follow instructions... https://www.ventoy.net/en/doc_start.html

Did you follow those, or somebody else's? My interpretation is that you need to download a utility from ventoy.com, use that to prep your stick, and then just copy the bootable iso over. FreeBSD's officially released iso's are not bootable iso's - they need to be 'written' (not straight-copied) to a bootable medium first. And with Ventoy, that's an important distinction to keep in mind.
 
https://easy2boot.xyz/create-your-website-with-blocks/make-using-linux/ disagrees. I haven't attempted to run or port it to FreeBSD. It often uses other opensource tools like grub, CloverBootloader, etc. that are usually thought of outside the Windows circles and has bundled some windows things like wincontig, snappy driver installer origin, etc. as a common use for it is carrying/launching Windows installers. Undesired and unneeded parts can always be removed too. Using systems like this (its not the only game in town) gives you the ability to not worry about having a partition for the ISO that you delete + recreate for every disk change as you can load a flash drive with ISOs and now just pick them from the boot menu. For ISOs you only delete when you don't want that ISO, are updating it, or ran out of space and want something else. You can create image files that are used as read+write partitions for use with ISOs too, though those cause more wear according to their activity.

USB3 communication frequencies can compete with radio links like wireless mice. More advanced wired mice may show as multiple devices for things like macros, programmability, etc. and even have a way to update firmware. Some computers in recent years have had trash USB support be at least partially addressed by BIOS/UEFI updates. USB3 has a more complicated driver+handshake that takes place which can sometimes be worked around with BIOS USB settings to a degree.
Thanks for the information on USB! I didn't know all that, so it's very helpful for me!

As for Easy2boot, I didn't know that it had Linux support as it was not so obvious in the home page. With that been said, I think I'll avoid it as I don't want to use software that treat Unix (and especially Linux that I'm currently in) as a second class citizen and losedows as a first class one. I don't trust them to work so well.
 
Uhhh... I think what OP is looking for is called 'Creating multi-boot USB sticks'.

Ventoy does have very easy-to-follow instructions... https://www.ventoy.net/en/doc_start.html

Did you follow those, or somebody else's? My interpretation is that you need to download a utility from ventoy.com, use that to prep your stick, and then just copy the bootable iso over. FreeBSD's officially released iso's are not bootable iso's - they need to be 'written' (not straight-copied) to a bootable medium first. And with Ventoy, that's an important distinction to keep in mind.
Thanks! Yeah, I used these instructions. I had used Ventoy in the past with success in another USB. The one I'm currently in, it needs to be formatted to fat32 or ntfs to work. After I found out about that, I tried and the first time, FreeBSD worked without problems. I did fail on installing it tho and wanted to try again. After that, it stopped working for some weird reason...
 
Uhhh... I think what OP is looking for is called 'Creating multi-boot USB sticks'.
Ventoy does have very easy-to-follow instructions... https://www.ventoy.net/en/doc_start.html

Important to note that Ventoy quit working when FreeBSD 14 was released, but that Ventoy has more recently been upgraded to work with 14.x.

Did you follow those, or somebody else's? My interpretation is that you need to download a utility from ventoy.com, use that to prep your stick, and then just copy the bootable iso over.

You still need either a Windows or Linux system version of the Ventoy installer initially; it'll be better when there's a FreeBSD version.

FreeBSD's officially released iso's are not bootable iso's - they need to be 'written' (not straight-copied) to a bootable medium first. And with Ventoy, that's an important distinction to keep in mind.

Yes; though the amd64 .isos may also be dd'd to USB sticks, but a straight copy of the .iso file is needed to a Ventoy stick (emphasising what you said?)

Thanks! Yeah, I used these instructions. I had used Ventoy in the past with success in another USB. The one I'm currently in, it needs to be formatted to fat32 or ntfs to work.

You can also use exfat for the data partition with exfat-fuse and exfat tools pkg installed, noting that fat32's 4GiB-1 limit is too small for the dvd1.iso by ~250MiB.

After I found out about that, I tried and the first time, FreeBSD worked without problems. I did fail on installing it tho and wanted to try again. After that, it stopped working for some weird reason...

Have you tried again with the latest Ventoy version?
 
You can also use exfat for the data partition with exfat-fuse and exfat tools pkg installed, noting that fat32's 4GiB-1 limit is too small for the dvd1.iso by ~250MiB.
Well, there is a bug and from what I tried, only Fat32 and NTFS works. At least, EXT4 didn't work. And I think the same with XFS.

Have you tried again with the latest Ventoy version?
I was actually using the latest version. It literally stopped working some minutes after when I added a directory in the partition. After that, I tried to remove the directory again and only leave the FreeBSD iso there, but it wouldn't work again...
 
Well, there is a bug and from what I tried, only Fat32 and NTFS works. At least, EXT4 didn't work. And I think the same with XFS.


I was actually using the latest version. It literally stopped working some minutes after when I added a directory in the partition. After that, I tried to remove the directory again and only leave the FreeBSD iso there, but it wouldn't work again...
I don't think Ventoy likes having extra directories for the ISOs... If it were me, I'd try to re-create the disk from scratch, like prep the stick again, then dump all the iso's into the base dir so that the bootloader sees them all correctly, and see if that helps.
 
I don't think Ventoy likes having extra directories for the ISOs... If it were me, I'd try to re-create the disk from scratch, like prep the stick again, then dump all the iso's into the base dir so that the bootloader sees them all correctly, and see if that helps.
You know what... I'll do it!!! I'll try it, and come back to tell you the results!
 
You know what... I'll do it!!! I'll try it, and come back to tell you the results!
Well, it didn't work! I tried in both FAT32 and NTFS.

So, it seems that I'll burn it the "normal" way, my friends.

Thank you all for the help! If I end up becoming a FreeBSD user, I hope I can repay you in the future! But then again, I hope that you don't ever need help ;)
 
Back
Top