Solved Running a factorio server using binary compatibility mode

The Problem

I'm trying to get a headless game server for the game https://factorio.com/ to run on freeBSD. The server is a linux binary. I'm on freeBSD 13, uname:

Code:
FreeBSD cabal 13.0-RELEASE-p4 FreeBSD 13.0-RELEASE-p4 #0: Tue Aug 24 07:33:27 UTC 2021     root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64

Output of the file command:

Code:
❯ file factorio
factorio: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, with debug_info, not stripped

When I try to run factorio using linux binary compatibility I get this error:

Code:
❯ ./factorio
./factorio: relocation error: /lib/libc.so.6: symbol _dl_exception_create, version GLIBC_PRIVATE not defined in file ld-linux-x86-64.so.2 with link time reference

The output of ldd is this:

Code:
❯ ldd factorio
factorio:
linux_vdso.so.1 => (0x00007ffffffff000)
librt.so.1 => /lib64/librt.so.1 (0x0000000802e00000)
libdl.so.2 => /lib64/libdl.so.2 (0x0000000803200000)
libm.so.6 => /lib64/libm.so.6 (0x0000000803600000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x0000000803a00000)
libc.so.6 => /lib/libc.so.6 (0x0000000802a2e000)
/lib64/ld-linux-x86-64.so.2 (0x0000000802a06000)

What I've Tried

As suggested in the handbook I have looked for the /lib64/ld-linux-x86-64.so.2 library. It was already present in /compat/linux/lib64, symlinked to ld-2.17.so. Assuming the problem was with that library I copied the version from my arch system to the freeBSD server, which was 2.33, and changed the symlink. That resulted in this output:

Code:
❯ ldd factorio
factorio:
FATAL: kernel too old
factorio: exit status 127

❯ ./factorio
FATAL: kernel too old

I then increased compat.linux.osrelease, but I had to go as far as 5.something before the behavior changed, I then got ./factorio: error while loading shared libraries: librt.so.1: wrong ELF class: ELFCLASS32.

My other idea was to run the server in a VM, but as the server is a rented virtual server itself I don't have VT-x available and therefore can't run bhyve.

Does anyone have any ideas how I could get the factorio server to run on this machine using binary compatibility?

Also, I remember trying this back on freeBSD 12 with linux_base-c6, maybe parts of my /compat/linux/ fs are messed up. Can I somehow get rid of all of that and reinstall it completely fresh?

Update:
It seems my /compat/linux/ was indeed messed up, after removing linux_base-c7, deleting /compat/linux/usr and reinstalling the package I now get the this error:

Code:
❯ ./factorio
./factorio: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by ./factorio)

❯ ldd factorio
factorio:
factorio: /lib64/libc.so.6: version `GLIBC_2.18' not found (required by factorio)
        linux_vdso.so.1 =>  (0x00007ffffffff000)
        librt.so.1 => /lib64/librt.so.1 (0x0000000802e00000)
        libdl.so.2 => /lib64/libdl.so.2 (0x0000000803200000)
        libm.so.6 => /lib64/libm.so.6 (0x0000000803600000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000000803a00000)
        libc.so.6 => /lib64/libc.so.6 (0x0000000803e00000)
        /lib64/ld-linux-x86-64.so.2 (0x0000000802a06000)

So it seems I require a newer libc.

Update2: Solved

I got it to work using LinuxJails / sysutils/Debootstrap. I followed this article: https://wiki.freebsd.org/LinuxJails, then ran the server inside a chroot of ubuntu bionic.
 
Back
Top