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

PfSense startup sequence

Scheduled Pinned Locked Moved Development
5 Posts 2 Posters 9.7k Views
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 Jul 2, 2006, 1:20 PM

    Flowchart after BSD has finished:

    1 Reply Last reply Reply Quote 0
    • M
      MrMoo
      last edited by Jul 2, 2006, 1:22 PM

      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 Jul 2, 2006, 1:29 PM

        :'(

        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 Jul 2, 2006, 9:34 PM

          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 Jul 3, 2006, 2:38 AM

            @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
            5 out of 5
            • First post
              5/5
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
              This community forum collects and processes your personal information.
              consent.not_received