dbashyam has asked for the wisdom of the Perl Monks concerning the following question:

Hi I run a perl script, it is able to run as root but not as non-root. When I run as non-root it gives me the following error
install_driver(Sybase) failed: Can't locate DBD/Sybase.pm in @INC (@IN +C contains: /opt/nms/perl/lib /opt/nms/perl/lib64/perl5/site_perl/5.8 +.8/x86_64-linux-thread-multi /opt/nms/perl/lib/perl5/site_perl/5.8.8 +/opt/nms/perl/lib/perl5/site_perl /usr/local/lib64/perl5 /usr/local/s +hare/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl +/usr/lib64/perl5 /usr/share/perl5 .) at (eval 3) line 3. Perhaps the DBD::Sybase perl module hasn't been fully installed, or perhaps the capitalisation of 'Sybase' isn't right. Available drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge.
Any idea why it gives this error Thanks,

Replies are listed 'Best First'.
Re: perl script to run as non-root
by roboticus (Chancellor) on Oct 16, 2014 at 14:03 UTC

    dbashyam:

    It sounds like either:

    • You may be running a different perl than the default system perl (which is a good idea), and that perl doesn't have DBD::Sybase installed. If this is the case, then you need to install DBD::Sybase for the perl you're using.
    • You may have a slightly different setup than the root account does for perl. For example, I use the PERL5LIB environment variable to tell perl where to look for my personal libraries. Perhaps the root account is doing something like that to locate the DBD::Sybase package.
    • You may be using the same perl and the same include path, but you may be missing permission to access some directory or directories.

    I'd start by checking perl --version in your account and the root account to see if they're the same or not. Then I'd try perl -e 'print join("\n",@INC)' on both accounts to see if there are any differences. Finally, I'd check the directory permissions on the path to .../DBD/Sybase.pm to see if you have permissions to access it.

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Thanks for your replies, The only difference I find is when I run this command as "root' I get the below output perl -e 'print join("\n",@INC)' /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 While I run as non-root I get the below output: perl -e 'print join("\n",@INC)' /opt/nms/perl/lib /opt/nms/perl/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /opt/nms/perl/lib/perl5/site_perl/5.8.8 /opt/nms/perl/lib/perl5/site_perl /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 Actually there is no perl folder inside the /opt/nms/ but not sure how it is showing that. Will that be an issue? But apart from that I checked the permission of Sybase.pm and the path where the Sybase.pm is all seems to be fine. Thanks,

        Hi,

        and where have you found DBD/Sybase.pm?

        Is there any Sybase related environment variable for user root?

        McA

        dbashyam:

        Based on the path differences, I'd guess that you have a different perl. It seems that the system perl is using /usr/local/* and /usr/share/perl5/*, while the perl your account uses accesses /opt/nms/perl/*. Check with your system administrator to find out how to get access to the Sybase libraries (if they're installed), or how to change your path so that you can use the system perl (if that's allowed).

        By the way: it would've been a lot easier to look at if you put the output in code tags...

        ...roboticus

        When your only tool is a hammer, all problems look like your thumb.

Re: perl script to run as non-root
by McA (Priest) on Oct 16, 2014 at 14:02 UTC

    Hi,

    the error is really self explaining. Perl is looking for a file named Sybase.pm in a directory DBD. The directories where Perl is looking for that file are enumerated in the error message.

    So, as user root you do a perl -E'print map "$_\n", @INC' and you'll see whether there is an additional path Perl will look for that file. Most probably the environment of root has some additional paths or is using a different Perl environment.

    Regards
    McA

Re: perl script to run as non-root
by karlgoethebier (Abbot) on Oct 16, 2014 at 16:59 UTC
      Thanks for your replies, i think i found what is my problem but I am bit new to this.

      I have the environment variable PERL5LIB to my preferred location which is /opt/nms/perl/lib/

      Where can i get the perl 5.10.1 x86_64-linux-thread-multi, can you please help here

      I need another info if i get the perl 5.10.1 x86_64-linux-thread-multi install as non-root, and then install DBI and DBD as non-root how to ensure that these libraries will sit only inside the PERL5LIB folder only.

      Thanks bunch.

        Hi Friends, I got it fixed. Installed the DBI, DBD:sybase modules and freetds modules and all is fine now. Thank you for all the support and the guidance/ideas that you gave me, it was really helpful