[0.12] [Oxyd] Headless mode is unusable

This subforum contains all the issues which we already resolved.
cpw
Long Handed Inserter
Long Handed Inserter
Posts: 59
Joined: Tue Aug 12, 2014 3:47 pm
Contact:

[0.12] [Oxyd] Headless mode is unusable

Post by cpw »

Hi
So the "headless mode" is pretty much unusable for 0.12 on Linux (probably your #1 target for a headless install). The list of libraries required by the factorio binary is prohibitive on most headless environments
(also, you require a very new version of libc by the looks of things - certainly not very compatible).

ldd ./bin/x64/factorio
./bin/x64/factorio: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.14' not found (required by ./bin/x64/factorio)
./bin/x64/factorio: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.15' not found (required by ./bin/x64/factorio)
./bin/x64/factorio: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.15' not found (required by ./bin/x64/factorio)
linux-vdso.so.1 => (0x00007fffd7df1000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f61c1000000)
libasound.so.2 => not found
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f61c0cc4000)
libXcursor.so.1 => not found
libXinerama.so.1 => not found
libXrandr.so.2 => not found
libXi.so.6 => not found
libGL.so.1 => not found
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f61c0aba000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f61c0838000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f61c0622000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f61c0296000)
/lib64/ld-linux-x86-64.so.2 (0x00007f61c1222000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f61c0076000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f61bfe72000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f61bfc6e000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f61bfa69000)

Most of those libs are not going to be found and are probably not going to be easily installable on a headless server.

My suggestion is to make a special "headless" binary, that has those lib dependencies stripped, somehow.

NoPantsMcDance
Filter Inserter
Filter Inserter
Posts: 478
Joined: Fri Jul 17, 2015 6:56 pm
Contact:

Re: [0.12] Headless mode is unusable

Post by NoPantsMcDance »

I'm using Ubuntu 14.04 and I get a much different error. The server starts up fine but the instant I connect the server crashes and gives this error.
http://pastebin.com/4VUS9aWq
Looking for a multiplayer server? Check out my servers Vanilla Server

Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [0.12] Headless mode is unusable

Post by Oxyd »

What's the difficulty in installing these libraries? You don't need an actual working X server, just the libraries.

cpw
Long Handed Inserter
Long Handed Inserter
Posts: 59
Joined: Tue Aug 12, 2014 3:47 pm
Contact:

Re: [0.12] Headless mode is unusable

Post by cpw »

You assume that someone is able to install a bunch of X libraries onto a headless server. That's not a good thing. Most hosting services will never give you root, or anything like it, so you'll get what we pretty much have at forgecraft - little that involves client libs. I would rather keep it that way. So if you require a bunch of desktop libs, don't anticipate being able to work on a hosted environment anytime soon..

NoPantsMcDance
Filter Inserter
Filter Inserter
Posts: 478
Joined: Fri Jul 17, 2015 6:56 pm
Contact:

Re: [0.12] Headless mode is unusable

Post by NoPantsMcDance »

cpw wrote:You assume that someone is able to install a bunch of X libraries onto a headless server. That's not a good thing. Most hosting services will never give you root, or anything like it, so you'll get what we pretty much have at forgecraft - little that involves client libs. I would rather keep it that way. So if you require a bunch of desktop libs, don't anticipate being able to work on a hosted environment anytime soon..
What linux distro and version are you running. Also what command are you running to start the server? My ubuntu install is fairly fresh and I didn't manually install any of these libraries.
Looking for a multiplayer server? Check out my servers Vanilla Server

Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [0.12] Headless mode is unusable

Post by Oxyd »

What we really anticipated was allowing people to run Factorio on their own machines or at least machines where they can install the necessary dependencies. Separate headless binary would be very nice, but tearing Allegro out of Factorio is no small task, so don't anticipate being able to run Factorio in your environment anytime soon either.

cpw
Long Handed Inserter
Long Handed Inserter
Posts: 59
Joined: Tue Aug 12, 2014 3:47 pm
Contact:

Re: [0.12] Headless mode is unusable

Post by cpw »

Oxyd wrote:What we really anticipated was allowing people to run Factorio on their own machines or at least machines where they can install the necessary dependencies. Separate headless binary would be very nice, but tearing Allegro out of Factorio is no small task, so don't anticipate being able to run Factorio in your environment anytime soon either.
Understood, but it's not really a server only binary. It's a "lightweight UI-less" mode. You still need to have access to all the stuff a desktop has. I find it disappointing that you trail such a great new feature and then step back and say "yeah, actually, we're pretty much gonna still only work on desktops, so don't bother".
NoPantsMcDance wrote:What linux distro and version are you running. Also what command are you running to start the server? My ubuntu install is fairly fresh and I didn't manually install any of these libraries.
Forgecraft is running Debian Wheezy at present. We're hosted by the creeperhost guys - and I'd bet they'd love to add factorio to their portfolio of games.. As such, root is not a given, so I suspect that those enterprising individuals who would want to run this would have a real problem in such hosted environments. Ubuntu is a desktop distribution, I would fully expect it to install these libraries by default. For 99% of server installations, they're just a waste of disk space and clutter for the linker.

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: [0.12] Headless mode is unusable

Post by prg »

No need to install stuff as root, just put those libs in some user-writable directory and point LD_LIBRARY_PATH at it.
(Not linking against unnecessary libs would be the nicer solution of course)
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

NoPantsMcDance
Filter Inserter
Filter Inserter
Posts: 478
Joined: Fri Jul 17, 2015 6:56 pm
Contact:

Re: [0.12] Headless mode is unusable

Post by NoPantsMcDance »

Forgecraft is running Debian Wheezy at present. We're hosted by the creeperhost guys - and I'd bet they'd love to add factorio to their portfolio of games.. As such, root is not a given, so I suspect that those enterprising individuals who would want to run this would have a real problem in such hosted environments. Ubuntu is a desktop distribution, I would fully expect it to install these libraries by default. For 99% of server installations, they're just a waste of disk space and clutter for the linker.
Not sure what you mean by ubuntu being a desktop distribution when it has a server version. http://www.ubuntu.com/download/server regardless seems more of a problem with your host and not the factorio guys themselves.
Looking for a multiplayer server? Check out my servers Vanilla Server

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: [0.12] Headless mode is unusable

Post by prg »

NoPantsMcDance wrote:regardless seems more of a problem with your host and not the factorio guys themselves.
Linking against all that X stuff when it's not needed is an issue with Factorio.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

NoPantsMcDance
Filter Inserter
Filter Inserter
Posts: 478
Joined: Fri Jul 17, 2015 6:56 pm
Contact:

Re: [0.12] Headless mode is unusable

Post by NoPantsMcDance »

prg wrote:
NoPantsMcDance wrote:regardless seems more of a problem with your host and not the factorio guys themselves.
Linking against all that X stuff when it's not needed is an issue with Factorio.
I agree when it's not needed. I see no reason the host can't install those libs if you ask them though but that's just my thinking. I personally run a VPS and do everything myself .
Looking for a multiplayer server? Check out my servers Vanilla Server

Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [0.12] Headless mode is unusable

Post by Oxyd »

cpw wrote:Understood, but it's not really a server only binary. It's a "lightweight UI-less" mode.
That is correct, yes. Basically it is a replacement for the abomination that is this guide for previous versions.

cpw
Long Handed Inserter
Long Handed Inserter
Posts: 59
Joined: Tue Aug 12, 2014 3:47 pm
Contact:

Re: [0.12] Headless mode is unusable

Post by cpw »

NoPantsMcDance wrote:
prg wrote:
NoPantsMcDance wrote:regardless seems more of a problem with your host and not the factorio guys themselves.
Linking against all that X stuff when it's not needed is an issue with Factorio.
I agree when it's not needed. I see no reason the host can't install those libs if you ask them though but that's just my thinking. I personally run a VPS and do everything myself .
Of course. I understand. I just don't want a half dozen random big fat libs on a low disk server, cluttering things up. And for others that don't have the linux skills, these are likely a significant challenge.

NoPantsMcDance
Filter Inserter
Filter Inserter
Posts: 478
Joined: Fri Jul 17, 2015 6:56 pm
Contact:

Re: [0.12] Headless mode is unusable

Post by NoPantsMcDance »

cpw wrote:
NoPantsMcDance wrote:
prg wrote:
NoPantsMcDance wrote:regardless seems more of a problem with your host and not the factorio guys themselves.
Linking against all that X stuff when it's not needed is an issue with Factorio.
I agree when it's not needed. I see no reason the host can't install those libs if you ask them though but that's just my thinking. I personally run a VPS and do everything myself .
Of course. I understand. I just don't want a half dozen random big fat libs on a low disk server, cluttering things up. And for others that don't have the linux skills, these are likely a significant challenge.
It's completely understandable. I just don't see them removing those libs from the requirements anytime soon but it would be nice. So far from my experience I haven't got headless to work yet. Would love to see if other linux distros or users have gotten it to work.
Looking for a multiplayer server? Check out my servers Vanilla Server

Rockstar04
Fast Inserter
Fast Inserter
Posts: 171
Joined: Sun Feb 17, 2013 4:31 pm
Contact:

Re: [0.12] Headless mode is unusable

Post by Rockstar04 »

NoPantsMcDance wrote:I'm using Ubuntu 14.04 and I get a much different error. The server starts up fine but the instant I connect the server crashes and gives this error.
http://pastebin.com/4VUS9aWq
I just want to bump this, since its the exact same error I'm getting (I'm on Ubuntu 14.04.2LTS as well)

cpw
Long Handed Inserter
Long Handed Inserter
Posts: 59
Joined: Tue Aug 12, 2014 3:47 pm
Contact:

Re: [0.12] Headless mode is unusable

Post by cpw »

NoPantsMcDance wrote:
cpw wrote:
NoPantsMcDance wrote:
prg wrote:
NoPantsMcDance wrote:regardless seems more of a problem with your host and not the factorio guys themselves.
Linking against all that X stuff when it's not needed is an issue with Factorio.
I agree when it's not needed. I see no reason the host can't install those libs if you ask them though but that's just my thinking. I personally run a VPS and do everything myself .
Of course. I understand. I just don't want a half dozen random big fat libs on a low disk server, cluttering things up. And for others that don't have the linux skills, these are likely a significant challenge.
It's completely understandable. I just don't see them removing those libs from the requirements anytime soon but it would be nice. So far from my experience I haven't got headless to work yet. Would love to see if other linux distros or users have gotten it to work.
Heh. It's working for me. I grabbed the (quite large) laundry list of servers, and rewrote the libc6 pointer (because the server is debian wheezy) and it loaded up fine. You have to "--create <save>" first, then "--start-server <save>" if you're starting a new save game on the server, but I was able to connect from locally to my server instance...

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: [0.12] Headless mode is unusable

Post by prg »

If you're concerned about bloat...

Code: Select all

echo 'void*XOpenDisplay(){return 0;}int XInitThreads(){return 1;}' > x.c && cc -shared -o libX11.so.6 x.c && touch empty.c && for i in libXext.so.6 libXfixes.so.3 libXrender.so.1 libGL.so.1 libXcursor.so.1; do cc -shared -o $i empty.c; done
LD_LIBRARY_PATH=. ./factorio --start-server bla
(might need to adjust the list of libs to be created)
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

krelbel
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon Jun 23, 2014 10:44 pm
Contact:

Re: [0.12] Headless mode is unusable

Post by krelbel »

prg wrote:If you're concerned about bloat...

Code: Select all

echo 'void*XOpenDisplay(){return 0;}int XInitThreads(){return 1;}' > x.c && cc -shared -o libX11.so.6 x.c && touch empty.c && for i in libXext.so.6 libXfixes.so.3 libXrender.so.1 libGL.so.1 libXcursor.so.1; do cc -shared -o $i empty.c; done
LD_LIBRARY_PATH=. ./factorio --start-server bla
(might need to adjust the list of libs to be created)
I like the idea, but to save time for anyone else who might be tempted to try this, it doesn't work (even after adding all the other missing libs to the list). The game has a null check for the return value of XOpenDisplay(), so it exits immediately after the call to XOpenDisplay() (see http://pastebin.com/S6Ntxgqp). As a longshot, I checked if they open the display connection, check it for null, but never actually use it in headless mode, but simply having XOpenDisplay() return 1 instead of 0 (predictably) causes a segfault as the game immediately tries dereferencing it. Making factorio work without xlib would likely require a pretty extensive binary patch.

EDIT: See below; this works fine as long as you start it with --start-server. (I hadn't actually tried this myself, I was reporting this here after spending a while yesterday trying to help someone else get it working, and didn't notice they were starting it incorrectly.) Sorry for the noise. I like the idea even better now, knowing it works :)
Last edited by krelbel on Wed Jul 29, 2015 9:44 pm, edited 1 time in total.

User avatar
prg
Filter Inserter
Filter Inserter
Posts: 947
Joined: Mon Jan 19, 2015 12:39 am
Contact:

Re: [0.12][Oxyd] Headless mode is unusable

Post by prg »

You need to use --start-server instead of --mp-load-game.
Automatic Belt (and pipe) Planner—Automate yet another aspect of constructing your factory!

MF-
Smart Inserter
Smart Inserter
Posts: 1235
Joined: Sun Feb 24, 2013 12:07 am
Contact:

Re: [0.12] Headless mode is unusable

Post by MF- »

prg wrote:If you're concerned about bloat...

Code: Select all

echo 'void*XOpenDisplay(){return 0;}int XInitThreads(){return 1;}' > x.c && cc -shared -o libX11.so.6 x.c && touch empty.c && for i in libXext.so.6 libXfixes.so.3 libXrender.so.1 libGL.so.1 libXcursor.so.1; do cc -shared -o $i empty.c; done
LD_LIBRARY_PATH=. ./factorio --start-server bla
(might need to adjust the list of libs to be created)
That fix was refined from Wall'o'text https://forums.factorio.com/forum/vie ... 53&t=14273

I'd suggest making a separate fake-libs directory instead of polluting factorio, though.

Code: Select all

mkdir fake-libs && cd fake-libs && echo 'void*XOpenDisplay(){return 0;}int XInitThreads(){return 1;}' > x.c && cc -shared -o libX11.so.6 x.c && touch empty.c && for i in libXext.so.6 libXfixes.so.3 libXrender.so.1 libGL.so.1 libXcursor.so.1; do cc -shared -o $i empty.c; done & cd ..
echo 'LD_LIBRARY_PATH=fake-libs ./factorio --start-server "$@"' >factorio-headless.sh
chmod a+x factorio-headless.sh

./factorio-headless.sh blah blah
I think factorio could ship that fake-libs directory and factorio-headless.sh script with itself.

Post Reply

Return to “Resolved Problems and Bugs”