It seems patience was the only culprit here;  About 5 minutes after I sent
this, likely a good 10 minutes after I tried to re-initialize the DB and
re-import the Fingerbank data, I received an email from PF indicating
success.

Our last action to stop pf services, re-install fingerbank and then retry
the DB initialize and fingerbank import was successful.

To recap, we recently updated to 7.4.  On one instance, it seems our mysql
db connection info was left out of the fingerbank.conf.   This led to
errors like:

Mar  4 06:46:00 pf2 pfqueue: pfqueue(3135) ERROR: [mac:c0:d3:c0:59:b7:7b]
DBIx::Class::Storage::DBI::_prepare_sth(): DBI Exception: DBD::SQLite::db
prepare_cached failed: database disk image is malformed [for Statement
"SELECT COUNT( * ) FROM dhcp_fingerprint me WHERE ( value = ? )"] at
/usr/local/pf/lib/fingerbank/Base/CRUD.pm line 416

We added back the [mysql] section in fingerbank.conf and tested them with
db ping. But could not successfully re-import the Fingerbank db into mysql
using the GUI actions.

[mysql]
state=enabled
username=pf
password=<password>
database=pf_fingerbank

pf2:/usr/local/pf/logs# mysqladmin ping -upf -p
Enter password:
mysqld is alive

Stopping the services and reinstalling fingerbank seemed to resolve the DB
import failing.


pf2:/usr/local/pf/logs# /usr/local/pf/bin/pfcmd service pf stop
...
pf2:/usr/local/pf/logs# service packetfence-config stop

pf2:/usr/local/pf/logs# apt-get install fingerbank --reinstall
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not
upgraded.
Need to get 0 B/236 MB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 86339 files and directories currently installed.)
Preparing to unpack .../fingerbank_3.1.1-1_all.deb ...
Unpacking fingerbank (3.1.1-1) over (3.1.1-1) ...
Setting up fingerbank (3.1.1-1) ...
DBIx::Class::Schema::Versioned::upgrade(): Upgrade not necessary at db/
upgrade.pl line 59
pf2:/usr/local/pf/logs#

Prior to this last step, we received the following email after trying to
re-initialize and import the fingerbank DB from the compliance settings GUI.

Subject: PF Alert: Failed to import Fingerbank data inside MySQL

Output of the command was : perl -I/usr/local/fingerbank/lib
-Mfingerbank::DB_Factory -e 'my () =
fingerbank::DB_Factory->instantiate(type => "MySQL", schema =>
"Upstream")->initialize_from_sqlite("/usr/local/fingerbank/db/fingerbank_Upstream.db")
; exit 1 if( != 200)'
Log4perl: Seems like no initialization happened. Forgot to call init()?
ERROR 1008 (HY000) at line 1: Can't drop database 'pf_fingerbank'; database
doesn't exist
Makefile:15: recipe for target 'init-mysql' failed
make: *** [init-mysql] Error 1

After the re-install we tried again, and received

Subject: PF Alert: Successfully imported the Fingerbank data inside MySQL

At no point we received any db initialization emails so it is not clear if
that step was ever executed, or part of the solution, but it was dispatched
from the GUI prior to failed and successful imports.

cheers,
Ian

On Sun, Mar 4, 2018 at 3:00 PM, Ian MacDonald <i...@netstatz.com> wrote:

> Hello,
>
> We are running current v7.4 on Debian 8.
>
> On one of our servers, it seems the fingerbank db will not initialize
> properly.
>
> In our logs, we see similar to below:
>
> Mar  4 14:51:08 pf2 packetfence_httpd.aaa: httpd.aaa(1142) ERROR:
> [mac:fc:c2:de:9e:7e:3b] Unable to compute Fingerbank device information for
> fc:c2:de:9e:7e:3b. Device profiling rules relying on it will not work.
> (DBIx::Class::Storage::DBI::_dbh_execute(): Table 'pf_fingerbank.device'
> doesn't exist at /usr/local/pf/lib/fingerbank/Base/CRUD.pm line 416
> Mar  4 14:51:22 pf2 pfqueue: pfqueue(1268) ERROR: [mac:74:f0:6d:32:56:27]
> DBIx::Class::Storage::DBI::_dbh_execute(): Table 
> 'pf_fingerbank.dhcp_fingerprint'
> doesn't exist at /usr/local/pf/lib/fingerbank/Base/CRUD.pm line 416
>
> We tried to stop services and re-install fingerbank (apt --reinstall) with
> no luck.
>
> Inside the PF GUI, it suggests that it can successfully dispatch the
> initialize DB function, but it does not seem to result in creation of the
> tables.
>
> The mysql user can ping the DB from the command line as configured in
> fingerbank.conf.
>
> We can't seem to find any logs related to the initialization command from
> the GUI
>
> Any help appreciated.
>
> cheers,
> Ian
>
> pf2:/usr/local/pf/logs# ls -al ../../fingerbank/db
> total 5463520
> drwxrwxr-x 3 fingerbank fingerbank       4096 Mar  4 14:49 .
> drwxrwxr-x 8 fingerbank fingerbank       4096 Mar  4 14:49 ..
> -rw-rw-r-- 1 root       root               98 Dec  1 10:04 .gitignore
> -rw-rw-r-- 1 root       root        504208005 Dec  1 10:04
> fingerbank_Combination_Map.json
> -rw-rw-r-- 1 fingerbank fingerbank      33792 May 26  2017
> fingerbank_Local.db
> -rw-rw-r-- 1 fingerbank fingerbank 1049072740 Dec  1 10:04
> fingerbank_Upstream.db
> -rw-r--r-- 1 pf         pf         2020635648 Nov 22 21:43
> fingerbank_Upstream.db_20171122_214310
> -rw-r--r-- 1 pf         pf         2020635648 Nov 23 21:43
> fingerbank_Upstream.db_20171123_214310
> -rw-rw-r-- 1 root       root             1072 Dec  1 10:04
> sqlite3-to-mysql.py
> drwxrwsr-x 2 root       root             4096 Mar  4 14:49 upgrade
> -rwxrwxr-x 1 fingerbank fingerbank       2253 Dec  1 10:04 upgrade.pl
>
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
PacketFence-users mailing list
PacketFence-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/packetfence-users

Reply via email to