scanpbnj: install_driver(CSV) failed: Can’t locate DBD/CSV.pm in @INC
While playing around with pbnj or scanpbnj on Backtrack just a little bit ago I received an error when attempting to have scanpbnj output results to a CSV file. The error received is easily resolved by installing a single package on Backtrack. Below the error is described in more detail along with details about how to install the package that resolves the error message.
DBD/CSV Error Received When Outputting scanpbnj Results To A CSV File:
install_driver(CSV) failed: Can't locate DBD/CSV.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at (eval 79) line 3. Perhaps the DBD::CSV perl module hasn't been fully installed, or perhaps the capitalisation of 'CSV' isn't right. Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge, mysql. at /usr/local/bin/scanpbnj line 1900
The above error was output after modifying the /root/.pbnj-2.0/config.yaml file with “db: CSV” and “database: pbnjresults.csv” and then running “scanpbnj -i pbnjlist -p –dir pbnjdir/” from a Backtrack Terminal window. Luckily this is easy to resolve by installing the libdbd-csv-perl package in Backtrack as shown in the below example.
Install libdbd-csv-perl Using apt-get On Backtrack:
root@bt:~# apt-get install libdbd-csv-perl Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libdmraid1.0.0.rc16 python-pyicu libdebian-installer4 cryptsetup libecryptfs0 reiserfsprogs rdate bogl-bterm ecryptfs-utils libdebconfclient0 dmraid Use 'apt-get autoremove' to remove them. The following extra packages will be installed: libclone-perl libsql-statement-perl The following NEW packages will be installed: libclone-perl libdbd-csv-perl libsql-statement-perl 0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded. Need to get 199kB of archives. After this operation, 741kB of additional disk space will be used. Do you want to continue [Y/n]? Y Get:1 http://32.repository.backtrack-linux.org/ revolution/main libclone-perl 0.31-1build1 [14.3kB] Get:2 http://all.repository.backtrack-linux.org/ revolution/main libsql-statement-perl 1.23-1 [154kB] Get:3 http://all.repository.backtrack-linux.org/ revolution/main libdbd-csv-perl 0.2600-1 [31.0kB] Fetched 199kB in 0s (298kB/s) Selecting previously deselected package libclone-perl. (Reading database ... 237523 files and directories currently installed.) Unpacking libclone-perl (from .../libclone-perl_0.31-1build1_i386.deb) ... Selecting previously deselected package libsql-statement-perl. Unpacking libsql-statement-perl (from .../libsql-statement-perl_1.23-1_all.deb) ... Selecting previously deselected package libdbd-csv-perl. Unpacking libdbd-csv-perl (from .../libdbd-csv-perl_0.2600-1_all.deb) ... Processing triggers for man-db ... Setting up libclone-perl (0.31-1build1) ... Setting up libsql-statement-perl (1.23-1) ... Setting up libdbd-csv-perl (0.2600-1) ... root@bt:~#
After installing libdbd-csv-perl I was able to run the same command and the results were output properly to CSV files named machine and services in the directory specified in the command. I will be writing a mini pbnj howto in the near future.