Shell Building mfsBSD using FreeBSD 15.0

I'm trying to build mfsbsd based on FreeBSD 15.0 using


I assume this should work.

Without changing the Makefile, I've set BASE by export BASE=/tmp/FreeBSD which containd base.txz and kernel.txz and then ran make.

Is this sufficient?

This is how it finished:-

Code:
Current: ./usr/share/locale/en_AU.ISO8859-15/LC_COLLATE (25308 bytes)
 done
Removing selected files from distribution ... done
Copying out cdboot and EFI loader ... done
Installing configuration scripts and files ...pwd_mkdb: flock: No locks available
pw: passwd file update: Inappropriate ioctl for device
*** Error code 74

Stop.
make: stopped making "all" in /net/0/projects/mfsbsd/3/mfsbsd
Any idea about what needs to be done?
 
Is the build directory perhaps a NFS mounted file system? The error messages and directory name /net sounds suspiciously like that.
Installing configuration scripts and files ...pwd_mkdb: flock: No locks available
pw: passwd file update: Inappropriate ioctl for device
*** Error code 74


Stop.
make: stopped making "all" in /net/0/projects/mfsbsd/3/mfsbsd

errno(2)
Rich (BB code):
     74 EPROGUNAVAIL RPC prog. not avail. The requested program is not
             registered on the remote host.
 
Is the build directory perhaps a NFS mounted file system? The error messages and directory name /net sounds suspiciously like that.

Yes, I was using a network drive since I didn't have much spare space locally, but I have cleared some space now and run the process again locally.

Here's what I get this time:-

Script started on Thu Dec 11 13:45:12 2025
Command: make
Extracting base and kernel ... done
Removing selected files from distribution ... done
Copying out cdboot and EFI loader ...cp: /tmp/wrk/mfsbsd/work/mfs/rw/boot/loader_4th.efi: No such file or directory
cp: /tmp/wrk/mfsbsd/work/mfs/rw/boot/loader_lua.efi: No such file or directory
*** Error code 1

Stop.
make: stopped making "all" in /tmp/wrk/mfsbsd

Command exit status: 1
Script done on Thu Dec 11 13:45:25 2025

I was using FreeBSD 11.2 amd64 in this case.

I'm not sure if the Makefile is specific to any version of FreeBSD.
 
Can I suggest another method. Use poudriere image. It is the greatest thing since swiss cheese.
They have a MFS type build and it works nice. You have to have 2M RAM minimum in my opinion and that's with a striped down build.

Just skip the package building at first and build you an MFS Image with Poudriere Image on FreeBSD 15.0-RELEASE.
There have been alot of changes to FreeBSD in this release but I bet you can still build images with poudriere.

Goto: Image Building with Poudriere

You don't want type -t USB build.
You want usb+mfs

pkg install poudriere
 
You might need to tinker around with your size of MFS image. Klarna lists 10G there for type USB and that might be big for USB+MFS.
Roughly consider double the amount of RAM from MFS image. If you produce a 4GB MFS image you should have 8GB RAM Minimum.

There are settings for everything. Poudriere is nothing but a set of scripts. Modify for you taste.
 
Looks like an permission issue
Here's what I get this time:-
Code:
 *** Error code 1
errno(2)
Rich (BB code):
     1 EPERM Operation not permitted. An attempt was made to perform an
             operation limited to processes with appropriate privileges or to
             the owner of a file or other resources.
Make sure the owner of /tmp/wrk/mfsbsd and recursive directories is the same the as command executing user, or perform all command operations as "root".

I'm not sure if the Makefile is specific to any version of FreeBSD.
I don't believe that's the issue.

On my system, it builds fine on 14.3 and 15.
 
I just want to create a 15.0 version of https://mfsbsd.vx.sk/files/images/14/amd64/mfsbsd-se-14.2-RELEASE-amd64.img .

Do I use this?

make tar BASE=/cdrom/usr/freebsd-dist
No, "tar" is not the target to create .img images.

To get .img, simply execute make BASE=/path/to/dist_files

BASE= is the path to the distribution files (kernel.txz, base.txz)
CUSTOM=1 allone: install from a completed buildworld buildkernel source in the work mfsbsd build directory.
CUSTOM=1 BUILDWORLD=1 BUILDKERNEL=1: build world/kernel and install from source in the work mfsbsd build directory.

All target images and BASE sources are explained in mfsbsd/BUILD.md, and use scenarios in mfsbsd/INSTALL.md.

I did a quick test on 15.0-RELEASE, unfortunatelly there seems to be a openssl problem, the build terminates with errors:
Code:
/tmp/mfsBSD/mfsbsd15 # make BASE=../freebsd-dist15
Extracting base and kernel ... done
Removing selected files from distribution ... done
Copying out cdboot and EFI loader ... done
Installing configuration scripts and files ... done
Generating SSH host keys ... done
Configuring boot environment ...x ./
x ./linker.hints
x ./kernel
 done
Creating EFI boot image ...Creating `/tmp/mfsBSD/mfsbsd15/work/cdboot/efiboot.img'
/tmp/mfsBSD/mfsbsd15/work/cdboot/efiboot.img: 4039 sectors in 4039 FAT12 clusters (512 bytes/cluster)
BytesPerSec=512 SecPerClust=1 ResSectors=1 FATs=2 RootDirEnts=512 Sectors=4096 Media=0xf0 FATsecs=12 SecPerTrack=63 Heads=255 HiddenSecs=0
Populating `/tmp/mfsBSD/mfsbsd15/work/cdboot/efiboot.img'
Image `/tmp/mfsBSD/mfsbsd15/work/cdboot/efiboot.img' complete
 done
Installing pkgng ... done
Installing user packages ...
Compressing root ...

 done
echo roothack.full: /lib/libc.a  >> .depend
/local/bin/ccache cc  -O2 -pipe   -g -gz=zlib -MD  -MF.depend.roothack.o -MTroothack.o -std=gnu17 -Wno-format-zero-length -nobuiltininc -idirafter /lib/clang/19/include -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Wnested-externs -Wold-style-definition -Wno-pointer-sign -Wdate-time -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-parameter -Wno-error=cast-function-type-mismatch  -Qunused-arguments     -c /tmp/mfsBSD/mfsbsd15/tools/roothack/roothack.c -o roothack.o
cc -O2 -pipe -g -gz=zlib -std=gnu17 -Wno-format-zero-length -nobuiltininc -idirafter /lib/clang/19/include -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Wnested-externs -Wold-style-definition -Wno-pointer-sign -Wdate-time -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-parameter -Wno-error=cast-function-type-mismatch -Qunused-arguments  -Wl,-zrelro -static    -o roothack.full roothack.o  -larchive -lbz2 -lz -llzma -lcrypto -lbsdxml -lmd -lprivatezstd
ld: error: undefined symbol: pthread_create
>>> referenced by thread_posix.c
>>>               thread_posix.o:(ossl_crypto_thread_native_spawn) in archive /lib/libcrypto.a
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1

Stop.
make[1]: stopped making "all" in /tmp/mfsBSD/mfsbsd15/tools/roothack
*** Error code 1

Stop.
make: stopped making "all" in /tmp/mfsBSD/mfsbsd15

Images are built fine on 14.3-RELEASE still. Default image packages from mfsbsd/tools/packages.sample can be excluded from building by renaming the file.
 
I came up with this simple script

sh:
version='14.3'
BASE=/tmp/FreeBSD
mkdir -p $BASE 
LOGDIR=/var/log/build
mkdir -p $LOGDIRE 
cd   $BASE 
if [ !  -f "kernel.txz" ]; then
    fetch https://download.freebsd.org/releases/amd64/amd64/$version-RELEASE/kernel.txz
    fetch https://download.freebsd.org/releases/amd64/amd64/$version-RELEASE/base.txz
    git clone https://github.com/mmatuska/mfsbsd
fi
cd mfsbsd
mv tools/packages.sample tools/packages.sample.org
time script $LOGDIR/mfsbsd-build_$(date +"%y%m%d%H%M").log  make BASE=$BASE

Does this look as if it should work.

I get errors which are shown in /var/log/build/mfsbsd-build_*.log

echo roothack.full: /usr/lib/libc.a >> .depend
cc -O2 -pipe -g -gz=zlib -MD -MF.depend.roothack.o -MTroothack.o -std=gnu17 -Wno-format-zero-length -nobuiltininc -idirafter /usr/lib/clang/19/include -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Wnested-externs -Wold-style-definition -Wno-pointer-sign -Wdate-time -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-parameter -Wno-error=cast-function-type-mismatch -Qunused-arguments -c /tmp/FreeBSD/mfsbsd/tools/roothack/roothack.c -o roothack.o
cc -O2 -pipe -g -gz=zlib -std=gnu17 -Wno-format-zero-length -nobuiltininc -idirafter /usr/lib/clang/19/include -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Wnested-externs -Wold-style-definition -Wno-pointer-sign -Wdate-time -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-parameter -Wno-error=cast-function-type-mismatch -Qunused-arguments -Wl,-zrelro -static -o roothack.full roothack.o -larchive -lbz2 -lz -llzma -lcrypto -lbsdxml -lmd -lprivatezstd
ld: [0;31merror: [0mundefined symbol: pthread_create
>>> referenced by thread_posix.c:48 (/usr/src/crypto/openssl/crypto/thread/arch/thread_posix.c:48)
>>> thread_posix.o:(ossl_crypto_thread_native_spawn) in archive /usr/lib/libcrypto.a
cc: [0;1;31merror: [0m[1mlinker command failed with exit code 1 (use -v to see invocation)[0m
*** Error code 1

Stop.
make[1]: stopped making "all" in /tmp/FreeBSD/mfsbsd/tools/roothack
*** Error code 1

Stop.
make: stopped making "all" in /tmp/FreeBSD/mfsbsd

Command exit status: 1
Script done on Sun Dec 14 12:44:19 2025
 
I get errors as well on 15.0-RELEASE (see spoiler "/usr/lib/libcrypto.a"), looks like it's a base openssl issue. The build works fine on 14.3-RELEASE, I tested on real and virtual hardware.
My script above fetches 14.3...so I don't understand why you don't the same error that I got.
 
My script above fetches 14.3...so I don't understand why you don't the same error that I got.
There is a misunderstanding, when I said
The build works fine on 14.3-RELEASE
I meant the build host system, not the mfsBSD version.

mfsBSD version 14.3/15.0-RELEASE fails to complete the build on a 15.0-RELEASE host.

The error message suggest a openssl (libcrypto.a) and possible other problems. The issue is linked to the 15.0-RELEASE host system, a 14.3-RELEASE host completes the build without errors, be it mfsBSD 14.3-, or 15.0-RELEASE.
 
The error message suggest a openssl (libcrypto.a) and possible other problems. The issue is linked to the 15.0-RELEASE host system, a 14.3-RELEASE host completes the build without errors, be it mfsBSD 14.3-, or 15.0-RELEASE.

Thanks to your hand holding I have now successfully built mfsbsd using 14.3 and 15.0 sources although both images are named 14.3, although I guess the name is taken from the host environment rather than from the distribution files, so I will need to include a rename in any build script I come up with.

One more thing, does the Makefile include provision for building SE versions, or is that something I would need to cobble together myself?
 
One more thing, does the Makefile include provision for building SE versions, or is that something I would need to cobble together myself?
I have no idea what that is. SE Version. I am going to guess it is Hardened BSD with MFS.

I am building MFS from poudriere-image. I used 15.0-RELEASE as the host and building 13.5-RELEASE images along with 14-RELEASE and 15-RELEASE.
Very happy with the MFS results.
The bootup time seems to be the only drawback. It takes my MFS Image two minutes to load into memdisk from microSD card. Then boots up.
Very similar to my Arm64 MFS bootup times from microSD. Roughly 120s to load.

I am using a slimmed down version of 13.5-RELEASE for microSD card on MinnowBoard. I want to preserve card write cycles using MFS.
MinnowboardMax only has 2G of memory and I don't want MFS image to fill it all. So I had to create a slimmed build using src.conf.
My target image size was ~1100m or 1.2G. With that MFS has 65% disk full on md0p3 or the root disk partition.

For packages I might need to increase image size. This is just initial MFS image testing.

balanga How big is your image? How much memory on the system it is running on?
 
The SE version incorporates the FreeBSD distribution files, kernel.txz and base.txz for the verson of mfsbsd being booted.

It saves you from having to retrieve them after booting.
 
One more thing, does the Makefile include provision for building SE versions, or is that something I would need to cobble together myself?
How to build a "Special Edition" ( "The special edition contains FreeBSD distribution files base.txz and kernel.txz" https://mfsbsd.vx.sk/) is explained in mfsbsd/BUILD.md:
Rich (BB code):
## Creating images
...
##Examples
...
5. special edition (with FreeBSD distribution):

  make iso BASE=/cdrom/11.0-RELEASE RELEASE=11.0-RELEASE ARCH=amd64
For .img, drop the iso flag.

If you are unsure how to build certain images, consult mfsbsd/BUILD.md first.

You don't necessarily need to read the file from top to buttom (it wont hurt to do so, though, it's a short text file) you can also grep(1) through the complete files (e.g. grep -riw special mfsbsd.

For a full mfsbsd installer media (where the installation starts with the menu-guided "Welcome" window), put src/release/rc.local in mfsbsd/customfiles/etc.
 
How did you manage to build your imgs on a 15.0-RELEASE host given what was mentioned above?
I had two problems with Poudriere Image.

First: I tried to compile 13.5-RELEASE Image using 13.5 Source code. Failed due to EFI not building correctly. PR has fixed it. LLD_BINUTILS problem.
So building 13.5 using 13.5 source code fails. This is on FreeBSD 15.0-RELEASE.
So I used 15.0-RELEASE source code to build FreeBSD 13.5 Images. It worked fine.

Second Problem:
mfsroot file size is not working correctly from Poudriere Image.
Poudriere Image setting is not using the "-s" SIZE setting for ufs+mfs image types.

I encountered it earlier and the hack still works. Make a variable and insert it in script.

MFSROOTSIZE=800m

makefs -s${MFSROOTSIZE} -B little -o label=${IMAGENAME} ${WRKDIR}/out/mfsroot ${WRKDIR}/world >/dev/null 2>&1

Then I get a working image:
poudriere image -t usb+mfs -s 960m -j mbm-mfs -h mbm-mfs -n mbm-mfs -X excluded.files

Next up create an OVERLAY directory to add my files in.
 
Back
Top