# NanoBSD boot problem



## mah454 (Apr 15, 2013)

Hello 
I build NanoBSD with this configuration: 


```
NANO_NAME=MyRelease
NANO_SRC=/usr/src
NANO_KERNEL=MYKERNEL
NANO_IMAGES=1

### make 80MB image 
NANO_MEDIASIZE=163840
NANO_HEADS=255
NANO_SECTS=63

CONF_BUILD='
NO_KLDLOAD=YES
NO_NETGRAPH=YES
NO_PAM=YES
'


CONF_INSTALL='
NO_I4B=YES
NO_PFAUTH=YES
NO_PF=YES
NO_USB=YES
PPP_NO_RADIUS=YES
NO_ACPI=YES
NO_INET6=YES
NO_BLUETOOTH=YES
NO_CVS=YES
NO_FORTRAN=YES
NO_HTML=YES
NO_LPR=YES
NO_NLS_CATALOGS=YES
NO_MAN=YES
NO_SHAREDOCS=YES
NO_EXAMPLES=YES
NO_CALENDAR=YES
NO_MISC=YES
NO_TOOLCHAIN=YES
NO_OBJC=YES
NO_SHARE=YES
NO_KERBEROS=YES
NO_KLDLOAD=YES
NO_LIBC_R=YES
NO_LIBPTHREAD=YES
NO_ATM=YES
NO_SENDMAIL=YES
NO_LOCALES=YES
NO_SYSCONS=YES
NO_AUDIT=YES
NO_PROFILE=YES
NO_CXX=YES
'

CONF_WORLD='
NO_MODULES=YES
NO_KERBEROS=YES
NO_GAMES=YES
NO_RESCUE=YES
NO_SHAREDOCS=YES
NO_LOCALES=YES
NO_SYSCONS=YES
NO_MANCOMPRESS=YES
'

RM_DIRS='pkgs
usr/share/misc
usr/include
usr/share/nls/*_*
usr/share/groff_font
usr/share/examples
usr/share/syscons
usr/share/calendar
usr/share/mk
usr/share/pcvt
usr/share/me
usr/share/tmac
usr/share/doc
usr/share/dict
usr/share/locale/ko_*
usr/share/locale/zh_*
usr/sbin/sysinstall
boot/pxeboot
boot/cdboot
boot/zfsboot
boot/kernel/*.symbols
usr/lib/*.a'


cust_nobeastie() (
         touch ${NANO_WORLDDIR}/boot/loader.conf
         echo "beastie_disable=\"YES\"" >> ${NANO_WORLDDIR}/boot/loader.conf
	)

cust_pkg() (
	cp -v /etc/resolv.conf ${NANO_WORLDDIR}/etc/
	chroot $NANO_WORLDDIR sh /pkgs/pkg_add.sh		
	)

cust_termcap ()	(
	echo worlddir $NANO_WORLDDIR
	ls $NANO_WORLDDIR//etc/
	mkdir -p ${NANO_WORLDDIR}/usr/share/misc
	cp /usr/share/misc/termcap ${NANO_WORLDDIR}/usr/share/misc/
	cp /usr/share/misc/termcap.db ${NANO_WORLDDIR}/usr/share/misc/
	)
	
cust_strip_build ()(
	if [ "${NANO_WORLDDIR}x" = "x" ]
	then
		echo "NANO_WORLDDIR is empty exiting "
		echo "This would damage the host"
		exit 1 
	fi
	
	cd ${NANO_WORLDDIR} || exit 1

	# strip dirs from list
	for RM_DIR in $RM_DIRS
	do 
		rm -rf ${NANO_WORLDDIR}/$RM_DIR
		
	done
	
	# strip /usr/bin from file
	for RM_FILE in `cat /usr/src/tools/tools/nanobsd/usr.bin` 
	do 
		rm -rf ${NANO_WORLDDIR}usr/bin/$RM_FILE
		
	done
	
	# strip /usr/sbin from file
	for RM_FILE in `cat /usr/src/tools/tools/nanobsd/usr.sbin` 
	do 
		rm -rf ${NANO_WORLDDIR}/usr/sbin/$RM_FILE
		
	done

	# strip /usr/lib using ldd on /usr/bin and /usr/sbin 
	# first colletc list from /usr/bin	
	for BIN in `ls usr/bin`
	do
        	for LIB in `ldd -a usr/bin/$BIN | grep 'usr/lib' | awk '{print $1}'`
        	do
                	if [ `echo $LIBS | grep -c $LIB` = 0 ]
                	then
                        	LIBS="$LIBS $LIB"
                	fi
        	done
	done
	# now collect list from /usr/sbin
	for BIN in `ls usr/sbin`
	do
        	for LIB in `ldd -a usr/sbin/$BIN \
			| grep 'usr/lib' | awk '{print $1}'`
        	do
                	if [ `echo $LIBS | grep -c $LIB` = 0 ]
                	then
                        	LIBS="$LIBS $LIB"
                	fi
        	done
	done

	# add some files to the list
	LIBS="$LIBS pam_self.so.4 pam_opie.so.4 aout"
	
	# cleanup /usr/lib
	echo clean libs in /usr/lib
	for LIB in `ls usr/lib`
	do
		if [ -f usr/lib/$LIB  ] && \
			[ ! -L usr/lib/$LIB ] && \
			[ `echo $LIB | grep -c pam` = 0 ] \
			[ `echo $LIB | grep -c opie` = 0 ] 
		then
			if [ `echo $LIBS | grep -c $LIB` = "0" ]
			then
				rm ${NANO_WORLDDIR}/usr/lib/$LIB
			fi
		fi

	done
	
	# cleanup pkgs 
	rm -rf $NANO_WORLDDIR/pkgs
	
	echo cleaning libs in /usr/lib done	
	)

cust_gzip_kernel ()(
	echo compressing kernel
	cd ${NANO_WORLDDIR}/boot/kernel
	gzip kernel
	echo compressing kernel done
	echo done 
	)

customize_cmd cust_comconsole
customize_cmd cust_install_files
customize_cmd cust_allow_ssh_root
customize_cmd cust_strip_build
customize_cmd cust_gzip_kernel
customize_cmd cust_termcap
```

NanoBSD builds without any problem. But this image not boot! How can fix this problem?


----------



## mah454 (Apr 15, 2013)

Sorry. Only show "/" character without any action!


----------



## allan_sundry (Apr 15, 2013)

Try this:


```
# cat /boot/loader.conf 
kern.cam.boot_delay=10000 
kern.geom.raid.enable=0
```


----------



## mah454 (Apr 16, 2013)

Not fixed! Stay in: 

```
BTX loader 1.00 BTX version is 1.02
```
Note: I use FreeBSD 9.1 (64 bit) and want to build NanoBSD 64 bit.


----------



## bkouhi (Apr 16, 2013)

Hello @mah454,

Not related to your problem but as far as I know, NO_* variables are obsolete and you must use WITHOUT_* variables as those described in src.conf(5)().
Also, you must use same variables with CONF_BUILD and CONF_INSTALL. Use CONF_WORLD to simplify your job.
Again, not related to your problem, but instead of removing /boot/kernel/*.symbols manually, remove this line from your kernel configuration file:


```
makeoptions     DEBUG=-g
```

It will decrease compilation time.

Also, you're deleting some critical system files. Do not delete shared libraries from /usr/lib/*.a and do not delete /usr/share/syscons. That's not going to work!


----------



## mah454 (Apr 24, 2013)

I fixed this problem by commenting this line: 

```
customize_cmd cust_comconsole
```
but I have another problem: 

NanoBSD wants to mount the / (root) filesystem with /dev/ada0s1 but can not find this partition.

http://picpaste.com/snapshot1-uZ9mPrFI.png
How can I fix this problem?


----------



## younix (May 16, 2013)

Have you tried:


```
NANO_DRIVE=ad0
```


----------

