[0.16.28] headless server under linux can't use symlinks

Bugs that are actually features.
Post Reply
InflamedSebi
Burner Inserter
Burner Inserter
Posts: 12
Joined: Fri May 19, 2017 7:49 am
Contact:

[0.16.28] headless server under linux can't use symlinks

Post by InflamedSebi »

I m running multiple instances of the server. To save some disk space I tried to symlink static parts of the server (the /bin and /data). Those 2 folders would save 130MB for each instance. I moved them out of the factorio folder and inside the share folder. Then i created symlinks (ln -s ../share/data instance_john/data && ln -s ../share/bin instance_john/bin).
instance_sebi is the normal installation and instance_john + share are the symlink variation like seen here:

Code: Select all

/srv/factorio/
β”œβ”€β”€ instance_john
β”‚Β Β  β”œβ”€β”€ bin -> ../share/bin
β”‚Β Β  β”œβ”€β”€ config
β”‚Β Β  β”œβ”€β”€ data -> ../share/data
β”‚Β Β  β”œβ”€β”€ mods
β”‚Β Β  β”œβ”€β”€ saves
β”‚Β Β  └── temp
β”œβ”€β”€ instance_sebi
β”‚Β Β  β”œβ”€β”€ bin
β”‚Β Β  β”œβ”€β”€ config
β”‚Β Β  β”œβ”€β”€ data
β”‚Β Β  β”œβ”€β”€ mods
β”‚Β Β  β”œβ”€β”€ saves
β”‚Β Β  └── temp
└── share
    β”œβ”€β”€ bin
    └── data
While instance_sebi would startup fine:

Code: Select all

   0.000 2018-03-11 11:19:21; Factorio 0.16.28 (build 35903, linux64, headless)
   0.028 Operating system: Linux (Ubuntu 16.04)
   0.028 Program arguments: "/srv/factorio/instance_sebi/bin/x64/factorio" "--bind" "0.0.0.0" "--port" "34197" "--server-settings" "/srv/factorio/instance_sebi/config/server-settings.json" "--rcon-port" "43081" "--rcon-password" <private> "--start-server" "/srv/factorio/instance_sebi/saves/MP1.zip"
   0.028 Read data path: /srv/factorio/instance_sebi/data
   0.028 Write data path: /srv/factorio/instance_sebi [175248/207352MB]
   0.028 Binaries path: /srv/factorio/instance_sebi/bin
   0.034 System info: [CPU: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz, 8 cores, RAM: 64199 MB]
   0.034 Running in headless mode
   ...
instance_john would not, saying:

Code: Select all

0.000  Error Util.cpp:49: Error configuring paths: There is no package core in /usr/share/factorio. Deduced executable directory: /srv/factorio/share/bin/x64, read data: __PATH__system-read-data__, write data: __PATH__system-write-data__
seems like the executable can't handle symlinks properly or I m missing something important.
Eighter way I will leave this here :) Maybe someone will answer.

Edit1:
same thing happens if the symlink is absolute "/srv/factorio/share/bin" instead of relative "../share/bin"
Startup command: /srv/factorio/instance_john/bin/x64/factorio [--bind 0.0.0.0 --port 43081 --rcon-password factorio_rcon --start-server /srv/factorio/instance_john/saves/MP1.zip]


Kind regards
Sebi

kitcat
Long Handed Inserter
Long Handed Inserter
Posts: 66
Joined: Wed Apr 26, 2017 3:11 pm
Contact:

Re: [0.16.28] headless server under linux can't use symlinks

Post by kitcat »

Have you tried the --executable-path option?

milo christiansen
Fast Inserter
Fast Inserter
Posts: 106
Joined: Thu Jul 30, 2015 7:11 pm
Contact:

Re: [0.16.28] headless server under linux can't use symlinks

Post by milo christiansen »

For now, until the bug is fixed or otherwise worked around, you can always use hardlinks.

InflamedSebi
Burner Inserter
Burner Inserter
Posts: 12
Joined: Fri May 19, 2017 7:49 am
Contact:

Re: [0.16.28] headless server under linux can't use symlinks

Post by InflamedSebi »

kitcat wrote:Have you tried the --executable-path option?
I use a webui, which does not support this param yet, so this is not an option sadly.
milo christiansen wrote:For now, until the bug is fixed or otherwise worked around, you can always use hardlinks.
Since one should try to avoid hardlinks the only other solution I found was 'mount -o bind <src> <dest>' which is even worse than hardlinks ...
so i did go for hardlinks ('cp -al <src> <dest>')

quyxkh
Smart Inserter
Smart Inserter
Posts: 1027
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: [0.16.28] headless server under linux can't use symlinks

Post by quyxkh »

Point it at config.ini from the command line with e.g. `-c /srv/factorio/instance-john/config/config.ini`, the server gets its runtime paths from config.ini, and if you don't pass the path for that on the command line it has to start from the executable and find config-path.cfg. If it can't find that it has to take compiled-in factory defaults. You passed a full path to the executable as arg0 but that's not required or reliable. My own server's directory is set up with even more symlinks than yours and works great.

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

Re: [0.16.28] headless server under linux can't use symlinks

Post by Oxyd »

Not a bug. Factorio finds its configuration files relative to the executable, so if you move the executable, it won't find them. Use the --config option to point it to a config file and either don't use __PATH__executable in the config file or make the paths involving __PATH__executable work relative to the actual executable directory.

Instead of symlinks, you could also simply just create two config.ini files, each pointing to a different write-data. Then you can just run the same binary twice, each with a different config.

Post Reply

Return to β€œNot a bug”