Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not start server with error: reading config: read config: is a directory #387

Open
JerryLiew opened this issue May 11, 2024 · 4 comments

Comments

@JerryLiew
Copy link

image
image

@Mattie112
Copy link
Contributor

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

@Squelch
Copy link

Squelch commented Jul 15, 2024

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.

@OscarVsp
Copy link

OscarVsp commented Aug 9, 2024

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.

@h4rm0n1c
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants