# nanobsd error while performing installworld: "No such file or directory"



## i.am.the.problem (Jun 22, 2022)

Worked fine with FreeBSD 13 but not with FreeBSD 13.1

Exits with the following error:


```
--- _testsFILESINS_Kyuafile ---
--- realinstall_subdir_usr.bin/lex ---
install: link /usr/obj/nanobsd.nsginstaller/_.w/usr/lib/libln_p.a -> /usr/obj/nanobsd.nsginstaller/_.w/usr/lib/libl_p.a: No such file or directory
*** [_installlinks] Error code 71

make[6]: stopped in /usr/src/usr.bin/lex/lib
1 error

make[6]: stopped in /usr/src/usr.bin/lex/lib

make[3]: stopped in /usr/src
--- realinstall_subdir_usr.sbin ---

make[6]: stopped in /usr/src/usr.sbin/ntp/doc

make[5]: stopped in /usr/src/usr.sbin/ntp

make[4]: stopped in /usr/src/usr.sbin

make[3]: stopped in /usr/src

make[2]: stopped in /usr/src
*** [installworld] Error code 2

make[1]: stopped in /usr/src
1 error

make[1]: stopped in /usr/src

make: stopped in /usr/src
```


----------



## Phishfry (Jun 23, 2022)

Well first thing I would do is build WITHOUT_LEX
Do you use lex(1)?
That would be a quick and easy check to see if that is the ultimate problem.


----------



## Phishfry (Jun 23, 2022)

I don't see a WITHOUT for Lex.
/usr/src/tools/build/options/


----------



## Phishfry (Jun 23, 2022)

The Makefile does this which seems to be the problem:

usr/src/usr.bin/lex/lib/MakefileL.17
LINKS+= ${LIBDIR}/libln_p.a ${LIBDIR}/libl_p.a


----------



## Phishfry (Jun 23, 2022)

i.am.the.problem said:


> [_installlinks] Error code 71


Makes me wonder if something in your build chain is not correct. lex/lib might be the first app it tries to build.





						src - FreeBSD source tree
					






					cgit.freebsd.org
				



Background:


			git: ee10666327b6 - main - Links for bmake and bmake.1
		

Read all the replys. Sounds very similar to your error.


----------



## Phishfry (Jun 23, 2022)

One more path to check from the Makefile:
/usr/src/contrib/flex/
Does this exist on FreeBSD 13.1?


----------



## Deleted member 70435 (Jun 23, 2022)

uses the re2c pattern, there are many others available, build with re2c


----------



## i.am.the.problem (Jun 23, 2022)

Phishfry said:


> One more path to check from the Makefile:
> /usr/src/contrib/flex/
> Does this exist on FreeBSD 13.1?


Yes this exists.

```
ls -lh /usr/src/contrib/flex
total 191
-rw-r--r--  1 root  wheel   1.8K May 12 05:53 COPYING
-rw-r--r--  1 root  wheel   332K May 12 05:53 ChangeLog
-rw-r--r--  1 root  wheel    23K May 12 05:53 NEWS
-rw-r--r--  1 root  wheel    45K May 12 05:53 ONEWS
-rw-r--r--  1 root  wheel   4.0K May 12 05:53 README.md
drwxr-xr-x  2 root  wheel    34B May 12 05:53 src
```

As does


```
ls -lh /usr/src/usr.bin/lex
total 225
-rw-r--r--  1 root  wheel   1.6K May 12 05:54 Makefile
-rw-r--r--  1 root  wheel   279B May 12 05:54 Makefile.depend
-rw-r--r--  1 root  wheel   7.5K May 12 05:54 config.h
-rw-r--r--  1 root  wheel    49K May 12 05:54 initparse.c
-rw-r--r--  1 root  wheel   1.0K May 12 05:54 initparse.h
-rw-r--r--  1 root  wheel   164K May 12 05:54 initscan.c
-rw-r--r--  1 root  wheel   121K May 12 05:54 initskel.c
-rw-r--r--  1 root  wheel   104K May 12 05:54 lex.1
drwxr-xr-x  2 root  wheel     4B May 12 05:54 lib
-rw-r--r--  1 root  wheel   131B May 12 05:54 version.awk
```


----------



## Phishfry (Jun 23, 2022)

Vadim Alexandrov said:


> uses the re2c pattern, there are many others available, build with re2c


I am not familiar with that.
Is this what he needs to install?
devel/re2c


----------



## i.am.the.problem (Jun 23, 2022)

Interestingly I have just run

```
./nanobsd.sh -c test.nano
```
Where test nano contains the following (So that the output disk image is large enough)

```
UsbDevice generic 12000
echo "NANO_MEDIASIZE: ${NANO_MEDIASIZE}"
```
And it completed successfully.
So it must be something in my customization file that makes it fail.


----------



## Phishfry (Jun 23, 2022)

Are you using any WITHOUT='s  in your config ?? You may need to add them later in the build process.









						Share your make.conf and src.conf
					

Hello :)   It would be nice that experienced users shared their make.conf and src.conf to help new users like me :)  I know that there are man pages and I read both of them, but real user's configurations are IMHO also helpful!




					forums.freebsd.org
				





> I copy my /etc/make.conf in to position after building world and kernel.


----------



## i.am.the.problem (Jun 23, 2022)

My nano config file has the following CONF* in. Is that what you mean?


```
CONF_BUILD='
NO_NETGRAPH=YES
NO_PAM=YES
'

CONF_INSTALL='
NO_ACPI=YES
NO_BLUETOOTH=YES
NO_CVS=YES
NO_FORTRAN=YES
NO_HTML=YES
NO_LPR=YES
MK_MAN=no
NO_SENDMAIL=YES
NO_SHAREDOCS=YES
NO_EXAMPLES=YES
MK_INSTALLLIB=no
NO_CALENDAR=YES
NO_MISC=YES
NO_SHARE=YES
'

CONF_WORLD='
NO_BIND=YES
NO_KERBEROS=YES
NO_GAMES=YES
NO_RESCUE=YES
NO_LOCALES=YES
NO_SYSCONS=YES
NO_INFO=YES
'
```


----------



## covacat (Jun 23, 2022)

why would you want profiling libraries on a nano image anyway?


----------



## i.am.the.problem (Jun 23, 2022)

covacat said:


> why would you want profiling libraries on a nano image anyway?


I've been handed this project so am trying to work my way through it.
Which ones are profiling libraries?


----------



## Phishfry (Jun 24, 2022)

i.am.the.problem said:


> My nano config file has the following CONF* in. Is that what you mean?


Yes these control what happens in certain stages of your build.
Pull the compiling tools out of the build too soon and guess what happens.



i.am.the.problem said:


> CONF_BUILD='





i.am.the.problem said:


> CONF_INSTALL='





i.am.the.problem said:


> CONF_WORLD='


What worries me is I see you have ACPI WITHOUT. (NO_ACPI=YES)
You better know your hardware before messing there. Most modern hardware won't even boot without ACPI.
ACPI has several sub-branches like ACPI thermal or ACPI video.
You might want to disable them instead of all of ACPI.




i.am.the.problem said:


> Which ones are profiling libraries?


I believe he is talking about lex, flex and re2c.
None of that should be needed for an embedded build.


----------



## i.am.the.problem (Jun 24, 2022)

Phishfry said:


> Yes these control what happens in certain stages of your build.
> Pull the compiling tools out of the build too soon and guess what happens.
> 
> 
> ...


This is what get printed out when I execute nanobsd.sh

```
00:00:00 ### Exporting NanoBSD variables
00:00:00 ### Setting variable: MAKEOBJDIRPREFIX="/usr/obj/nanobsd.myinstaller"
00:00:00 ### Setting variable: NANO_ARCH="amd64"
00:00:00 ### Setting variable: NANO_CODESIZE="0"
00:00:00 ### Setting variable: NANO_CONFSIZE="2048"
00:00:00 ### Setting variable: NANO_CUSTOMIZE=" cust_install_files cust_allow_ssh_root cust_nobeastie cust_var_size install_packages install_installer install_installer_instance"
00:00:00 ### Setting variable: NANO_DATASIZE="0"
00:00:00 ### Setting variable: NANO_DRIVE="ufs/nsginstaller"
00:00:00 ### Setting variable: NANO_HEADS="255"
00:00:00 ### Setting variable: NANO_IMAGES="1"
00:00:00 ### Setting variable: NANO_IMGNAME="_.disk.full"
00:00:00 ### Setting variable: NANO_IMG1NAME="_.disk.image"
00:00:00 ### Setting variable: NANO_MAKE="make -j 16"
00:00:00 ### Setting variable: NANO_MAKE_CONF_BUILD="/usr/obj/nanobsd.myinstaller/make.conf.build"
00:00:00 ### Setting variable: NANO_MAKE_CONF_INSTALL="/usr/obj/nanobsd.myinstaller/make.conf.install"
00:00:00 ### Setting variable: NANO_MEDIASIZE="23437500"
00:00:00 ### Setting variable: NANO_NAME="myinstaller"
00:00:00 ### Setting variable: NANO_NCPU="16"
00:00:00 ### Setting variable: NANO_NEWFS="-b 4096 -f 512 -i 8192 -U"
00:00:00 ### Setting variable: NANO_OBJ="/usr/obj/nanobsd.myinstaller"
00:00:00 ### Setting variable: NANO_PMAKE="make -j 16"
00:00:00 ### Setting variable: NANO_SECTS="63"
00:00:00 ### Setting variable: NANO_SRC="/usr/src"
00:00:00 ### Setting variable: NANO_TOOLS="/usr/src/tools/tools/nanobsd"
00:00:00 ### Setting variable: NANO_WORLDDIR="/usr/obj/nanobsd.myinstaller/_.w"
00:00:00 ### Setting variable: NANO_BOOT0CFG="-o packet -s 1 -m 3"
00:00:00 ### Setting variable: NANO_BOOTLOADER="boot/boot0"
00:00:00 ### Setting variable: NANO_LABEL="myinstaller"
00:00:00 ### Setting variable: NANO_MODULES="zfs opensolaris"
00:00:00 ### Setting variable: NANO_NOPRIV_BUILD=""
00:00:00 ### Setting variable: NANO_METALOG=""
00:00:00 ### Setting variable: NANO_LOG="/usr/obj/nanobsd.myinstaller"
00:00:00 ### Setting variable: SRCCONF="/dev/null"
00:00:00 ### Setting variable: SRC_ENV_CONF="/dev/null"
```

I just tried removing all the CONF_* configurations and it completed with no errors. I'll work through and see if I can narrow down the one causing issues.


----------



## i.am.the.problem (Jun 24, 2022)

Removing the following allows the installword step to complete.

```
MK_INSTALLLIB=no
```


----------



## Phishfry (Jun 24, 2022)

You can try slipping it in later in the build.
CONF_INSTALL='MK_INSTALLER=NO'


----------



## Phishfry (Jun 24, 2022)

I hope you are aware of the -k and -w flags. -b suppresses both.
They will allow speedy rebuilds for minor tweaks.
-w      suppress buildworld





						NanoBSD [BSD Router Project]
					






					bsdrp.net


----------



## i.am.the.problem (Jun 24, 2022)

Phishfry said:


> I hope you are aware of the -k and -w flags. -b suppresses both.
> They will allow speedy rebuilds for minor tweaks.
> -w      suppress buildworld
> 
> ...


I am. Thank you.


----------



## i.am.the.problem (Jun 24, 2022)

Fails during the 'build diskimage' step now...


```
cat /usr/obj/nanobsd.myinstaller/_.di
Creating md backing file...
0+0 records in
0+0 records out
0 bytes transferred in 0.000045 secs (0 bytes/sec)
md0 created
md0s1 added
md0s2 added
active set on md0s1
=>      63  23437437  md0  MBR  (11G)
        63  23406642    1  freebsd  [active]  (11G)
  23406705     16065    2  freebsd  (7.8M)
  23422770     14730       - free -  (7.2M)

bootcode written to md0
Writing code image...
182864+1 records in
182864+1 records out
11984200704 bytes transferred in 267.756475 secs (44757837 bytes/sec)
Creating /dev/md0s3 (mounting on /usr/obj/nanobsd.myinstaller/_.mnt)
newfs -b 4096 -f 512 -i 8192 -U -Lmyinstallers3 /dev/md0s3
newfs: /dev/md0s3: could not find special device
Running exit trap code
Filesystem         1K-blocks     Used    Avail Capacity iused    ifree %iused  Mounted on
zroot/ROOT/default  60351120 30249648 30101472    50%  322672 60202944    1%   /
umount: /usr/obj/nanobsd.myinstaller/_.mnt: not a file system root directory
```


----------



## Phishfry (Jun 24, 2022)

i.am.the.problem said:


> newfs: /dev/md0s3: could not find special device


Shouldn't that be md0s3a? It is an Dangerously dedicated partition without a slice.


----------



## i.am.the.problem (Jun 24, 2022)

The nanobsd.sh and legacy.sh scripts changed between FreeBSD 13 and 13.1. I've copied them from 13 into my environment and now nano.sh completes successfully.
Maybe there is a bug in those scripts somewhere. I'll install a fresh 13.1 and see it the problem persists.


----------



## OlivierW (Jul 23, 2022)

I'm having the same error since I've updated to FreeBSD 13.1:

```
newfs -b 4096 -f 512 -i 8192 -U -Lnanobsds3 /dev/md0s3
newfs: /dev/md0s3: could not find special device
Running exit trap code
```

My nanobsd script was working fine with FreeBSD 13.0, 12.x, 11.x,… (and probably even with 10.x).

I haven't found how to solve it.


----------

