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

Strange error: There were error(s) loading the rules: pfctl: pfctl_rules

General pfSense Questions
13
102
15.9k
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.
  • A
    artooro @Flole
    last edited by Aug 16, 2022, 8:59 PM

    @flole I checked and the previous run is the same as all the successful invocations.

    1 Reply Last reply Reply Quote 1
    • K
      kprovost @artooro
      last edited by Aug 17, 2022, 3:20 PM

      @artooro Can you add an pfctl -x loud invocation before that truss'd pfctl?

      That truss output was already more illuminating, but I'm still not able to reproduce anything like this issue.

      It seems to fail with ioctl(3,DIOCADDRULENV,0xbfbfdae4) ERR#16 'Device busy', after it's already added a bunch of other rules without issue.
      EBUSY almost certainly means we've failed in pf_ioctl_addrule(), when checking ticket numbers.

      So I'm guessing we're seeing a race condition here, where something else (possibly another pfctl, possibly something else that adds rules or addresses) is running at the same time. The pfctl -x loud should let us work out if it's a ruleset or a pool ticket. That in turn might give us a hint.

      I've seen mention of pfBlockerNG, is everyone affected running that?

      C A F 3 Replies Last reply Aug 17, 2022, 3:23 PM Reply Quote 0
      • C
        ChrisJenk @kprovost
        last edited by ChrisJenk Aug 17, 2022, 3:23 PM Aug 17, 2022, 3:23 PM

        @kprovost said in Strange error: There were error(s) loading the rules: pfctl: pfctl_rules:

        I've seen mention of pfBlockerNG, is everyone affected running that?

        I'm not even sure what pfBlockerNG is. I'm not consciously running it (unless it is something that always runs as standard).

        1 Reply Last reply Reply Quote 0
        • S
          stephenw10 Netgate Administrator
          last edited by Aug 17, 2022, 4:06 PM

          It's a package. You have to actively install it.

          Steve

          1 Reply Last reply Reply Quote 0
          • A
            artooro @kprovost
            last edited by artooro Aug 17, 2022, 9:43 PM Aug 17, 2022, 5:42 PM

            Sure I've added pfctl -x loud to be executed before the main pfctl execution. So just waiting for it to happen again.

            This router does have the third-party adam:ONE package which does create pf rules in the userrules anchor. So it's possible that they are both attempting to add a rule at the same time.
            Although this wasn't an issue prior to pfSense Plus 22.05 as previously pfSense would detect the device busy error and attempt it again. But now pfctl locks up for lack of a more technical term and additional attempts fail.

            I've also seen someone mention they had snort installed which may have the same symptom if snort is adding a block rule while pfctl runs.

            F 1 Reply Last reply Aug 17, 2022, 5:45 PM Reply Quote 0
            • F
              Flole @artooro
              last edited by Aug 17, 2022, 5:45 PM

              @artooro Yes that's me who has snort installed.

              1 Reply Last reply Reply Quote 1
              • F
                Flole @kprovost
                last edited by Aug 18, 2022, 1:01 AM

                @kprovost said in Strange error: There were error(s) loading the rules: pfctl: pfctl_rules:

                EBUSY almost certainly means we've failed in pf_ioctl_addrule(), when checking ticket numbers.

                Is there any reason why there is absolutely no debug output when things fail? If there would be a log message like "ticket number x is causing issues" into dmesg it would make this a lot easier to debug. It's not like it's often executed so that additional log output wouldn't really slow things down, especially if it's only executed during failure scenarios.

                K 1 Reply Last reply Aug 18, 2022, 8:34 AM Reply Quote 0
                • B
                  bmeeks
                  last edited by bmeeks Aug 18, 2022, 1:48 AM Aug 18, 2022, 1:47 AM

                  The Snort custom blocking plugin does not add rules when blocking. Instead, it simply adds the offending IP address (or addresses if both source and destination are to be blocked) to the pre-existing snort2c pf table.

                  Here is the call Snort makes when blocking:

                  ioctl(data->fd, DIOCRADDADDRS, &io)
                  
                  K 1 Reply Last reply Aug 18, 2022, 8:35 AM Reply Quote 0
                  • K
                    kprovost @Flole
                    last edited by Aug 18, 2022, 8:34 AM

                    @flole We don't log such errors by default, because otherwise the kernel would spend more time logging errors than actually doing useful work.

                    It's not just the ticket check, there are dozens of checks in DIOCADDRULENV alone. We do have Dtrace probe points for a lot of those, for when we're debugging things, and there is optional debug output at the ticket check, that's why I asked for the pfctl -x loud.

                    1 Reply Last reply Reply Quote 0
                    • K
                      kprovost @bmeeks
                      last edited by Aug 18, 2022, 8:35 AM

                      @bmeeks That could potentially also be causing a ticket mismatch in DIOCADDRULENV. There's a ticket number check on the ruleset, and another one for the address list. The pfctl -x loud enabled kernel output should let us figure out which one.

                      Given the presence of the DIOCRADDADDRS call from snort I'm 95% confident it'll be the pool ticket, but it'd be good to confirm anyway.

                      A 1 Reply Last reply Aug 19, 2022, 3:47 PM Reply Quote 0
                      • K
                        kprovost
                        last edited by Aug 19, 2022, 8:34 AM

                        If people are feeling adventurous there's an experimental (amd64) kernel here: http://pfsense-build-01.netgate.com/~kp/kernel.tar.bz2

                        It should prevent pf from getting stuck, where it's unable to update rules.

                        Extract that in /boot/. It will overwrite the existing kernel there, so ideally test this on test machines, or snapshotted VM's.
                        (To be clear: this is an amd64 kernel, do not try it on 3100 or 1100 or 2100, because it will not work there.)

                        G 1 Reply Last reply Aug 19, 2022, 10:10 AM Reply Quote 0
                        • G
                          Gertjan @kprovost
                          last edited by Aug 19, 2022, 10:10 AM

                          @kprovost said in Strange error: There were error(s) loading the rules: pfctl: pfctl_rules:

                          feeling adventurous

                          Always.

                          @kprovost said in Strange error: There were error(s) loading the rules: pfctl: pfctl_rules:

                          http://pfsense-build-01.netgate.com/~kp/kernel.tar.bz2

                          http ? Thought that was ditched some time ago.

                          pfsense-build-01.netgate.com
                          is not accessible for the common morsels.

                          login-to-view

                          No "help me" PM's please. Use the forum, the community will thank you.
                          Edit : and where are the logs ??

                          K 1 Reply Last reply Aug 19, 2022, 11:39 AM Reply Quote 0
                          • K
                            kprovost @Gertjan
                            last edited by Aug 19, 2022, 11:39 AM

                            @gertjan Sorry, I thought that one was public.

                            Let's try https://people.freebsd.org/~kp/kernel.tar.bz2 then.

                            A D 2 Replies Last reply Aug 23, 2022, 9:57 PM Reply Quote 1
                            • A
                              artooro @kprovost
                              last edited by artooro Aug 19, 2022, 3:48 PM Aug 19, 2022, 3:47 PM

                              @kprovost I did get one today with pfctl -x loud executed first. Attached here in case it's still helpful.

                              1-truss_pfctl_1660896573.txt

                              I see the kernel you uploaded, I'll install it on the slave node in the HA cluster, it doesn't happen as often on the slave but at least it's not as risky to test it.

                              1 Reply Last reply Reply Quote 0
                              • F
                                Flole
                                last edited by Aug 19, 2022, 3:49 PM

                                I believe the "real" errors can be seen in dmesg now, you should at least save the dmesg output somewhere in case it's needed.

                                A 1 Reply Last reply Aug 19, 2022, 4:02 PM Reply Quote 0
                                • A
                                  artooro @Flole
                                  last edited by Aug 19, 2022, 4:02 PM

                                  @flole in dmesg right now all I'm seeing is pf: wire key attach failed on all messages. Not sure whether it's related at all.
                                  If it's still helpful I can write some more code to capture it at the time of incident.

                                  1 Reply Last reply Reply Quote 0
                                  • D
                                    djrobx
                                    last edited by Aug 20, 2022, 4:52 AM

                                    This is happening to me too on 22.05. Same "busy" message:

                                    /root: pfctl -Fa
                                    pfctl: pfctl_clear_eth_rules: Device busy

                                    Mine popped up when trying to modify OpenPVN client settings.

                                    Mine's as close to a virgin install as you can get on self-supplied hardware (2.6.0->22.01->22.05). It ran most of the day on 22.01 with no problem, then I upgraded to latest.

                                    No custom packages, have not touched the file system other than to load one script back in.

                                    1 Reply Last reply Reply Quote 0
                                    • A
                                      artooro @kprovost
                                      last edited by Aug 23, 2022, 9:57 PM

                                      @kprovost is it possible to get the kernel patch for armv7 (for the SG-3100) as most installs I have exhibiting the issue are using that platform.

                                      K 1 Reply Last reply Aug 24, 2022, 2:36 PM Reply Quote 0
                                      • K
                                        kprovost @artooro
                                        last edited by Aug 24, 2022, 2:36 PM

                                        @artooro Here's a kernel for the 3100. https://people.freebsd.org/~kp/kernel-3100.tar.bz2

                                        I have NOT tested this kernel as I don't have a 3100. Be careful to ensure you don't break your device.

                                        A 1 Reply Last reply Aug 26, 2022, 8:54 PM Reply Quote 0
                                        • A
                                          artooro @kprovost
                                          last edited by Aug 26, 2022, 8:54 PM

                                          @kprovost after installing this kernel patch I was able to observe a collision of pf syscalls and it did not end up in a locked state like it did previously.
                                          So far I'd say this patch is doing the job.

                                          1 Reply Last reply Reply Quote 2
                                          66 out of 102
                                          • First post
                                            66/102
                                            Last post
                                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.