# perl not working in moved jail



## dvl@ (Apr 2, 2012)

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:

```
$ perl -v | head -2

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


jail:


```
$ 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:


```
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.


```
[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.


----------



## fbsd1 (Apr 7, 2012)

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. *S*can the source for it "uglyperlhack".


----------



## gkontos (Apr 7, 2012)

From within a jail:


```
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:



> ```
> # 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.


----------



## dvl@ (Apr 9, 2012)

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.


----------



## dvl@ (Apr 9, 2012)

gkontos said:
			
		

> From within a jail:
> 
> 
> ```
> ...



Yes.  Indeed.  Thank you.

This is in the jail:


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

However, and this is the key!

```
$ /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:

```
[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.


----------

