perl not working in moved jail

dvl@

Developer
As recently posted, I have moved some jails from one server to another. Key to the issue is: these jails originated on another system, with [what I am sure was] a different version of perl

perl in the jails is not working. It works fine on the host.

host:
Code:
$ perl -v | head -2

This is perl, v5.10.1 (*) built for amd64-freebsd


jail:

Code:
$ perl -v
/libexec/ld-elf.so.1: Shared object "libperl.so" not found, required by "perl"

$ pkg_info | grep perl
p5-Error-0.17016    Perl module to provide Error/exception support for perl: Er
perl-5.8.9_3        Practical Extraction and Report Language

My first attempt at upgrading in the jail fails. I think the critical part is:

Code:
Creating various symlinks in /usr/bin...
    Backing up /usr/bin/perl as /usr/bin/perl.freebsd
mv: rename /usr/bin/perl to /usr/bin/perl.freebsd: Read-only file system
    *** /usr/bin/perl is still there, which should not happen
    Symlinking /usr/local/bin/perl5.8.9 to /usr/bin/perl5
ln: /usr/bin/perl5: Read-only file system
Done.

After upgrading, the system *thinks* it has upgraded but it as not and the problem persists.

Code:
[root@mysql41 /home/dan]# pkg_info | grep perl
p5-Error-0.17016    Perl module to provide Error/exception support for perl: Er
perl-5.8.9_7        Practical Extraction and Report Language
[root@mysql41 /home/dan]# perl -v
/libexec/ld-elf.so.1: Shared object "libperl.so" not found, required by "perl"
[root@mysql41 /home/dan]#

Ideas? Suggestions?

I'm thinking ezjail-admin update -ip, but I'm sure I've already done that.
 
ezjail has some hidden control files in /etc or /usr/local/etc that have to be copied to the new box where you placed the /usr/jails/directory tree.

On the subject of perl, ezjail has its own internal link it creates during the create jail process. Scan the source for it "uglyperlhack".
 
From within a jail:

Code:
pbx# ls -alh /usr/bin/perl
lrwxr-xr-x  1 root  wheel    19B Apr  2 11:55 /usr/bin/perl -> /usr/local/bin/perl

From ezjail.conf:

Code:
# base jail will provide a soft link from /usr/bin/perl to /usr/local/bin/perl
# to accomodate all scripts using '#!/usr/bin/perl'...
ezjail_uglyperlhack="YES"

Maybe when you moved the jail the symbolic links were lost. I always use dump/restore for UFS and ZFS send for ZFS based jails.
 
fbsd1 said:
ezjail has some hidden control files in /etc or /usr/local/etc that have to be copied to the new box where you placed the /usr/jails/directory tree.

That wouldn't be good if the new host was already running jails. You don't just want to copy over the configuration files.
 
gkontos said:
From within a jail:

Code:
pbx# ls -alh /usr/bin/perl
lrwxr-xr-x  1 root  wheel    19B Apr  2 11:55 /usr/bin/perl -> /usr/local/bin/perl

Yes. Indeed. Thank you.

This is in the jail:

Code:
 $ ls -alh /usr/bin/perl
-rwxr-xr-x  1 root  wheel     7k Aug 14  2010 /usr/bin/perl

However, and this is the key!
Code:
 $ /usr/local/bin/perl -v

This is perl, v5.8.9 built for amd64-freebsd
(with 1 registered patch, see perl -V for more detail)
...

The 'other' perl works just fine.

My solution, on the host system:
Code:
[root@kraken /usr/jails/basejail/usr/bin]# ls -l perl
-rwxr-xr-x  1 root  wheel  7144 Aug 14  2010 perl
[root@kraken /usr/jails/basejail/usr/bin]# mv -i perl perl.ORIGINAL
[root@kraken /usr/jails/basejail/usr/bin]# ln -s /usr/local/bin/perl
[root@kraken /usr/jails/basejail/usr/bin]# ls -l perl
lrwxr-xr-x  1 root  wheel  19 Apr  9 12:04 perl -> /usr/local/bin/perl
[root@kraken /usr/jails/basejail/usr/bin]#

Perl now works. Because this is done in the basejail, the change instantly fixes all other jails.
 
Back
Top