Page 1 of 1

Unable to start headless server; server-settings.json

Posted: Sat Sep 16, 2017 5:12 pm
by Kalam
I have a rather perplexing issue with my server-settings.json file. Whenever I try starting the server using the file, I get the following error:

Code: Select all

$ sudo -u factorio /opt/factorio/bin/x64/factorio -c /opt/factorio/data/server-settings.json --start-server-load-latest –Port 64444
   0.000  Error GlobalContext.cpp:882: /opt/factorio/data/server-settings.json: Bad file format; ignoring
   0.000  Error Util.cpp:62: There is no package core in /usr/share/factorio
I have combed the file over and over and see no syntax issues. Here it is for reference:

Code: Select all

$ cat /opt/factorio/data/server-settings.json
{
  "name": "Name of the game as it will appear in the game listing",
  "description": "Description of the game that will appear in the listing",
  "tags": ["game", "tags"],

  "_comment_max_players": "Maximum number of players allowed, admins can join even a full server. 0 means unlimited.",
  "max_players": 0,

  "_comment_visibility": ["public: Game will be published on the official Factorio matching server",
                          "lan: Game will be broadcast on LAN"],
  "visibility":
  {
    "public": false,
    "lan": true
  },

  "_comment_credentials": "Your factorio.com login credentials. Required for games with visibility public",
  "username": "",
  "password": "",

  "_comment_token": "Authentication token. May be used instead of 'password' above.",
  "token": "",

  "game_password": "",

  "_comment_require_user_verification": "When set to true, the server will only allow clients that have a valid Factorio.com account",
  "require_user_verification": false,

  "_comment_max_upload_in_kilobytes_per_second" : "optional, default value is 0. 0 means unlimited.",
  "max_upload_in_kilobytes_per_second": 0,

  "_comment_minimum_latency_in_ticks": "optional one tick is 16ms in default speed, default value is 0. 0 means no minimum.",
  "minimum_latency_in_ticks": 0,

  "_comment_ignore_player_limit_for_returning_players": "Players that played on this map already can join even when the max player limit was reached.",
  "ignore_player_limit_for_returning_players": false,

  "_comment_allow_commands": "possible values are, true, false and admins-only",
  "allow_commands": "admins-only",

  "_comment_autosave_interval": "Autosave interval in minutes",
  "autosave_interval": 10,

  "_comment_autosave_slots": "server autosave slots, it is cycled through when the server autosaves.",
  "autosave_slots": 15,

  "_comment_afk_autokick_interval": "How many minutes until someone is kicked when doing nothing, 0 for never.",
  "afk_autokick_interval": 0,

  "_comment_auto_pause": "Whether should the server be paused when no players are present.",
  "auto_pause": true,

  "only_admins_can_pause_the_game": false,

  "_comment_autosave_only_on_server": "Whether autosaves should be saved only on server or also on all connected clients. Default is true.",
  "autosave_only_on_server": true,

  "_comment_admins": "List of case insensitive usernames, that will be promoted immediately",
  "admins": ["bnasty"]
}

I should note that I can start the server without the < -c /opt/factorio/data/server-settings.json > just fine. What am I missing here?

Re: Unable to start headless server; server-settings.json

Posted: Sat Sep 16, 2017 7:06 pm
by quyxkh
diffing what you pasted against my own server's settings I don't see anything invalid. Bring it up in vim and check the file encoding? Vim' will highlight json errors automatically and maybe it's in UTF-16 and the nulls didn't show up on your terminal or something.

... oh: wait. the server settings is different from the config. don't try to use it as a config file.

Re: Unable to start headless server; server-settings.json

Posted: Sat Sep 16, 2017 7:25 pm
by AlienX
Good spot on that.
Instead of using -c, use --server-settings parameter.

More info here:
https://wiki.factorio.com/Multiplayer#D ... ess_server

Re: Unable to start headless server; server-settings.json

Posted: Sat Sep 16, 2017 8:12 pm
by Kalam
Thanks guys. Swapping out '-c- with '--server-settings' did the trick. I knew it had to be something obvious like that.

Re: Unable to start headless server; server-settings.json

Posted: Sun Jan 07, 2018 7:18 pm
by snugglepilot
FWIW a bunch of the step-by-step setup/tutorial/how-to-documents floating around (some pinned here on the forums!) make the same -c mistake. I just discovered this myself. :/