starting sysinstall at boot time

Manolis Kiagias sonic2000gr at gmail.com
Tue Sep 2 10:51:27 UTC 2008


joel at levee-online.org wrote:
> Hi,
>
> Something seems magic in freebsd: I am looking for what does start
> sysinstall at boot time when I boot from the installation CD.
> The only thing related to systinstall is the setting of the init_path variable
> in the loader.rc file but it is in comment thus the loader should finish
> by launchinig init as usual so what does make it launch sysinstall instead?
>
> I also examined /etc/ttys which is used by init but this file is standard
> and I do not find anything that could tell init to start sysinstall instead
> of getty!
>
> As you may guess, my goal is to create an customized installation CD in
> order to install a network appliance wich embedds freebsd.
>
> Sincerily,
> Joel Levee
>
>
>   

This is a tricky one, kind of black magic ;)

Seriously, it is quite simple:

You correctly located the init_path variable. This contains the 
following (on a 6.3-RELEASE CD I have handy at the moment):

#init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall"

This is commented out, but the values shown are the built-in defaults.

Now, if you take a look at the CD filesystem structure, *there is* an 
/sbin/init and there is *no* /stand/sysinstall. So, you would assume 
that init would run first.

However, here comes the caveat:

The root filesystem when you boot your installation media, is  *not* the 
CD-ROM itself. Look at /boot/loader.conf:

mfsroot_load="YES"
mfsroot_type="mfs_root"
mfsroot_name="/boot/mfsroot"

You will find /boot/mfsroot.gz as the file that acts as the root filesystem.
You can actually examine the contents of this if you mount it using 
mdconfig (assuming you mounted your install CD on /cdrom):

cp /cdrom/boot/mfsroot.gz /tmp
cd /tmp
unzip mfsroot.gz (Can probably be mounted compressed(?), did not check)
mdconfig -f mfsroot md0
mount /dev/md0 /mnt

Check the contents of /mnt:

bin   boot  dev   etc   mnt   sbin  stand var

sbin is a symbolic link to stand. There is no '/stand/init' in , but   
'/stand/sysinstall' exists. Therefore, sysinstall executes ;)


More information about the freebsd-questions mailing list