# NanoBSD Build "FileSystem Full" error code



## lonesoac0 (Dec 27, 2019)

Hello all,

    I am interested in building a NanoBSD system.  I keep getting "FileSystem Full" error codes.  I adjusted the custom settings file to NANO_MEDIASIZE=10000000 and I still got the error code.  I issued the command of df and I am seeing 68% under Capacity for the /usr partition. So I am not running out of space there.  To recap, the command that I am actually using is:

`sh nanobsd.sh -c custom_file.txt`

Error Code is:


----------



## Phishfry (Dec 30, 2019)

There are many more setting regarding sizes. Here are a few I pulled from my nanobsd.cfg
NANO_SLICE_FAT_SIZE=32m
NANO_SLICE_CFG_SIZE=32m

NANO_RAM_ETCSIZE=8192
NANO_RAM_TMPVARSIZE=8192

So as you can see some are based on physical size (32m) and others are based on blocksize.

You might want to limit the build script to only one image until you get everything figured out
NANO_IMAGES=1


----------



## lonesoac0 (Dec 30, 2019)

First, THANK YOU SO MUCH for the reply!  I will systematically try each setting one by one and to see if I can isolate the solution.


----------



## Phishfry (Dec 30, 2019)

What I do is use the file named common from the /nanobsd/embedded/ directory and include that in my nanobsd.cfg.
I modify it to suit my needs.
The /nanobsd/embedded directory has mainly Arm builds but the i386.cfg file is usable for general purpose builds.
Look at the README in that directory for further instructions.
That part has been more recently worked on and is not well documented.
It still uses the master nanobsd.sh build script but adds on to the work.

So  I copy out /embedded/common to a new directory under /nanobsd (nanobsd/apu2 for example) and add my nanobsd.cfg.
You can copy i386.cfg and use as a template.
Then modify to suit my needs. i386.cfg can be given directives to override common or you can directly modify common.
I add packages to my nanobsd.cfg file with a custom function found in nanobsd (there are two different pkg fiunctions).

Here are the custom functions I use in my nanobsd.cfg.
#Customize Commands Here:
customize_cmd cust_comconsole
customize_cmd cust_allow_ssh_root
customize_cmd cust_install_files
customize_cmd cust_pkgng
customize_cmd cust_rootpasswd
customize_cmd cust_install_build_files


----------



## lonesoac0 (Dec 30, 2019)

Again Phishfry, thank you for the help!  Here is what I have done so far.  I have read the README file in the embeded directory. I ran the exact command of:

`sh ../nanobsd.sh -c i386.cnf`

with 0 customizations.  I am currently performing a build with the standard i386 file.  My logic is that I want to see what happens.  This will give me a foundation of troubleshooting, a zero point, and a little bit of possible success.

Before I ran the above command I lightly read the i386 file and I noted that it was importing the common file in the same dir.  As a result, I copied the i386 and common file into the same dir as the nanobsd.sh file thinking it would work, nope. ha ha!  I got an error code of: `make: cannot open Makefile.inc1`  So clearly the common file is doing a lot more than I realize.

FInally, you wrote a lot more information and that is recognized.  I want to try and progress literately with something basic first and then read your customization stuff on your second post.


----------



## Phishfry (Dec 30, 2019)

Using the i386.cfg file as a start is a good way to get started.
I deleted the post with all my customization's. It was for FreeBSD 11.2 and I don't want to lead you down the wrong path.


----------



## Phishfry (Dec 31, 2019)

I just built stock FreeBSD 12.1 NanoBSD i386.cfg and it works fine.


> 00:30:36 # NanoBSD image i386 completed


For checking out my image /usr/embedded/images/_.disk.image.i386 I used mdconfig(8) to load my image into a file based memory disk.
`cd /usr/embedded/images/`
`mdconfig -u md0 -f _.disk.image.i386`
`ls /dev/md*`
/dev/md0    /dev/md0s1    /dev/md0s1a    /dev/md0s3    /dev/mdctl
`mount /dev/md0s1a /mnt`
`ls /mnt`


----------



## lonesoac0 (Dec 31, 2019)

The build only took 30 minutes?!!?  I am jealous!  It takes my virtual machine about 3 hours.  I might need to add some hardware there.  I was actually just moving the image to a USB stick by the dd command in the howto guide.  Give me a minute to test and I will report back.


----------



## lonesoac0 (Dec 31, 2019)

*sigh*  I cannot get the USB to boot to NanoBSD after I dd the image to the USB stick.  I performed the above steps you outlined and I see the FreeBSD folder structure as it should be.  As a result, I am sure that the img file is correct.  What am I missing?


----------



## Phishfry (Dec 31, 2019)

Did you properly close the memory disk or shutdown the computer?
`umount /mnt`
`mdconfig -u md0 -d`


----------



## Phishfry (Dec 31, 2019)

The other possible issue is that the stock NanoBSD image only runs on Legacy BIOS, Not on UEFI.
So make sure that your BIOS is set to boot from Legacy or CSM.


----------



## Phishfry (Dec 31, 2019)

I am using a SuperMicro X10SRi with 16GB RAM and a 20 core CPU.  Samsung PM983 NVMe for storage.
The buildworld portion took 25 Minutes. The rest was fast.
Many cores and NVMe are the tricks to fast building.
CPU clockspeed and Memory are not that important.


----------



## Phishfry (Dec 31, 2019)

I am pretty sure that the image that is created is for ada0, not for a USB device.
You can modify i386.cfg to superseded the common file directive to use da0 instead.
I just burned my image to USB disk and notice that /etc/fstab points to ada0

So change NANO_DRIVE to da0 in i386.cfg if you want to use a USB drive.


----------



## lonesoac0 (Dec 31, 2019)

So, what I have done so far is that I decided to just wipe and reload my FreeBSD system.  I wiped and reloaded and rebuilt the i386 WITHOUT the information from your last message.  I am going to change what you recommended and report back.

I cannot thank you enough for all of your help so far!  I built and ran NanoBSD a few years ago and I thought I would try my hand at it again.  Apparently, there have been lots of changes.


----------



## Phishfry (Jan 1, 2020)

Well you were right. I cannot get 12.1 build to startup. Just a blinking cursor.
So save yourself some hassle....
I am loading up FreeBSD 12.0 right now to see where that goes.
My last NanoBSD build was on FreeBSD-11.2 so I will drop back to FreeBSD-11.3 if FreeBSD-12.0 does not work either.
Will keep you advised. It is a Nano New Years party for me tonight.


----------



## lonesoac0 (Jan 1, 2020)

It makes me feel better knowing a FreeBSD genious such as yourself comes up with the same result as me.


----------



## Phishfry (Jan 1, 2020)

I got it working on FreeBSD 11.3 with the addition of these lines to my i386.cfg

```
NANO_BOOTLOADER="/boot/boot0"
NANO_BOOT0CFG="-s 1 -m 3 da0"
NANO_BOOT_MBR="/boot/mbr"
```


----------



## lonesoac0 (Jan 1, 2020)

So, here is what I am doing.  WIth the FreeBSD 12.1 machine, I am using the rpi3.cfg standard file to see if the same thing happens as the i386 standard build.  Meanwhile, I created another virtual machine and installed FreeBSD 11.3 and using your modifications so that should be good to go.  I will let you know progress on both fronts.


----------



## Phishfry (Jan 1, 2020)

The important setting here is NANO_BOOTLOADER="/boot/boot0".
The default setting in /nanobsd/embedded/common is NANO_BOOTLOADER="/boot/boot0sio".
This is meant for boards with a serial console available. So many boards do no have a 'Serial Redirect' feature and cannot use boot0sio.
Now for your RPI3 build you should use the default settings as found in /nanobsd/embedded/rpi3.cfg.

I did a `diff` on nanobsd.sh and common and found no major differences between versions.
So it really comes down to the settings for your build.

For this setting NANO_BOOT0CFG="-s 1 -m 3 da0" you may need to use slice 2 instead. I had it stop at mountroot and had to type:
ufs:/dev/da0s2a
So you may need to experiment with this line.
This may be more appropriate:
NANO_BOOT0CFG="-s 2 -m 3 da0"


----------



## lonesoac0 (Jan 1, 2020)

The same thing happened to me at mountroot.  I typed in: ufs:/dev/da0s2a and it looks like it froze on booting up.  I am currently rebuilding i386 with your new recommended settings in the above post.


----------



## lonesoac0 (Jan 3, 2020)

Yeah, I cannot get it to boot with the command of: ufs:/dev/da0s2a.  I give up.  This cannot and should not be this hard. lol


----------



## Phishfry (Jan 4, 2020)

OK lets move back to using only the nanobsd script.

`cd /usr/src/tools/tools/nanobsd`

Create a config file with these settings.
/usr/src/tools/tools/nanobsd/build1.cfg

```
NANO_DRIVE="da0"
NANO_PMAKE="make -j $(sysctl -n hw.ncpu)"
NANO_IMAGES=2
NANO_MEDIASIZE=12000000
NANO_BOOTLOADER="boot/boot0"
NANO_IMGNAME="nanobsd_${NANO_NAME}_${NANO_DRIVE}.img"
```

Now run your config:
`sh nanobsd.sh -c build1.cfg`

Once complete you can write your image to trhe USB stick:
`dd if=/usr/obj/nanobsd.full/nanobsd_full_da0.img of=/dev/da0 bs=1M conv=sync`


----------



## Phishfry (Jan 4, 2020)

If you want to make minor changes to your build you can rebuild without recompiling everything (saving massive time).
`sh nanobsd.sh -bc build1.cfg`
The -b flag allows you to keep your existing buildworld and buildkernel stages.

Let me know how it goes for you. I have tested this config. It does make an 5GB image with basically 2 full installs on slice s1a and s2a.
You can slim it down from here.

Some additional documentation.





						NanoBSD [BSD Router Project]
					






					bsdrp.net


----------



## Phishfry (Jan 5, 2020)

I have re-invigorated my NanoBSD work with a fresh FreeBSD 12.1 build.
Here is my Gist file of a very minimal NanoBSD. Use at your own risk as it is very stripped out.
I like to start minimal and add things back as needed.
This build creates a 768 Megabyte image file with dual OS slices for a USB device.
There is 180 Megabytes free on each OS slice.
You could slim this build even more with a custom kernconf.


So for this config you need to make a separate directory for the build file:
`mkdir /usr/src/tools/tools/nanobsd/custom`
Now copy the Gist file into /usr/src/tools/tools/nanobsd/custom/custom.cfg
You run it with this command:
`cd /usr/src/tools/tools/nanobsd/custom`
`sh ../nanobsd.sh -c custom.cfg`

You also need (optionally) to create a directory for your desired packages:
`mkdir /usr/src/tools/tools/nanobsd/Pkg`
In this directory you must place any packages you want pre-installed.
They must be in the *.txz format and you must include all dependencies and put pkg.txz in there as well.
You can fetch these packages from here:


			Index of /FreeBSD:12:amd64/quarterly/
		

Use the All directory and place the files in the /usr/src/tools/tools/nanobsd/Pkg directory

I also include pre-built system config files in an overlay directory. So you need to create this:
`mkdir /usr/src/tools/tools/nanobsd/custom/overlay`
Treat this directory as your builds uppermost or "/" directory.

For a custom rc.conf you need to build the directory structure:
`mkdir /usr/src/tools/tools/nanobsd/custom/overlay/etc`
Now create an rc.conf in this directory. It will be used in your NanoBSD build.

For loader.conf
`mkdir /usr/src/tools/tools/nanobsd/custom/overlay/boot`
Now create your custom loader.conf in this directory.

As you can see from the config file the root user 'freebsd' password is created.

A sample /usr/src/tools/tools/nanobsd/custom/overlay/etc/rc.conf

```
hostname="custom"
sshd_enable="YES"
dumpdev="NO"
ifconfig_DEFAULT="DHCP"
```

A sample /usr/src/tools/tools/nanobsd/custom/overlay/boot/loader.conf

```
autoboot_delay="-1"
```


----------



## lonesoac0 (Jan 5, 2020)

Thank you sir!


----------



## Phishfry (Jan 6, 2020)

I was rebuilding my Wireless Access Point NanoBSD build and I had to add a package with many dependencies.
An easier way to do it is to use pkg-fetch(8) to download the needed files and their dependencies, and the dependency of dependencies.
For my Access Point I use dns/dnsmasq and it has layers of dependencies. So here is my command:

`cd /usr/src/tools/tools/nanobsd/wap-amd64/Pkg`

Notice that I have changed my config file to put packages into the build folder.
That way I can build i386 and amd64 packages with each build using its own package sets.

So with this setting I changed in my config to have separate Pkg folders for each config directory:
NANO_PACKAGE_DIR=${NANO_SRC}/${NANO_TOOLS}/${NANO_NAME}/Pkg

Ok now to download the packages:
`pkg fetch -o ./ -d pkg dnsmasq`
This command downloads package.txz and dnsmasq.txz plus all dependencies to the /usr/src/tools/tools/nanobsd/wap-amd64/Pkg/All directory.
From there you can copy them up from the Pkg/All directory up to the /Pkg directory.


----------



## lonesoac0 (Jan 6, 2020)

Funny.  I literally just executed the custom package installer function listed in the NanoBSD howto to install custom packages. ha ha!  I will let you know if I managed to set another fire...


----------



## lonesoac0 (Jan 6, 2020)

I am attempting to install fusefs-ntfs and load the kernel module in my i386 nano build.  It looks like I have downloaded and moved all the dependencies with:

`pkg install -F fusefs-ntfs`  I tried your above command of pkg fetch but I have no idea where the files went to! ha ha

I then move the package and all dependencies from /var/cache/package to /usr/src/tools/tools/nanobsd/packages/ dir

Ultimately, I am looking to format the da0s4 to NTFS and be able to plug it into WIndows.  I have already formatted the slice to NTFS.  I think what I am missing is loading the fusefs kernel module on boot.


----------



## Phishfry (Jan 7, 2020)

My recommendation is to build the i386 machine with regular FreeBSD then transfer all your work product to your NanoBSD build/overlay structure.
You can even scrape all the packages out of /var/cache/pkg that you use for your build
So install i386 FreeBSD with source tree then configure it for your fuse task and then create your NanoBSD build.

If you use NANO_DATASIZE="" with a positive value it will make the da0s4 slice for you.
Default is NANO_DATASIZE="0" which skips the data partition.

You might have to manually format da0s4 with NTFS in Windows. da0s4 will have UFS on it and Windows will not see it.
So from FreeBD `dd if=/dev/zero of=/dev/da0s4` and then perhaps format it as msdosfs in FreeBSD and then convert it in Windows, to NTFS.


----------

