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

    More on Abnormally High CPU Usage

    Scheduled Pinned Locked Moved General pfSense Questions
    38 Posts 5 Posters 4.0k Views 5 Watching
    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.
    • stephenw10S Online
      stephenw10 Netgate Administrator @Courierdog
      last edited by

      @courierdog said in More on Abnormally High CPU Usage:

      I now notice the following notifications at the bottom of the page
      = Update = Current
      = Remove = Information = Reinstall
      Newer version available
      Package is configured but not (fully) installed or deprecated.

      That's just the key to the list of installed packages.

      I assume you are seeing the file existing?

      CourierdogC S 2 Replies Last reply Reply Quote 0
      • CourierdogC Offline
        Courierdog @stephenw10
        last edited by

        @steveits
        once I enter and load the file I receive the following:
        <?php
        /*

        • pfblockerng.inc
        • part of pfSense (https://www.pfsense.org)
        • Copyright (c) 2015-2022 Rubicon Communications, LLC (Netgate)
        • Copyright (c) 2015-2022 BBcan177@gmail.com
        • All rights reserved.

        This tells me I have loaded the pfblockerng
        code
        I enter the Line Number 4139 and press ENTER
        I arrive at the following:
        // Create update file indicator for update process
        touch("{$pfb['dbdir']}/{$filename}/{$filename}.update");
        } else {
        pfb_logger('.', 1);
        exec("/usr/bin/gunzip -c {$file_dwn}.raw > {$file_dwn}.orig", $output, $retval);
        }
        }
        elseif ($file_type == 'application/x-bzip2') {
        pfb_logger('.', 1);
        exec("/usr/bin/bzip2 -dkc {$file_dwn}.raw > {$file_dwn}.orig", $output, $retval);
        }
        elseif ($file_type == 'application/zip') {

        		// Extras - MaxMind/TOP1M downloads
        		if ($type == 'geoip' || $type == 'top1m') {
        			// Determine if Zip contains multiple files
        			exec("/usr/bin/tar -tf {$file_dwn}.raw 2>&1", $archive_count, $retval);
        			if ($archive_count[0] == 'tar: Failed to set default locale') {
        				unset($archive_count[0]);
        
        1 Reply Last reply Reply Quote 0
        • S Offline
          SteveITS Rebel Alliance @stephenw10
          last edited by

          You could always remove and reinstall the package. By default it keeps its settings.

          CTRL+F should find "$r = explode(')', $result, 2);" only once. It's several scrolls/pages below the code you posted.

          Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
          When upgrading, allow 10-15 minutes to reboot, or more depending on packages, and device or disk speed.
          Upvote 👍 helpful posts!

          CourierdogC 1 Reply Last reply Reply Quote 0
          • CourierdogC Offline
            Courierdog @SteveITS
            last edited by

            @steveits
            Steve, I was just going to say the code you listed is several pages below where I came up at 4139 on my computer.
            I use a MacBook Pro
            And I stand corrected when I enter the page #4139 I hit enter (return)
            I will now go to the file as you described and wait for further instructions.

            1 Reply Last reply Reply Quote 0
            • CourierdogC Offline
              Courierdog @NOCling
              last edited by

              @nocling
              OK
              I finally did find the files as you and Steve posted.
              They are several pages below where I landed after entering 4139 and pressing enter.

              The FROM and TO that has been suggested.
              If I do this from the GUI
              FROM $r = explode(')', $result, 2);
              TO. $r = explode(' ', $result, 2);

              Is this a matter of typing over the existing code as displayed and pressing SAVE

              Or is there something else I must do.

              I have never edited the pfsense code directly only configured the install set up from the GUI

              S 1 Reply Last reply Reply Quote 0
              • S Offline
                SteveITS Rebel Alliance @Courierdog
                last edited by

                @courierdog said in More on Abnormally High CPU Usage:

                Is this a matter of typing over the existing code as displayed and pressing SAVE

                Yes.

                If it breaks, edit the file back again, or just uninstall/reinstall the package to get the original file. (you could, say, copy/paste the entire field into a file on your PC)

                Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                When upgrading, allow 10-15 minutes to reboot, or more depending on packages, and device or disk speed.
                Upvote 👍 helpful posts!

                CourierdogC 1 Reply Last reply Reply Quote 0
                • CourierdogC Offline
                  Courierdog @SteveITS
                  last edited by

                  @steveits
                  Steve:
                  Thanks, I entered the code over the existing code, pressed save.
                  Received the notification the file was saved successfully.

                  Diagnostics -> Reboot

                  Login.

                  For the first few minutes the CPU Usage was 20-40%
                  Now it is back at 99-100%
                  I will recheck the code to verify if it was changed.

                  The current code

                  if (substr($result, 0, 1) == '@') {

                  			$r = explode('', $result, 2);
                  
                  			// pfSense > v2.6 uses an 'ridentifier' string
                  

                  This is as I was instructed except I expected a space between the ' ',

                  So any more suggestions?

                  S 1 Reply Last reply Reply Quote 0
                  • S Offline
                    SteveITS Rebel Alliance @Courierdog
                    last edited by

                    @courierdog said in More on Abnormally High CPU Usage:

                    $r = explode('', $result, 2);

                    It should be a space:

                    $r = explode(' ', $result, 2);

                    Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                    When upgrading, allow 10-15 minutes to reboot, or more depending on packages, and device or disk speed.
                    Upvote 👍 helpful posts!

                    CourierdogC 1 Reply Last reply Reply Quote 0
                    • CourierdogC Offline
                      Courierdog @SteveITS
                      last edited by

                      @steveits
                      The edited text code had one space between the two '

                      %(#000000)[Since it was still running CPU usage of 99-100% I decided to add a second space.]

                      Result after 15 minutes of operation
                      CPU Usage = 14-40%

                      While not back to the 5-26% where was running before I began to get notification of a required License for MaxMind.

                      S 1 Reply Last reply Reply Quote 0
                      • S Offline
                        SteveITS Rebel Alliance @Courierdog
                        last edited by

                        @courierdog OK, it had no space above. It needs one, or it won’t process the data correctly. The CPU may fluctuate as it processes. A 2100 doesn’t have a super powerful CPU but does fine for what it is. The dashboard uses CPU as it updates. My 2100 is hovering around 15-25% on the dashboard while watching a streaming show.

                        Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                        When upgrading, allow 10-15 minutes to reboot, or more depending on packages, and device or disk speed.
                        Upvote 👍 helpful posts!

                        CourierdogC 1 Reply Last reply Reply Quote 0
                        • CourierdogC Offline
                          Courierdog @SteveITS
                          last edited by

                          @steveits
                          Steve: the SG-2100, is a huge improvement over the SG-1100 I started with.
                          I got the one with the maximum amount of RAM.
                          My opinion is Netgate should have a slightly more open platform, allow, 3rd party storage and 3rd party RAM.
                          One other option which I would like to see is a plug in WiFi board.
                          I like the Netgate pfsense box because it draws so little power, and it is a stand alone firewall.
                          My other option is a small footprint box suitable for Linux but they draw too much current for the dedicated task.
                          I have run virtually every commercial home network router on the market.
                          I have had cyber attacks and a hyjack of my WiFi System.
                          Since the install of the pfsense firewall, ZERO successful intrusions or hyjacking of my WiFi.
                          So far I am quite happy with the Netgate SG-2100 pfsense Firewall.
                          Thanks for your patience and willingness to help a newbie.
                          While I had worked for a Telco for 22 years, I worked on the RF side of the house.
                          Any internet networking is all new to me even at 81 I still do all my own work on the Home all Apple Network c/w 2 NAS storage units.

                          S 1 Reply Last reply Reply Quote 1
                          • S Offline
                            SteveITS Rebel Alliance @Courierdog
                            last edited by

                            @courierdog said in More on Abnormally High CPU Usage:

                            Netgate should have a slightly more open platform, allow, 3rd party storage and 3rd party RAM.

                            I get your point but especially with the smaller devices I would expect parts are fastened to the board and there aren't slots. Third party parts are tricky, if it causes a problem and the owner wants tech support why should that be on Netgate? Etc.

                            One other option which I would like to see is a plug in WiFi board.

                            If you watch this forum a while you'll see people post that FreeBSD wireless drivers are not great. (ref: Netgate support time above) So while theoretically convenient, it's usually better to use an external AP.

                            Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                            When upgrading, allow 10-15 minutes to reboot, or more depending on packages, and device or disk speed.
                            Upvote 👍 helpful posts!

                            1 Reply Last reply Reply Quote 0
                            • stephenw10S Online
                              stephenw10 Netgate Administrator
                              last edited by

                              Yes with ARM based devices adding additional RAM becomes an issue. And for small appliances it all starts to add to the cost.

                              You can actually fit a wifi card to the 2100 but the only one I'm aware of that works is the WLE200NX which is a 2x2 802.11n device. So it's hard to recommend that.
                              There is ongoing work in FreeBSD to bring in far better wifi support but an external AP is always going to be better IMO.

                              Steve

                              CourierdogC 1 Reply Last reply Reply Quote 0
                              • CourierdogC Offline
                                Courierdog
                                last edited by

                                @steveits said in More on Abnormally High CPU Usage:
                                Steve I was told by the technicians / Engineers at Netgate the WiFi is in fact an LTE Cellular fall back ISP connection not WiFi in the Domestic or Home Type of WiFi.

                                1 Reply Last reply Reply Quote 0
                                • stephenw10S Online
                                  stephenw10 Netgate Administrator
                                  last edited by

                                  It's possible to run either, or both. But the m.2 slot for a cellular modem is used by an SSD if you have that so those are mutually exclusive.

                                  [22.11-DEVELOPMENT][admin@2100-2.stevew.lan]/root: usbconfig
                                  ugen0.1: <Generic XHCI root HUB> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
                                  ugen1.1: <Marvell EHCI root HUB> at usbus1, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
                                  ugen0.2: <Sierra Wireless, Incorporated EM7305> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
                                  

                                  But, as I say, the only wifi device I know will work is very limited.

                                  [22.05-RELEASE][admin@2100-3.stevew.lan]/root: pciconf -lv
                                  ath0@pci0:0:0:0:	class=0x028000 card=0x3099168c chip=0x002a168c rev=0x01 hdr=0x00
                                      vendor     = 'Qualcomm Atheros'
                                      device     = 'AR928X Wireless Network Adapter (PCI-Express)'
                                      class      = network
                                  

                                  Steve

                                  1 Reply Last reply Reply Quote 0
                                  • CourierdogC Offline
                                    Courierdog @stephenw10
                                    last edited by

                                    @stephenw10
                                    Steve, it was more wishful thinking of having a built in WiFi port on the Firewall.
                                    It is just more hardware to add the External WiFi Access Point.
                                    I have two distinct WiFi system.
                                    the ISP provided Router also has a built in WiFi which is used as a fall back WiFi as is their ethernet access to the internet.
                                    The entire home network is behind the Netgate pfsense Firewall.

                                    1 Reply Last reply Reply Quote 1
                                    • CourierdogC Offline
                                      Courierdog @SteveITS
                                      last edited by

                                      @steveits
                                      Steve:
                                      I am unsure why but on my SG-2100 to goto the correct place in the code I have to GOTO Line %(#e32400)[4853]

                                      // Collect pfBlockerNG rule names and Tracker IDs
                                      function pfb_filterrules() {
                                      global $pfb;

                                      $rule_list		= array();
                                      $rule_list['id']	= array();
                                      $rule_list['other']	= array();
                                      $rule_list['int']	= array();
                                      
                                      exec("{$pfb['pfctl']} -vvsr 2>&1", $results);
                                      if (!empty($results)) {
                                      	foreach ($results as $result) {
                                      		if (substr($result, 0, 1) == '@') {
                                      
                                      			$r = explode(')', $result, 2);
                                      
                                      			// pfSense > v2.6 uses an 'ridentifier' string
                                      			if (strpos($result, 'ridentifier') != FALSE) {
                                      				$id = trim(strstr(strstr($r[1], 'ridentifier', FALSE), ' ', FALSE));
                                      			} else {
                                      				$id = ltrim(strstr($r[0], '(', FALSE), '(');
                                      			}
                                      
                                      1 Reply Last reply Reply Quote 0
                                      • stephenw10S Online
                                        stephenw10 Netgate Administrator
                                        last edited by

                                        Hmm, that's weird. I can't replicate that here on a 2100 running 22.05.

                                        If you download that file from Diag > Command Prompt > Download box and then open it in a text editor do the line numbers actually appear as expected?

                                        Steve

                                        CourierdogC 1 Reply Last reply Reply Quote 0
                                        • CourierdogC Offline
                                          Courierdog @stephenw10
                                          last edited by

                                          @stephenw10
                                          Steve:
                                          To ensure I get everything precisely correct.

                                          Please lay out the actual code I need to enter.
                                          I am so new and it is so easy (for me) to make a mess of things.
                                          So far as I have followed your instructions I have not messed anything up (makes me happy)

                                          Please assume I know absolutely nothing (I have ADHD) and when it comes to this sort of thing I have to follow a script.
                                          Thanks

                                          1 Reply Last reply Reply Quote 0
                                          • stephenw10S Online
                                            stephenw10 Netgate Administrator
                                            last edited by stephenw10

                                            Download the file like this:
                                            Screenshot from 2022-10-03 17-25-40.png

                                            Then open that file on your desktop in a text editor and look at line 4139.

                                            Does it appear correct there or do you actually have 'extra' lines in that file somehow?

                                            Steve

                                            CourierdogC 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.