Linux Binary Compatibility - Constant segfaults?

So I've been trying to get a linux binary running on my FreeBSD server for a little bit now. I've loaded all the correct modules that were stated. Here's the output of kldstat:
Code:
[root@bsd ~]# kldstat
Id Refs Address            Size     Name
 1   28 0xffffffff80200000 1f6e480  kernel
 2    1 0xffffffff82170000 12cd0    linprocfs.ko
 3    5 0xffffffff82183000 dfa0     linux_common.ko
 4    1 0xffffffff82191000 7fe0     linsysfs.ko
 5    1 0xffffffff82199000 147f8    tmpfs.ko
 6    1 0xffffffff82221000 2836     pflog.ko
 7    1 0xffffffff82224000 34d5c    pf.ko
 8    1 0xffffffff82259000 4286e    linux.ko
 9    1 0xffffffff8229c000 3c947    linux64.ko
The fstab:
Code:
[root@bsd ~]# cat /etc/fstab
# Device    Mountpoint    FStype    Options    Dump    Pass#
/dev/ada0s1a    /        ufs    rw    1    1
/dev/ada0s1b    none        swap    sw    0    0
/dev/ada0s1d    /usr        ufs    rw    2    2
/dev/ada0s1e    /var        ufs    rw    2    2
linprocfs   /compat/linux/proc    linprocfs    rw    0    0
linsysfs    /compat/linux/sys    linsysfs    rw    0    0
tmpfs    /compat/linux/dev/shm    tmpfs    rw,mode=1777    0    0
If it makes any difference, I did install linux_base-c7 from pkg rather than the port. As an example of what happens when I try to run any Linux binary:
Code:
[root@bsd ~]# /compat/linux/usr/bin/uname
Segmentation fault (core dumped)
As suggested in the documentation, I tried using brandelf to no avail.
Code:
[root@bsd ~]# brandelf -t Linux /compat/linux/usr/bin/uname
[root@bsd ~]# /compat/linux/usr/bin/uname
Segmentation fault (core dumped)
I even tried appending the line
Code:
compat.linux.osrelease=2.6.32
to /etc/sysctl.conf which I read on an old bugzilla report apparently helped, which resulted in any binary returning "FATAL: Kernel too old", presumably because the version of gcc against which they had been compiled was too new. I also tried appending
Code:
compat.linux.osrelease=3.10.0
seeing as this is the kernel release which ships with CentOS 7, but the segfaults continued. Does anyone have any clue as to what the hell is going on, and what I could do to try and diagnose this? Many thanks!
 
Could you please revert all of your tweaks and run truss /compat/linux/usr/bin/uname?

I even tried appending the line
Code:
compat.linux.osrelease=2.6.32
to /etc/sysctl.conf which I read on an old bugzilla report apparently helped, which resulted in any binary returning "FATAL: Kernel too old"

It's actually a default setting and it certainly does work with linux-c7-* packages.
 
Hmm - I seem to have accidentally fixed the problem by running mount -a while testing an unrelated change to the fstab. This doesn't make much sense to me so I will keep investigating!
EDIT: I think I have found the problem. I was trying to run a specific binary. I ran ldd on my Linux desktop and copied across the SOs, but of course those SOs are compiled with a much newer version of GCC. I imagine I will need to create a CentOS 7 VM, compile the required libraries there and copy them across. However I'm still at a loss as to why this would cause even uname to segfault seeing as it doesn't require any of the aforementioned libraries.
 
Back
Top