factorio-server-manager
factorio-server-manager copied to clipboard
Can not start server with error: reading config: read config: is a directory
Just to confirm: this is not using the docker container but just 'native' Linux?
I think the correct CLI flag should be --config and not --conf can you try that?
https://github.com/OpenFactorioServerManager/factorio-server-manager/wiki/Installation-and-Usage#usage
This one caught me out too. The suggested commandline ./factorio-server-manager --dir /home/user/.factorio assumes CWD (current working directory) is eg /opt/factorio-server-manager whicj is indeed the directory, not the lexecutable or config files which is shown in the error. The actual instantiation should in fact be /opt/factorio-server-manager/factorio-server-manager --dir /home/user/.factorio in this situation.
I have the exact same issue, both with changing the CWD or using absolute path.
In both case I specify both the --conf for the conf.json file of the fsm and the --config for the config folder of the game.
It seems to be able to find conf.json just fine, but the error comes from the config folder from the game.
Here is the folders structure I used:
/opt/test/
├── factorio
│ ├── bin
│ ├── config
│ ├── config-path.cfg
│ ├── data
│ └── mods
└── factorio-server-manager
├── conf.json
├── factorio-server-manager
└── mod_packs
First by changing the CWD then calling the script:
oscar@oscar-tuxedoaura15gen2:/opt/test/factorio-server-manager$ cd /opt/test/factorio-server-manager/
oscar@oscar-tuxedoaura15gen2:/opt/test/factorio-server-manager$ ./factorio-server-manager --dir /opt/test/factorio --conf /opt/test/factorio-server-manager/conf.json --config /opt/test/factorio/config
2024/08/09 20:52:13 Max upload: 2000000
2024/08/09 20:52:13 Conffile: /opt/test/factorio-server-manager/conf.json
2024/08/09 20:52:13 Rcon port is empty, generated new one: 40326
/opt/test/factorio-server-manager/mod_packs
2024/08/09 20:52:13 error reading /opt/test/factorio/config: read /opt/test/factorio/config: is a directory
2024/08/09 20:52:13 Error occurred during Server initialization: read /opt/test/factorio/config: is a directory
Then by calling the script using absolute path:
oscar@oscar-tuxedoaura15gen2:/$ /opt/test/factorio-server-manager/factorio-server-manager --dir /opt/test/factorio --conf /opt/test/factorio-server-manager/conf.json --config /opt/test/factorio/config
2024/08/09 20:42:30 Max upload: 2000000
2024/08/09 20:42:30 Conffile: /opt/test/factorio-server-manager/conf.json
2024/08/09 20:42:30 Rcon port is empty, generated new one: 44834
/mod_packs
2024/08/09 20:42:30 no ModPackDir found ... creating one ...
2024/08/09 20:42:30 error reading /opt/test/factorio/config: read /opt/test/factorio/config: is a directory
2024/08/09 20:42:30 Error occurred during Server initialization: read /opt/test/factorio/config: is a directory
I checked if it was a permission error but I do have ownership on all files:
oscar@oscar-tuxedoaura15gen2:/opt/test/factorio$ ls -l
total 20
drwxr-xr-x 3 oscar oscar 4096 aoû 9 19:58 bin
drwxr-xr-x 2 oscar oscar 4096 aoû 9 20:02 config
-rw-r--r-- 1 oscar oscar 1001 nov 9 2023 config-path.cfg
drwxr-xr-x 4 oscar oscar 4096 jun 7 13:30 data
drwxr-xr-x 2 oscar oscar 4096 aoû 9 20:02 mods
oscar@oscar-tuxedoaura15gen2:/opt/test/factorio-server-manager$ ls -l
total 18764
-rw-r--r-- 1 oscar oscar 137 aoû 9 20:02 conf.json
-rwxr-xr-x 1 oscar oscar 19205031 aoû 9 20:02 factorio-server-manager
drwxr-xr-x 2 oscar oscar 4096 aoû 9 20:02 mod_packs
I tried using the 0.10.1 release and I did worked fine, but not with the build from develop.
apparently this can happen when your config.json is malformed, for me it was a trailing comma at the end of the "false" statement regarding the "secure" setting.
part of the program's response to this was to clobber my config.json, so make sure you keep a backup because FSM is merciless and will just nuke the file and replace it with something new.
I've also noticed while investigating this issue for myself, that the program parses but does not pass the factorio bind IP or bind port arguments/settings from FSM to the server executable itself, all the bits needed are in place, it's just missing some glue logic apparently. :/ maybe I'll make a PR for a slight improvement to "server.go" which is where the issue lies.
also, setting "autostart" in the settings file doesn't work. same issue, glue logic missing apparently. consider this some impromptu documentation on some of the pitfalls.
I ended up absolute pathing EVERYTHING in the config json file due to some other issues with how this program deals with paths, I've also backed up in case it nukes itself, again.
It would mostly be a matter of setting the server object variables to the appropriate config values on server object instantiation, but go programming isn't exactly my wheelhouse, at the moment defaults of 34197 and 0.0.0.0 still seem to get passed when a config file is used and the program is called without any other arguments.
{
"server_ip": "192.168.69.201",
"server_port": "8197",
"factorio_ip": "192.168.69.201",
"factorio_port": "34198",
"factorio_dir": "/usr/local/factorio/",
"saves_dir": "/usr/local/factorio/saves/",
"basemod_dir": "/usr/local/factorio/data/base",
"mods_dir": "/usr/local/factorio/mods",
"config_file": "/usr/local/factorio/config/config.ini",
"config_directory": "/usr/local/factorio/config/",
"factorio_binary": "/usr/local/factorio/bin/x64/factorio",
"settings_file": "/usr/local/factorio/config/server-settings.json",
"logfile": "/usr/local/factorio/factorio-current.log",
"sq_lite_database_file": "/usr/local/factorio-server-manager/sqlite.db",
"rcon_pass": "censored",
"cookie_encryption_key": "censored",
"secure": false,
"autostart": true
}
in theory if this config.json (with the censored values replaced with sane values) is used with FSM without any arguments, it should automatically spin up a server. what it does is ignore factorio_port, factorio_ip and autostart.
unless autostart is passed as a program argument to FSM in which case it will autostart, but it still ignores the IP and port configuration or the equivalent program arguments.
there's just some general issues with config file parsing and argument passing. it needs some love.
I got this far, it works, I pulled the repo down today and got it working, it just doesn't listen to bind ip/bind port settings for the factorio server itself!
sorry if this is OT/unwanted.
Same problems above on Debian 12. Found that absolute paths fixed for me too.
I went and wrote an init.d script for Factorio using a few helper programs available on GitHub and gave up on ever having a webui. not to be mean, but in my experience, I've tried like, the handful of various projects that do this on GitHub, and they all... just suck. I'm sorry, it's just true, it's painful using these, they often don't work or are feature incomplete or subject to significant bugs.
I'm sure it works for some people, cool for them. I'm not ripping everything up I'm running just to run the specific environment this thing works on, that's not worth the effort.
I've been using my script and tweaking it since about the time of my last comment and I've been completely happy with that, it even has a helper program for updating the game, and the mods. I also have a rcon helper program as well, it's feature complete and it just works, stuff is hardcoded in terms of program args because "nano" is all the UI i need for config, so I'm sadly not going to be able to release it as is.
my setup is to use an ssh fs mount on my desktop to my server's Factorio folder, my command and control are done by a putty session to the server with my init.d script and helper programs.
everything you need to build what I did is available on GitHub, I'd recommend doing this instead of bothering with this project.
I used update_factorio.py, https://github.com/narc0tiq/factorio-updater/tree/master rcon cli, https://github.com/gorcon/rcon-cli mod_updater.py, https://github.com/pdemonaco/factorio-mod-updater/tree/master
I cbf parameterising out my username, factorio mods api hash and other various personal details in my script, so understandably, I will not be releasing it at this point. it seems derivative and trivial enough that I think just about anybody somewhat fluent in shell scripting can make it themselves._
it's just not worth it, took me a few hours total probs to make an init script.