Fixing a Broken pkg Database

In rare edge cases it is possible for the pkg database in /var/db/pkg/ to become corrupted. In the unlikely event this happens to a firewall, it can usually be corrected by running a few commands to re-create the database.

Note

The following commands only account for the base system of a typical CE full installation.

  1. Ensure that the package database directory exists:

    /bin/mkdir -p /var/db/pkg/ /root/var/db/pkg/
    
  2. Force an update of the package repository data:

    /usr/local/sbin/pkg-static update -f
    
  3. Force a reinstall of the pfSense® base package and kernel:

    /usr/local/sbin/pkg-static install -yf pkg pfSense pfSense-kernel-pfSense
    
  4. Refresh the php.ini and other files to ensure they are loading the correct modules:

    /etc/rc.php_ini_setup
    
  5. If any additional packages were installed, reinstall them manually using the GUI if possible, or by using pkg-static install as above:

    /usr/local/sbin/pkg-static install -yf <additional-package> <another-additional-package>