Linux binary not working despite linux compatibility enabled

Trying to install a linux binary - already have enabled compatibility with kldstat showing the relevant files

However when running the binaries it complains about `libm`,`libc` not found
/home/c/.foundry/bin/forge: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /home/c/.foundry/bin/forge

It complains about various versions of GLIBC 2.27,2.29,2.25,2.18 etc

How do I get it to work? 13.2 here
 
That's an issue with the userland. The Centos-7 userland installed by linux-* ports is just too old.

You could try installing some other userland (e.g. Ubuntu) in a jail and use the software there. There are quite a few resources about that, also on these forums.
 
You could try installing some other userland (e.g. Ubuntu) in a jail and use the software there. There are quite a few resources about that, also on these forums.
I wanted to install it on the main machine instead of a jail - since the binaries need to interact with other programs on the system. What is the best way forward?

This is the output on my machine - userland is installed I suppose?

ls -al /compat/linux/
total 77
drwxr-xr-x 10 root wheel 15 Mar 30 04:58 .
drwxr-xr-x 4 root wheel 4 Mar 30 20:59 ..
lrwxr-xr-x 1 root wheel 7 Apr 11 2018 bin -> usr/bin
dr-xr-xr-x 13 root wheel 512 Jul 13 18:20 dev
drwxr-xr-x 25 root wheel 64 Mar 30 04:58 etc
lrwxr-xr-x 1 root wheel 7 Apr 11 2018 lib -> usr/lib
lrwxr-xr-x 1 root wheel 9 Apr 11 2018 lib64 -> usr/lib64
drwxr-xr-x 2 root wheel 2 Mar 30 04:58 opt
dr-xr-xr-x 1 root wheel 0 Aug 3 20:50 proc
lrwxr-xr-x 1 root wheel 8 Feb 18 05:10 run -> /var/run
lrwxr-xr-x 1 root wheel 8 Apr 11 2018 sbin -> usr/sbin
drwxr-xr-x 2 root wheel 2 Mar 30 04:58 srv
dr-xr-xr-x 1 root wheel 0 Aug 3 20:50 sys
drwxr-xr-x 8 root wheel 9 Mar 30 04:58 usr
drwxr-xr-x 16 root wheel 17 Mar 30 04:58 var

 
I wanted to install it on the main machine instead of a jail - since the binaries need to interact with other programs on the system. What is the best way forward?
You can still install some Linux distribution to a jail and then use the jail's path for sysctl compat.linux.emul_path, therefore completely replacing the official userland from ports/packages. Downside is that you'll have to maintain that manually and using ports/packages of Linux software relying on the centos-7 userland might have issues.

Another, more cumbersome approach would be to find all the required newer libs, place them in some separate directory and patch rpath in your Linux binary, e.g. using sysutils/patchelf.
 
You can still install some Linux distribution to a jail and then use the jail's path for sysctl compat.linux.emul_path, therefore completely replacing the official userland from ports/packages
Currently I have this

sysctl compat.linux.emul_path
compat.linux.emul_path: /compat/linux

I also have ubuntu jail installed (`/compat/ubuntu`)- where I actually have the version of software working perfectly fine. Could you elaborate on this about what the path needs to be set?
Downside is that you'll have to maintain that manually and using ports/packages of Linux software relying on the centos-7 userland might have issues.
Do you mean I it will be problematic across software upgrades? That's fine for now - I am not assuming long term usage of the software
 
Some notes before starting it. You need to choose which LINUX_COMPAT are you using on FreeBSD. You can not use both the default CentOS based layer under /compat/linux and another one with Ubuntu based layer under /compat/ubuntu for example. To use the Ubuntu based layer the script will set the compat.linux.emul_path variable to /compat/ubuntu dir. Also under the /etc/rc.conf variable linux_enable=YES will be replaced by ubuntu_enable=YES one.
I came across this from this article. Is this what you were referring to zirias@ ?

I would imagine this solution also requiring to
Code:
chroot  /compat/ubuntu bash
in orde r to run the binaries - or will it be able to run the binaries "normally" like they exist on the FreeBSD system?

Reporting some progress :
1) Changed emul_path to /compat/ubuntu
reloaded sysctil to reflect the same

The previous errors complaining about GLIBC/libc/libm totally disappeared. Guessing that means some progress? 🤔

However, now trying to run the binary gives the following error:
ELF interpreter /lib64/ld-linux-x86-64.so.2 not found, error 2

Not sure how to proceed - any help would be appreciated.
 
Back
Top