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

When I try to run a script that uses Net::SFTP::Foreign, it generates an error. Can someone explain what the error means and/or what is a possible solution? Thanks.

password authentication not available, IO::Pty is not installed or fai +led to load: Can't locate loadable object for module IO::Tty in @INC +(@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread- +multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/li +b64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/ +vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x +86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/lib64/perl5/ +site_perl/5.8.8/x86_64-linux-thread-multi/IO/Tty.pm line 30 Compilation failed in require at /usr/lib64/perl5/site_perl/5.8.8/x86_ +64-linux-thread-multi/IO/Pty.pm line 7. BEGIN failed--compilation aborted at /usr/lib64/perl5/site_perl/5.8.8/ +x86_64-linux-thread-multi/IO/Pty.pm line 7. Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/Net/SF +TP/Foreign/Backend/Unix.pm line 240. at test.pl line 9

However, the module is listed as installed in CPAN. And the permissions on it is -rwxr-xr-x root root. I am running the script as myself, a non-root user.

Module id = IO::Tty DESCRIPTION provide an interface to TTYs and PTYs CPAN_USERID RGIERSIG (Roland Giersig <RGiersig@cpan.org>) CPAN_VERSION 1.10 CPAN_FILE T/TO/TODDR/IO-Tty-1.10.tar.gz DSLI_STATUS RdcO (released,developer,C,object-oriented) MANPAGE IO::Tty - Low-level allocate a pseudo-Tty, import con +stants. INST_FILE /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread- +multi/IO/Tty.pm INST_VERSION 1.10 Module id = IO::Pty CPAN_USERID TODDR (Todd Rinaldo <toddr@cpan.org>) CPAN_VERSION 1.10 CPAN_FILE T/TO/TODDR/IO-Tty-1.10.tar.gz MANPAGE IO::Pty - Pseudo TTY object class INST_FILE /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread- +multi/IO/Pty.pm INST_VERSION 1.10 Module id = Net::SFTP::Foreign CPAN_USERID SALVA (Salvador Fandino Garcia <salva@cpan.org>) CPAN_VERSION 1.73 CPAN_FILE S/SA/SALVA/Net-SFTP-Foreign-1.73.tar.gz MANPAGE Net::SFTP::Foreign - SSH File Transfer Protocol clien +t INST_FILE /usr/lib/perl5/site_perl/5.8.8/Net/SFTP/Foreign.pm INST_VERSION 1.73

Replies are listed 'Best First'.
Re: Can't locate loadable object for module IO::Tty
by runrig (Abbot) on Jul 16, 2013 at 20:30 UTC
    It means that (assuming those are the correct directories for the pm files) even though the pm file is found, it can't find or can't load the files that shoud be in:
    /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/IO/Pty
    You probably need to reinstall the module. Or maybe more directories need to be included via 'use lib' or PERL5LIB (depending on what 'perl -V' says)?
      Thanks runrig. It was a permissions issue for the folders plopped over on /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto. Your tip also prompted me to search on what the auto folder is --> http://www.perlmonks.org/?node_id=568377, so bonus thank you.
Re: Can't locate loadable object for module IO::Tty
by Perlbotics (Archbishop) on Jul 16, 2013 at 20:30 UTC

    I would probably check...

    • if the files presented under INST_FILE above do really exist
    • if there are different versions of perl installed (PATH?)
    • if the value of PERL5LIB is suspicious
    • check permissions again:
    root> find /usr/lib/perl5 -perm 0700 -type d -ls root> find /usr/lib/perl5 -perm 0600 -type f -ls root> find /usr/lib64/perl5 -perm 0700 -type d -ls root> find /usr/lib64/perl5 -perm 0600 -type f -ls
    HTH

    Update: The find-checks above are intended to detect typical access permissions problems. They only show files or directories in case the permissions are not set correctly. Ideally, files have permission 0644 or 0444 and directories and libraries (*.so, etc.) 0755 or 0555. There was a copy/paste error in the previous version of the code above, but now it is fixed without markup (lib and lib64 were swapped one time).

    Often, when installing modules under Solaris (don't know what you have, but I observed it there regularly), permissions get set too restrictively - the find rules above can be helpful there. Other permissions like 0440 might also cause failures but personally, I didn't encountered them in the wild, yet. If you can install your own Perl, do it as a non-root user (e.g. perl5). That fixed the situation (here - YMMV) and feels a little saver when installing stuff.

    Concerning PERL5LIB, if it is not set, you usually do not need to bother. Since you installed the modules in standard locations, there is no need to set this environment variable in order to fix the problem described.

    You can fix the permissions of perllocal.pod but it will not fix your original problem. It would just allow anybody to read the local installation history by means of perldoc perllocal - which is not a bad thing either.

    If it is not a permission problem, re-installation - as suggested by runrig - might be the easiest way to fix it.

      Thanks Perlbotics.
      • Yes - the INST_FILEs really do exist with permissions 755 :)
      • There are... but I'm referencing the right version (I am defaulted to 5.8.8)
      • There is no PERL5LIB environment variable specified... should one always be specified?
      • It turned up another file where the permission was restricted for non-root user -- /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod -- should this be corrected as well?
        And, did you mean to swap the permissions around? Looks like it's the same two find commands repeated twice(?) I can see these commands being very helpful, so thanks again :)