PfSense startup sequence



  • Flowchart after BSD has finished:



  • There appears to be a bug with rc.bootup 1.117 and rc 1.192.2.51, both execute the same code at the end:

    rc.bootup:

    
            echo "Starting CRON... ";
    	mwexec("/usr/sbin/cron 2>>/tmp/bootup_messages");
    	echo "done\n";
    
    	if ( ! $g['platform'] == "cdrom" ) {
    		echo "Syncing packages... ";
    		mwexec("/etc/rc.packages 2>/dev/null");
    		echo "done\n";
    
    		echo "Executing rc.d items...\n";
    		$dh  = opendir("/usr/local/etc/rc.d");
    		while (false !== ($filename = readdir($dh))) {
    			if (preg_match("/\.sh$/", $filename)) {
    				echo "  Starting {$filename}...";
    				mwexec("sh {$filename} start >>/tmp/bootup_messages 2>&1");
    				echo "done\n";
    			}
            	}
    		echo "done\n";
    	}
    
    	/* unlink CVS dir */
    	mwexec("rm -rf /usr/local/pkg/pf/CVS 2>/dev/null");
    
    	/* Make sure we aren't read/write anymore */
    	conf_mount_ro();
    
    	/* Remove stale files */
    	unlink_if_exists("{$g['tmp_path']}/filter_dirty");
    	unlink_if_exists("{$g['tmp_path']}/rc.linkup");
    	mwexec("rm -rf {$g['tmp_path']}/rc.newwanip* 2>/dev/null");
    
    	/* Startup the status daemon */
    	mwexec("/usr/bin/nice -n20 /usr/local/sbin/check_reload_status 2>/dev/null");
    
    	/* done */
    	unlink_if_exists("{$g['varrun_path']}/booting");
    	$g['booting'] = FALSE;
    
    	echo "Bootup complete\n";
    	mwexec("sh /usr/local/bin/beep.sh start");
    
    

    and rc:

    
     let the PHP-based configuration subsystem set up the system now
    /etc/rc.bootup
    
    echo -n "Starting CRON... "
    /usr/sbin/cron 2>>/tmp/bootup_messages
    echo "done."
    
    if [ ! "$PLATFORM" = "cdrom" ]; then
    
        echo "Syncing packages..."
        /etc/rc.packages 2>/dev/null
    
        echo "Executing rc.d items... "
    
        for FILE in /usr/local/etc/rc.d/*.sh; do
    		echo -n " Starting ${FILE}..."
    		sh $FILE start >>/tmp/bootup_messages 2>&1 &
    		echo "done."
        done
    fi
    
    rm -rf /usr/local/pkg/pf/CVS
    
    /usr/local/bin/php -f /etc/rc.conf_mount_ro
    
    # Remove stale files that have already been processed by bootup
    # scripts
    rm -f /tmp/filter_dirty
    rm -f /tmp/rc.newwanip
    rm -f /tmp/rc.linkup
    /usr/bin/nice -n20 /usr/local/sbin/check_reload_status 2>/dev/null
    
    echo "Bootup complete"
    
    /usr/local/bin/beep.sh start 2>&1 >/dev/null
    
    exit 0
    
    


  • :'(

    What on earth happened with config.inc?  How many non-configuration things happen in that file?  Plus config migration should be required out on demand.

    This is scary to reverse engineer a flowchart for.



  • You're looking at HEAD rc.bootup and RELENG_1 rc - I moved stuff from rc (which is a shell script) to rc.bootup a week or two back (but only on HEAD).  Haven't gotten around to moving more stuff.  The end goal is to deprecate the /etc/rc shell script and move rc.bootup to it (if it makes sense).

    –Bill

    @MrMoo:

    There appears to be a bug with rc.bootup 1.117 and rc 1.192.2.51, both execute the same code at the end:

    rc.bootup:

    
            echo "Starting CRON... ";
    	mwexec("/usr/sbin/cron 2>>/tmp/bootup_messages");
    	echo "done\n";
    
    	if ( ! $g['platform'] == "cdrom" ) {
    		echo "Syncing packages... ";
    		mwexec("/etc/rc.packages 2>/dev/null");
    		echo "done\n";
    
    		echo "Executing rc.d items...\n";
    		$dh  = opendir("/usr/local/etc/rc.d");
    		while (false !== ($filename = readdir($dh))) {
    			if (preg_match("/\.sh$/", $filename)) {
    				echo "  Starting {$filename}...";
    				mwexec("sh {$filename} start >>/tmp/bootup_messages 2>&1");
    				echo "done\n";
    			}
            	}
    		echo "done\n";
    	}
    
    	/* unlink CVS dir */
    	mwexec("rm -rf /usr/local/pkg/pf/CVS 2>/dev/null");
    
    	/* Make sure we aren't read/write anymore */
    	conf_mount_ro();
    
    	/* Remove stale files */
    	unlink_if_exists("{$g['tmp_path']}/filter_dirty");
    	unlink_if_exists("{$g['tmp_path']}/rc.linkup");
    	mwexec("rm -rf {$g['tmp_path']}/rc.newwanip* 2>/dev/null");
    
    	/* Startup the status daemon */
    	mwexec("/usr/bin/nice -n20 /usr/local/sbin/check_reload_status 2>/dev/null");
    	
    	/* done */
    	unlink_if_exists("{$g['varrun_path']}/booting");
    	$g['booting'] = FALSE;
    
    	echo "Bootup complete\n";
    	mwexec("sh /usr/local/bin/beep.sh start");
    
    

    and rc:

    
     let the PHP-based configuration subsystem set up the system now
    /etc/rc.bootup
    
    echo -n "Starting CRON... "
    /usr/sbin/cron 2>>/tmp/bootup_messages
    echo "done."
    
    if [ ! "$PLATFORM" = "cdrom" ]; then
    
        echo "Syncing packages..."
        /etc/rc.packages 2>/dev/null
        
        echo "Executing rc.d items... "
        
        for FILE in /usr/local/etc/rc.d/*.sh; do
    		echo -n " Starting ${FILE}..."
    		sh $FILE start >>/tmp/bootup_messages 2>&1 &
    		echo "done."
        done
    fi
    
    rm -rf /usr/local/pkg/pf/CVS
    
    /usr/local/bin/php -f /etc/rc.conf_mount_ro
    
    # Remove stale files that have already been processed by bootup
    # scripts
    rm -f /tmp/filter_dirty
    rm -f /tmp/rc.newwanip
    rm -f /tmp/rc.linkup
    /usr/bin/nice -n20 /usr/local/sbin/check_reload_status 2>/dev/null
    
    echo "Bootup complete"
    
    /usr/local/bin/beep.sh start 2>&1 >/dev/null
    
    exit 0
    
    


  • @billm:

    You're looking at HEAD rc.bootup and RELENG_1 rc - I moved stuff from rc (which is a shell script) to rc.bootup a week or two back (but only on HEAD).  Haven't gotten around to moving more stuff.  The end goal is to deprecate the /etc/rc shell script and move rc.bootup to it (if it makes sense).

    Nice, I always make mistakes.  Ok, 1.80.2.36 is in RELENG_1.


Log in to reply