Project

General

Profile

Actions

Bug #14287

closed

pfBlockerNG does not uninstall cleanly when using RAM disks

Added by Loh Phat about 1 year ago. Updated 5 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
pfBlockerNG
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Affected Version:
Affected Plus Version:
Affected Architecture:

Description

UNchecking "keep config" and then trying to remove the 3.2.0_3 package results in PHP error.

Other user reports the PHP error doesn't happen in 3.2.0_4 but there are still several hundred lines of config orphaned in the config.

Netgate discussion thread: https://forum.netgate.com/topic/179164/pfblocker-ng-devel-3-2-0_3-not-uninstalling-on-23-01

>>> Removing pfSense-pkg-pfBlockerNG-devel... 
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
    pfSense-pkg-pfBlockerNG-devel: 3.2.0_3

Number of packages to be removed: 1

The operation will free 7 MiB.
[1/1] Deinstalling pfSense-pkg-pfBlockerNG-devel-3.2.0_3...
Removing pfBlockerNG-devel components...
Menu items... done.
Services... done.
Loading package instructions...
Removing pfBlockerNG... Removing all customizations/data...
Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /etc/inc/config.lib.inc:928
Stack trace:
#0 /etc/inc/config.lib.inc(680): cleanup_backupcache(true)
#1 /usr/local/pkg/pfblockerng/pfblockerng.inc(10768): write_config('pfBlockerNG: Re...')
#2 /etc/inc/pkg-utils.inc(781) : eval()'d code(1): pfblockerng_php_pre_deinstall_command()
#3 /etc/inc/pkg-utils.inc(781): eval()
#4 /etc/inc/pkg-utils.inc(1093): eval_once('pfblockerng_php...')
#5 /etc/rc.packages(80): delete_package_xml('pfBlockerNG-dev...', 'deinstall')
#6 {main}
  thrown in /etc/inc/config.lib.inc on line 928
PHP ERROR: Type: 1, File: /etc/inc/config.lib.inc, Line: 928, Message: Uncaught TypeError: Cannot access offset of type string on string in /etc/inc/config.lib.inc:928
Stack trace:
#0 /etc/inc/config.lib.inc(680): cleanup_backupcache(true)
#1 /usr/local/pkg/pfblockerng/pfblockerng.inc(10768): write_config('pfBlockerNG: Re...')
#2 /etc/inc/pkg-utils.inc(781) : eval()'d code(1): pfblockerng_php_pre_deinstall_command()
#3 /etc/inc/pkg-utils.inc(781): eval()
#4 /etc/inc/pkg-utils.inc(1093): eval_once('pfblockerng_php...')
#5 /etc/rc.packages(80): delete_package_xml('pfBlockerNG-dev...', 'deinstall')
#6 {main}
  thrownpkg-static: DEINSTALL script failed
[1/1] Deleting files for pfSense-pkg-pfBlockerNG-devel-3.2.0_3: .......... done
Removing pfBlockerNG-devel components...
Configuration... done.
>>> Removing stale packages... done.
Success
Actions #1

Updated by Kris Phillips 12 months ago

If you update to the latest pfBlockerNG and then uninstall it with Keep Settings unchecked, does this still leave orphaned config items?

Actions #2

Updated by Loh Phat 12 months ago

Error when removing 3.2.0_4:

>>> Removing pfSense-pkg-pfBlockerNG-devel... 
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
    pfSense-pkg-pfBlockerNG-devel: 3.2.0_4

Number of packages to be removed: 1

The operation will free 7 MiB.
[1/1] Deinstalling pfSense-pkg-pfBlockerNG-devel-3.2.0_4...
Removing pfBlockerNG-devel components...
Menu items... done.
Services... done.
Loading package instructions...
Removing pfBlockerNG... Removing all customizations/data...
Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /etc/inc/config.lib.inc:928
Stack trace:
#0 /etc/inc/config.lib.inc(680): cleanup_backupcache(true)
#1 /usr/local/pkg/pfblockerng/pfblockerng.inc(10768): write_config('pfBlockerNG: Re...')
#2 /etc/inc/pkg-utils.inc(781) : eval()'d code(1): pfblockerng_php_pre_deinstall_command()
#3 /etc/inc/pkg-utils.inc(781): eval()
#4 /etc/inc/pkg-utils.inc(1093): eval_once('pfblockerng_php...')
#5 /etc/rc.packages(80): delete_package_xml('pfBlockerNG-dev...', 'deinstall')
#6 {main}
  thrown in /etc/inc/config.lib.inc on line 928
PHP ERROR: Type: 1, File: /etc/inc/config.lib.inc, Line: 928, Message: Uncaught TypeError: Cannot access offset of type string on string in /etc/inc/config.lib.inc:928
Stack trace:
#0 /etc/inc/config.lib.inc(680): cleanup_backupcache(true)
#1 /usr/local/pkg/pfblockerng/pfblockerng.inc(10768): write_config('pfBlockerNG: Re...')
#2 /etc/inc/pkg-utils.inc(781) : eval()'d code(1): pfblockerng_php_pre_deinstall_command()
#3 /etc/inc/pkg-utils.inc(781): eval()
#4 /etc/inc/pkg-utils.inc(1093): eval_once('pfblockerng_php...')
#5 /etc/rc.packages(80): delete_package_xml('pfBlockerNG-dev...', 'deinstall')
#6 {main}
  thrownpkg-static: DEINSTALL script failed
[1/1] Deleting files for pfSense-pkg-pfBlockerNG-devel-3.2.0_4: .......... done
Removing pfBlockerNG-devel components...
Configuration... done.
>>> Removing stale packages... done.
Success
Actions #3

Updated by Loh Phat 12 months ago

Note that System Patches 2.2.1 is installed with all recommended patches applied.

Actions #4

Updated by BBcan177 . 12 months ago

Looks like a pfSense PHP 8 code issue.

{main} thrown in /etc/inc/config.lib.inc on line 928

PHP ERROR: Type: 1, File: /etc/inc/config.lib.inc, Line: 928, Message: Uncaught TypeError: Cannot access offset of type string on string in /etc/inc/config.lib.inc:928

Actions #6

Updated by Loh Phat 12 months ago

Correction, I applied the patch at https://redmine.pfsense.org/issues/14230 and it didn't help. I know it's a different issue but I'm applying any pfBLockerNG-devel patch posted as recommended.

Actions #7

Updated by Chris W 12 months ago

How did you arrive at 23.01, from a previous CE or Plus version?

I'm not able to reproduce this on a 23.01 Plus installation, nor 2.6 CE which was upgraded to 23.01. No system patches applied. Steps taken:
1. Install pfblockerng-devel, go through the setup wizard and let it download the block lists. No other pfBlocker settings were changed/configured.
2. Reboot pfsense from the Diagnostics menu.
3. Uncheck pfBlocker's Keep Settings box, click Save, and then uninstall pfBlocker from System > Package Manger. This was the result in all occurrences:

>>> Removing pfSense-pkg-pfBlockerNG-devel...
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
    pfSense-pkg-pfBlockerNG-devel: 3.2.0_4

Number of packages to be removed: 1

The operation will free 7 MiB.
[1/1] Deinstalling pfSense-pkg-pfBlockerNG-devel-3.2.0_4...
Removing pfBlockerNG-devel components...
Menu items... done.
Services... done.
Loading package instructions...
Removing pfBlockerNG...cat: /var/db/pfblockerng/dnsbl/*.txt: No such file or directory
grep: /var/unbound/pfb_dnsbl.conf: No such file or directory
 Removing all customizations/data... done.
[1/1] Deleting files for pfSense-pkg-pfBlockerNG-devel-3.2.0_4: .......... done
Removing pfBlockerNG-devel components...
Configuration... done.
>>> Removing stale packages... done.
Success

It looks like the issue you're seeing is due to a greater PHP problem as a result of upgrading to 23.01. Reflashing directly to 23.01 (or upgrading from CE to 23.01 before importing your configuration) are options but in the Package Manager, System Patches 2.2.2 is now available. Please install that and let us know if it solves the matter.

Actions #8

Updated by Loh Phat 12 months ago

23.01 is the current stable release for my Netgate 3100

Version 23.01-RELEASE (arm)
built on Fri Feb 10 20:06:58 UTC 2023
FreeBSD 14.0-CURRENT

Actions #9

Updated by Loh Phat 12 months ago

Chris W wrote in #note-7:

It looks like the issue you're seeing is due to a greater PHP problem as a result of upgrading to 23.01. Reflashing directly to 23.01 (or upgrading from CE to 23.01 before importing your configuration) are options but in the Package Manager, System Patches 2.2.2 is now available. Please install that and let us know if it solves the matter.

Still not showing as available in the 23.01 Package Manager.

Actions #10

Updated by Loh Phat 11 months ago

No joy with the new 2.2.2 system patches:

>>> Removing pfSense-pkg-pfBlockerNG-devel... 
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 1 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
    pfSense-pkg-pfBlockerNG-devel: 3.2.0_4

Number of packages to be removed: 1

The operation will free 7 MiB.
[1/1] Deinstalling pfSense-pkg-pfBlockerNG-devel-3.2.0_4...
Removing pfBlockerNG-devel components...
Menu items... done.
Services... done.
Loading package instructions...
Removing pfBlockerNG...cat: /var/db/pfblockerng/dnsbl/*.txt: No such file or directory
 Removing all customizations/data...
Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /etc/inc/config.lib.inc:928
Stack trace:
#0 /etc/inc/config.lib.inc(680): cleanup_backupcache(true)
#1 /usr/local/pkg/pfblockerng/pfblockerng.inc(10768): write_config('pfBlockerNG: Re...')
#2 /etc/inc/pkg-utils.inc(781) : eval()'d code(1): pfblockerng_php_pre_deinstall_command()
#3 /etc/inc/pkg-utils.inc(781): eval()
#4 /etc/inc/pkg-utils.inc(1093): eval_once('pfblockerng_php...')
#5 /etc/rc.packages(80): delete_package_xml('pfBlockerNG-dev...', 'deinstall')
#6 {main}
  thrown in /etc/inc/config.lib.inc on line 928
PHP ERROR: Type: 1, File: /etc/inc/config.lib.inc, Line: 928, Message: Uncaught TypeError: Cannot access offset of type string on string in /etc/inc/config.lib.inc:928
Stack trace:
#0 /etc/inc/config.lib.inc(680): cleanup_backupcache(true)
#1 /usr/local/pkg/pfblockerng/pfblockerng.inc(10768): write_config('pfBlockerNG: Re...')
#2 /etc/inc/pkg-utils.inc(781) : eval()'d code(1): pfblockerng_php_pre_deinstall_command()
#3 /etc/inc/pkg-utils.inc(781): eval()
#4 /etc/inc/pkg-utils.inc(1093): eval_once('pfblockerng_php...')
#5 /etc/rc.packages(80): delete_package_xml('pfBlockerNG-dev...', 'deinstall')
#6 {main}
  thrownpkg-static: DEINSTALL script failed
[1/1] Deleting files for pfSense-pkg-pfBlockerNG-devel-3.2.0_4: .......... done
Removing pfBlockerNG-devel components...
Configuration... done.
>>> Removing stale packages... done.
Success
Actions #11

Updated by Kris Phillips 11 months ago

Loh Phat wrote in #note-10:

No joy with the new 2.2.2 system patches:

[...]

Please retest this on 23.05 with the latest pfBlockerNG-devel. I believe all relevant patches should be integrated now.

Actions #12

Updated by Kris Phillips 9 months ago

  • Status changed from New to Feedback

I'm no longer able to recreate this in 23.05.1. If someone else can also confirm no more issues, we can mark this as resolved.

Actions #13

Updated by Lev Prokofev 9 months ago

  • Status changed from Feedback to Resolved

No PHP errors on 23.05.1 when deleting 3.2.0_5 package with unchecked "keep config"

Installed packages to be REMOVED:
    pfSense-pkg-pfBlockerNG: 3.2.0_5

Number of packages to be removed: 1

The operation will free 7 MiB.
[1/1] Deinstalling pfSense-pkg-pfBlockerNG-3.2.0_5...
Removing pfBlockerNG components...
Menu items... done.
Services... done.
Loading package instructions...
Removing pfBlockerNG... Removing all customizations/data... done.
[1/1] Deleting files for pfSense-pkg-pfBlockerNG-3.2.0_5: .......... done
Removing pfBlockerNG components...
Configuration... done.
>>> Removing stale packages... done.
Success

I'm marking this as resolved

Actions #14

Updated by Jordan G 9 months ago

  • Status changed from Resolved to Feedback

I'm seeing this on 23.05.1 pfBlockerNG 3.2.0_5 across multiple devices. Perhaps you need an existing pfBlockerNG section in config.xml or a pfBlockerNG configuration created on a previous release or package version, but I'm seeing this whenever trying to remove or reinstall the package with keep settings unchecked.

PHP ERROR: Type: 1, File: /etc/inc/config.lib.inc, Line: 928, Message: Uncaught TypeError: Cannot access offset of type string on string in /etc/inc/config.lib.inc:928
Stack trace:
#0 /etc/inc/config.lib.inc(680): cleanup_backupcache(true)
#1 /usr/local/pkg/pfblockerng/pfblockerng.inc(10768): write_config('pfBlockerNG: Re...')
#2 /etc/inc/pkg-utils.inc(783) : eval()'d code(1): pfblockerng_php_pre_deinstall_command()
#3 /etc/inc/pkg-utils.inc(783): eval()
#4 /etc/inc/pkg-utils.inc(1095): eval_once('pfblockerng_php...')
#5 /etc/rc.packages(80): delete_package_xml('pfBlockerNG', 'deinstall')
#6 {main}thrown @ 2023-08-04 02:37:43
Actions #15

Updated by Jordan G 8 months ago

This is still happening with pfBlockerNG 3.2.0_6. I believe I've found a workaround for this after chasing a few of the lines from the original error. It seems if you don't have the options in pfBlockerNG>DNSBL for resolver cache checked (like you might have done trying to disable parts (or all) of the package) it causes the reinstall/uninstall to fail. I suppose it requires that since it defaults it on when the wizard runs initially. I first had to disable RAM disks under system>advanced>misc and reboot before the other steps required for the uninstall to complete successfully. Next I needed to reinstall the pfBlockerNG package and then run a force reload>all from the pfBlockerNG update menu, after making sure the resolver cache option was set, you must check this since upon reinstalling the package your previous settings will remain unless you run the wizard again. After the update/reload in pfBlockerNG has finished, you should be able to successfully uninstall pfBlockerNG package without encountering the deinstall failure message.

hopefully this helps :D

Actions #16

Updated by Jordan G 6 months ago

seeing this on pfBlockerNG 3.2.0_6 on 23.09.r.20231027.0151, this was a clean install and immediately attempting to remove the package without running the wizard

Removing pfBlockerNG... Removing all customizations/data...
Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /etc/inc/config.lib.inc:934
Stack trace:
#0 /etc/inc/config.lib.inc(686): cleanup_backupcache(true)
#1 /usr/local/pkg/pfblockerng/pfblockerng.inc(10768): write_config('pfBlockerNG: Re...')
#2 /etc/inc/pkg-utils.inc(801) : eval()'d code(1): pfblockerng_php_pre_deinstall_command()
#3 /etc/inc/pkg-utils.inc(801): eval()
#4 /etc/inc/pkg-utils.inc(1113): eval_once('pfblockerng_php...')
#5 /etc/rc.packages(80): delete_package_xml('pfBlockerNG', 'deinstall')
#6 {main}
  thrown in /etc/inc/config.lib.inc on line 934
PHP ERROR: Type: 1, File: /etc/inc/config.lib.inc, Line: 934, Message: Uncaught TypeError: Cannot access offset of type string on string in /etc/inc/config.lib.inc:934
Stack trace:
#0 /etc/inc/config.lib.inc(686): cleanup_backupcache(true)
#1 /usr/local/pkg/pfblockerng/pfblockerng.inc(10768): write_config('pfBlockerNG: Re...')
#2 /etc/inc/pkg-utils.inc(801) : eval()'d code(1): pfblockerng_php_pre_deinstall_command()
#3 /etc/inc/pkg-utils.inc(801): eval()
#4 /etc/inc/pkg-utils.inc(1113): eval_once('pfblockerng_php...')
#5 /etc/rc.packages(80): delete_package_xml('pfBlockerNG', 'deinstall')
#6 {main}
  thrownpkg-static: DEINSTALL script failed
[1/1] Deleting files for pfSense-pkg-pfBlockerNG-3.2.0_6: .......... done
Removing pfBlockerNG components...
Configuration... done.
>>> Removing stale packages... done.
Success
Actions #17

Updated by Marcos M 5 months ago

I tested this both on 23.05.1 and 23.09 but have not managed to replicate it. Both of the reported errors

PHP ERROR: Type: 1, File: /etc/inc/config.lib.inc, Line: 928, Message: Uncaught TypeError: Cannot access offset of type string on string in /etc/inc/config.lib.inc:928
PHP ERROR: Type: 1, File: /etc/inc/config.lib.inc, Line: 934, Message: Uncaught TypeError: Cannot access offset of type string on string in /etc/inc/config.lib.inc:934

refer to this line:

$revisions = intval(is_numericint($config['system']['backupcount']) ? $config['system']['backupcount'] : g_get('default_config_backup_count'));

I'm not sure how the error Cannot access offset of type string on string would happen - i.e. $config['system'] is a string instead of an array. This doesn't look to be an issue in the package.

Actions #18

Updated by Marcos M 5 months ago

  • Project changed from pfSense Packages to pfSense
  • Category changed from pfBlockerNG to Configuration Backend
  • Release Notes set to Default
Actions #19

Updated by Jordan G 5 months ago

are you testing with RAM disks enabled prior to installing pfBlockerNG? that seems to be the necessary catalyst to reproduce the issue

Actions #20

Updated by Loh Phat 5 months ago

RAM disks are in use in my environment, for the record.

Actions #21

Updated by Jordan G 5 months ago

quite similar, both ends of the spectrum though - https://redmine.pfsense.org/issues/13679

can I ask if you have IPv6 enabled under System>Advanced>Networking "allow ipv6"

Actions #22

Updated by Marcos M 5 months ago

  • Project changed from pfSense to pfSense Packages
  • Subject changed from pfBlocker-NG-devel 3.2.0_3 not uninstalling on 23.01 to pfBlockerNG does not uninstall cleanly when using RAM disks
  • Category changed from Configuration Backend to pfBlockerNG
  • Status changed from Feedback to Resolved
  • Assignee set to Marcos M
  • Release Notes deleted (Default)
Actions #23

Updated by Loh Phat 5 months ago

Jordan G wrote in #note-21:

quite similar, both ends of the spectrum though - https://redmine.pfsense.org/issues/13679

can I ask if you have IPv6 enabled under System>Advanced>Networking "allow ipv6"

Yes. I'm running IPv6.

Actions #24

Updated by Loh Phat 5 months ago

I wonder if this will fix the slow startup time for pfBlockerNG-dev with RAM disks enabled.

There's a long delay (approx 90s) between the patch manager loading and pfB loading:

Starting package System Patches...done.
load: 1.44  cmd: sleep 65165 [nanslp] 5.60r 0.00u 0.00s 0% 2088k
load: 1.41  cmd: php-cgi 80287 [nanslp] 74.60r 1.03u 0.11s 0% 37800k
load: 1.41  cmd: php-cgi 80287 [nanslp] 77.43r 1.03u 0.11s 0% 37800k
load: 1.32  cmd: php-cgi 80287 [nanslp] 91.92r 1.03u 0.11s 0% 37800k
load: 1.25  cmd: php-cgi 80287 [nanslp] 105.45r 1.03u 0.11s 0% 37800k
load: 1.21  cmd: php-cgi 80287 [nanslp] 116.29r 1.03u 0.11s 0% 37800k
 Starting package pfBlockerNG-devel...done.
Actions

Also available in: Atom PDF