Page 1 of 1

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

Posted: Sun Mar 11, 2018 11:04 am
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

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

Posted: Mon Mar 12, 2018 1:53 am
by kitcat
Have you tried the --executable-path option?

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

Posted: Mon Mar 12, 2018 7:08 am
by milo christiansen
For now, until the bug is fixed or otherwise worked around, you can always use hardlinks.

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

Posted: Mon Mar 12, 2018 9:04 am
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>')

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

Posted: Mon Mar 12, 2018 11:05 am
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.

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

Posted: Tue Mar 13, 2018 2:38 pm
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.