Navigation

    Netgate Discussion Forum
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search

    PfSense startup sequence

    Development
    2
    5
    9393
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      MrMoo last edited by

      Flowchart after BSD has finished:

      1 Reply Last reply Reply Quote 0
      • M
        MrMoo last edited by

        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
        
        
        1 Reply Last reply Reply Quote 0
        • M
          MrMoo last edited by

          :'(

          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.

          1 Reply Last reply Reply Quote 0
          • B
            billm last edited by

            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
            
            

            pfSense core developer
            blog - http://www.ucsecurity.com/
            twitter - billmarquette

            1 Reply Last reply Reply Quote 0
            • M
              MrMoo last edited by

              @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.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post