# Linuxlator in Jail



## pathiaki (Feb 12, 2015)

Hi,

I am forced to use the linux-sun-jdk17 to get a piece of software running.  The openjdk does not run and crashes.  I want to run this in a jail.

How do you run the linuxlator in a jail?

What has to be setup on the host machine?

What has to be setup in the jail environment?

Thank you,

P.

PS - searching for 'linuxlator jail' didn't produce this.  I tried several searches.  Nothing truly relevant.


----------



## pathiaki (Feb 12, 2015)

So, anyhow, I installed linux-sun-jdk17 in a jail.  It has the necessary entry in /etc/fstab.linuxjava where linuxjava is the name of my jail, to mount linprocfs:


```
/jails/basejail /jails/linuxjava/basejail nullfs ro 0 0
linproc /jails/linuxjava/usr/compat/linux/proc linprocfs rw 0 0
```

The jail is restarted to make sure this takes affect.

and running `mount | grep -i linuxjava` on the host yields:


```
zroot/jails/linuxjava on /jails/linuxjava (zfs, local, nfsv4acls)
procfs on /jails/linuxjava/proc (procfs, local)
/jails/basejail on /jails/linuxjava/basejail (nullfs, local, read-only)
linprocfs on /jails/linuxjava/usr/compat/linux/proc (linprocfs, local)
devfs on /jails/linuxjava/dev (devfs, local, multilabel)
fdescfs on /jails/linuxjava/dev/fd (fdescfs)
```

However, running `java -version` yields:


```
/usr/local/linux-sun-jdk1.7.0/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory
```

So....  Have to see if that file exists......

Run the command `find . -name libjli.so -print`

from /usr/local/linux-sun-jdk17 yields:


```
./lib/i386/jli/libjli.so
./jre/lib/i386/jli/libjli.so
```

Anyone have some insight here?

Thanks!


----------



## pathiaki (Feb 12, 2015)

Ok.... on to the next step.  Since I have that error I google for it.

It seems it has something to do with LD_LIBRARY_PATH ??!!!

Anyhow, I add the following to my path:

`# export LD_LIBRARY_PATH=/usr/local/linux-sun-jdk1.7.0/jre/lib/i386/jli java`

I then run:  `java -version`

Oooo.... shiny.....


```
Java HotSpot(TM) Client VM warning: Can't detect initial thread stack location - find_vma failed
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) Client VM (build 24.75-b04, mixed mode)
```

Now, this error lead me to a search that showed the above error seems to point at not being able to see linprocfs....


----------



## eydaimon (Jul 27, 2018)

```
sudo kldload linprocfs

sudo mount -t linprocfs linproc /compat/linux/proc
```

is what's necessary to fix that error


----------



## Chris_H (Jul 27, 2018)

I'd like to add, since I didn't see it mentioned above. That the _host_ will need to have the "linuxulator" loaded, as well. As in either;
loader.conf(5):
`linux_load="YES"`
or in
rc.conf(5)
`kld_list="linux"`
unless it was was already built into your kernel.

--Chris


----------

