nanobsd configuration

Arthur Chance freebsd at
Tue Oct 23 15:20:01 UTC 2012

On 10/23/12 12:37, Jack Mc Lauren wrote:
>   From: Arthur Chance <freebsd at>
> To: Jack Mc Lauren <jack.mclauren at>
> Cc: "freebsd-questions at" <freebsd-questions at>
> Sent: Tuesday, October 23, 2012 2:54 PM
> Subject: Re: nanobsd configuration
> On 10/23/12 09:28, Jack Mc Lauren wrote:
>> hi
>> i have a problem with nanobsd. there are somethings which don't have WITHOUT knobs,
>> how can i control these directories manually ? how can i add a costume function to
>> to do this ??
> How about something along the lines of
> cust_clean () {
>      rm -rf ${NANO_WORLDIR}/path/to/unwanted

**** Important: that should have been ${NANO_WORLDDIR} with *two* Ds - 
get it wrong and there's a chance you may damage your main system.

> }
> customize_cmd cust_clean
> in your nanobsd config file?
> =======================================================================
> thanks
> you mean after building image, this function remove unwanted from WORLDDIR ?
> i suppose this will not effect the image, because the image had been built before
 > removing unwanted directories ...
> did i get your point correctly ?

A slight caveat: it's a while since I did anything with nanobsd and this 
is all from memory. "man 8 nanobsd" is your friend, and reading the 
config files under /usr/src/tools/tools/nanobsd  and itself 
is useful.

This doeswill affect the image. nanobsd first builds (by the usual 
installation process) a file tree that will become the basis of the disk 
image. This is pointed to by ${NANO_WORLDDIR}.

It then runs the customize functions which can change any part of this 
tree. Standard ones do things like adding more files, or alter 
${NANO_WORLDDIR}/etc/ssh/sshd_config to allow root logins. You can add 
your own command to do what you like.

After that, nanobsd creates a disk image using md based devices, mounts 
them and copies the ${NANO_WORLDDIR} into the relevant slice(s).

If you don't want some part of the system but it hasn't got a WITHOUT 
knob to prevent it being installed, the only thing you can do is let 
nanobsd install it into the tree, and then "manually" via your own 
customize_cmd remove it. Any changes you make will affect the final image.

More information about the freebsd-questions mailing list