Populating /etc
Now you need to bring in (or create) all the configuration files that make your miniBSD system functional. For the most part, these can be copied verbatim from your already populated /etc directory inside the FreeBSD jail.

(Note: You could go outside the FreeBSD jail and copy the /etc files from your FreeBSD Host Machine. But in this guide, I will assume you are getting your files from the FreeBSD jail's /etc directory.)

Since you never actually logon to the FreeBSD jail, you won't have a root password set, and you won't have any normal users on the system. So, at this point you should set a password for root and create any user accounts you might want.

Set the root password by typing the following:

passwd

Add any user accounts you want by typing the following:

adduser

(Note: You will want to just disable the root account if you don't ever plan to use it in your miniBSD system.)

Once you have finished setting up the user accounts how you want, you can then proceed with copying over the /etc files. I have compiled a list of files that I believe are the minimal requirement to have a functional system. If you want additional services, you'll need to copy over more files. I address that issue in my Expanding miniBSD 6.x subsection. For now, I recommend that you just copy over the bare necessities and verify that everything works. It's easy to add more stuff later. Getting the fundamental system up and going is all that is important right now.

Here is the list I have compiled. It is a work in progress. Suggestions are welcomed and wanted. I have marked in bold which files you are definitely going to have to edit. I have created another shell script that will help you copy these files over. Depending on your desired uses of the system, you may want to copy over additional files, or even exclude some of the files that I am copying. You can download my script and execute it by typing the following:

cd /root
fetch http://www.ultradesic.com/pub/miniBSD_Files/copy-etc-6.sh
chmod 0700 /root/copy-etc-6.sh
/root/copy-etc-6.sh

(Note: It is assumed that this script is being ran from inside the FreeBSD jail. If you tried to run it from outside the FreeBSD jail, it would probably just spit out a bunch of errors saying that /usr/minibsd/etc doesn't exist. But I haven't tested this scenario and I don't recommend that anyone else does either.)

  • /etc/auth.conf
  • /etc/crontab
  • /etc/defaults/devfs.rules
  • /etc/defaults/periodic.conf
  • /etc/defaults/rc.conf
  • /etc/fstab
  • /etc/ftpusers
  • /etc/gettytab
  • /etc/group
  • /etc/host.conf
  • /etc/hosts
  • /etc/hosts.allow
  • /etc/inetd.conf
  • /etc/localtime
  • /etc/login.access
  • /etc/login.conf
  • /etc/master.passwd
  • /etc/mtree/ (copy the directory plus its contents)
  • /etc/network.subr
  • /etc/networks
  • /etc/newsyslog.conf
  • /etc/nsswitch.conf
  • /etc/pam.d/ (copy the directory plus its contents)
  • /etc/passwd
  • /etc/profile
  • /etc/protocols
  • /etc/pwd.db
  • /etc/rc
  • /etc/rc.conf
  • /etc/rc.d/ (copy the directory plus its contents)
  • /etc/rc.firewall
  • /etc/rc.shutdown
  • /etc/rc.subr
  • /etc/resolv.conf
  • /etc/services
  • /etc/shells
  • /etc/spwd.db
  • /etc/sysctl.conf
  • /etc/syslog.conf
  • /etc/termcap -> /usr/share/misc/termcap
  • /etc/ttys
The /etc/fstab probably won't exist in your FreeBSD jail's /etc directory., so you'll have to create a new one. It's easy though because you only need two lines. (Unless you are setting up multiple partitions.) Bring the /usr/minibsd/etc/fstab file up into your favorite text editor and type the following:
/dev/ad0a       /           ufs     ro      1   1
proc /proc procfs rw 0 0
The host.conf file is, or can be, dynamically generated when the miniBSD system boots. If it doesn't exist (and it won't in your FreeBSD jail), you will either have to create a new one, or create a symlink for it. (If you ran my script, it does this step for you.) If you want to create a symlink, type the following:

cd /usr/minibsd/etc
ln -s /tmp/host.conf


The nsswitch.conf file is, or can be, dynamically generated when the miniBSD system boots. If it doesn't exist (and it won't in your FreeBSD jail), you will either have to create a new one, or create a symlink for it. (If you ran my script, it does this step for you.) If you want to create a symlink, type the following:

cd /usr/minibsd/etc
ln -s /tmp/nsswitch.conf


Your FreeBSD jail probably won't have an rc.conf either. Here is an example of my own:
hostname="workbox.ultradesic.build"
ifconfig_sis0="192.168.1.4 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
sshd_enable="NO"
usbd_enable="NO"
sendmail_enable="NONE"
inetd_enable="NO"
portmap_enable="NO"
update_motd="NO"
varsize=8192
varmfs="YES"
tmpmfs="YES"
tmpsize=8192
(Note: A user who goes by the name "protologic" pointed out a nice tip in the user forums. Instead of defining the varmfs and tmpmfs variables in your /usr/minibsd/etc/rc.conf, you can instead accomplish the same thing by putting the following lines your /usr/minibsd/etc/fstab file:)

md /var mfs rw,-s8m 2 0
md /tmp mfs rw,-s8m 2 0

It works the same either way, but some people prefer to have all their mount points defined in their fstab.

(Note: A person by the name of Jiri e-mailed me with this next tip.)

When you boot your image, you will see the following message.

/etc/rc: WARNING: Dump device does not exist. Savecore not run.

This message appears due to the missing swap partition. To get rid of the message, add the following line to your /usr/minibsd/etc/rc.conf file:

dumpdev="NO"

On headless/embedded systems, I recommend editing the /usr/minibsd/etc/ttys file and turning off all the virtual consoles. They are useless on headless systems and just waste precious memory. You will probably want to enable the serial console though so you have some means of getting onto the console if needed. Here is an example of the relevant portion of my ttys file.
 
# If console is marked "insecure", then init will ask for the root password
# when going to single-user mode.
console none unknown off secure
#
ttyv0 "/usr/libexec/getty Pc" cons25 off secure
# Virtual terminals
ttyv1 "/usr/libexec/getty Pc" cons25 off secure
ttyv2 "/usr/libexec/getty Pc" cons25 off secure
ttyv3 "/usr/libexec/getty Pc" cons25 off secure
ttyv4 "/usr/libexec/getty Pc" cons25 off secure
ttyv5 "/usr/libexec/getty Pc" cons25 off secure
ttyv6 "/usr/libexec/getty Pc" cons25 off secure
ttyv7 "/usr/libexec/getty Pc" cons25 off secure
ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure
# Serial terminals
# The 'dialup' keyword identifies dialin lines to login, fingerd etc.
ttyd0 "/usr/libexec/getty std.9600" vt100 on secure
(Note: A useful tip copied straight from the original miniBSD docs: If you're running dhclient (i.e. if you want your miniBSD machine to act as a DHCP client), remember that dhclient tries to write nameserver information obtained via DHCP to the file /etc/resolv.conf. This is not normally possible, of course, because the root filesystem is read-only. The solution is to symlink /etc/resolv.conf to /tmp/resolv.conf. Thanks to Roddy Collins who pointed this out!)

If your miniBSD system will store its time in local time as opposed to UTC (a.k.a. GMT), don't forget to create the file /usr/minibsd/etc/wall_cmos_clock by typing the following:

touch /usr/minibsd/etc/wall_cmos_clock

That's it. Now continue to the next section.