Page 1 of 1

"Couldn't save config" when trying to setup read-only server

Posted: Thu Jan 12, 2017 10:39 am
by kimundi
Hi,

I'm trying to setup a factorio headless server in such a way that all modifiable server data lives in a dedicated directory, so that I can run multiple instances of the server in parallel, or at the very least switch between them without crosstalk in config or save files.

For this I marked the factorio directory as read-only and start the binary with "-c" to give it a writable config file at another location.

The whole thing seems to work fine as far as I can say with only a few minutes of testing, but I'm getting a non-fatal error in the server log on startup and shutdown that I don't get with a standard "portable" setup where config and all write data lives in the factorio directory itself.

See @ 0.446 and 3.749:

Code: Select all

   0.000 2017-01-12 11:23:00; Factorio 0.14.21 (build 25327, linux64, headless)
   0.000 Operating system: Linux
   0.000 Program arguments: "../factorio/bin/x64/factorio" "-c" "./config.ini" "--start-server" "./saves/my-save.zip"
   0.000 Read data path: /home/marvin/factorio_server/tmp/factorio/data
   0.000 Write data path: ./data
   0.000 Binaries path: /home/marvin/factorio_server/tmp/factorio/bin
   0.009 System info: [CPU: Intel(R) Celeron(R) CPU G1840 @ 2.80GHz, 2 cores, RAM: 3634MB]
   0.010 Running in headless mode
   0.012 Loading mod core 0.0.0 (data.lua)
   0.015 Loading mod base 0.14.21 (data.lua)
   0.094 Checksum for core: 1291735968
   0.094 Checksum for mod base: 786624017
   0.444 Info PlayerData.cpp:55: Local player-data.json available, timestamp 1484215626
   0.444 Info PlayerData.cpp:62: Cloud player-data.json unavailable
   0.445 Custom inputs active: 0
   0.446 Error GlobalContext.cpp:1046: Couldn't save config: boost::filesystem::create_directory: No such file or directory
   0.446 Factorio initialised
   0.447 Info ServerSynchronizer.cpp:27: nextHeartbeatSequenceNumber(0) initialized Synchronizer nextTickClosureTick(0).
   0.447 Info ServerMultiplayerManager.cpp:658: mapTick(-1) changing state from(Ready) to(PreparedToHostGame)
   0.447 Info ServerMultiplayerManager.cpp:658: mapTick(-1) changing state from(PreparedToHostGame) to(CreatingGame)
   0.447 Loading map /home/marvin/factorio_server/tmp/s1/./saves/my-save.zip
   0.448 Error FileUtil.cpp:284: Can't remove ./data/temp/currently-playing: No such file or directory
   0.463 Info Scenario.cpp:152: Map version 0.14.21-0
   0.509 Checksum for script ./data/temp/currently-playing/control.lua: 1057114497
   0.509 Info UDPSocket.cpp:27: Opening socket at (0.0.0.0:34197)
   0.509 Hosting game at 0.0.0.0:34197
   0.509 Info ServerMultiplayerManager.cpp:658: mapTick(2291) changing state from(CreatingGame) to(InGame)
^C   3.393 Received SIGINT, shutting down
   3.393 Info MainLoop.cpp:219: Saving map as /home/marvin/factorio_server/tmp/s1/./saves/my-save.zip
   3.495 Info ServerMultiplayerManager.cpp:115: Disconnecting multiplayer connection.
   3.495 Info ServerMultiplayerManager.cpp:658: mapTick(2291) changing state from(InGame) to(DisconnectingScheduled)
   3.528 Info ServerMultiplayerManager.cpp:658: mapTick(2291) changing state from(DisconnectingScheduled) to(Disconnecting)
   3.562 Info ServerMultiplayerManager.cpp:658: mapTick(2291) changing state from(Disconnecting) to(Disconnected)
   3.562 Info ServerMultiplayerManager.cpp:139: Quitting multiplayer connection.
   3.562 Info ServerMultiplayerManager.cpp:658: mapTick(2291) changing state from(Disconnected) to(Closed)
   3.749 Error GlobalContext.cpp:1046: Couldn't save config: boost::filesystem::create_directory: No such file or directory
   3.814 Info UDPSocket.cpp:235: Socket closed
   3.825 Goodbye
My steps so far on a linux x64 system:
  • I started in a dedicated directory
  • I downloaded the current (0.14.21) headless server
  • I extracted the headless server as a tar.gz file
  • I recursively changed all permissions for the resulting factorio directory to read-only by doing

    Code: Select all

    chmod a-w -R ./factorio
  • I created a second directory "s1" next to the factorio one to hold the savegames and config file
  • Directory layout now looks like this:

    Code: Select all

    ls -alh
    dr-xr-xr-x [...] factorio/
    -rw-r--r-- [...] linux64.tar.gz
    drwxr-xr-x [...] s1/
    
  • In s1, I created a vanilla config.ini by copying in an existing one
  • I modified it to point its write-data path to the current directory. The contents of that config.ini are this:

    Code: Select all

    [path]
    read-data=__PATH__executable__/../../data
    write-data=./data
    [general]
    locale=
    [other]
    tooltip_delay=0.0399999991
    max_threads=2
    force_default_logistic_filter_count_to_one=false
    show_tips_and_tricks=true
    autosort_inventory=true
    research_finished_stops_game=true
    use_item_groups=true
    use_item_subgroups=true
    output_console_delay=1200
    autosave_interval=2
    autosave_slots=3
    enable_new_mods=true
    minimum_latency_in_multiplayer=0
    port=34197
    use_version_filter_in_browse_games_gui=true
    check_updates=true
    enable_experimental_updates=false
    proxy=
    verbose-logging=false
    [debug]
    force=enemy
    show_fps=basic
    show_detailed_info=basic
    show_time_used_percent=basic
    show_multiplayer_waiting_icon=basic
    show_multiplayer_statistics=basic
    show_tile_grid=full
    show_collision_rectangles=detailed
    show_selection_rectangles=detailed
    show_paths=full
    show_next_waypoint_bb=full
    show_target=full
    show_unit_group_info=full
    show_unit_behavior_info=full
    show_last_path_detail=full
    show_path_cache=full
    show_path_cache_paths=full
    show_rail_paths=full
    show_rolling_stock_count=full
    show_rail_connections=detailed
    show_rail_segments=detailed
    show_rail_joints=detailed
    show_train_stop_point=detailed
    show_train_braking_distance=full
    show_train_signals=full
    show_network_connected_entities=detailed
    show_circuit_network_numbers=detailed
    show_energy_sources_networks=detailed
    show_active_state=detailed
    show_pollution_values=full
    show_active_entities_on_chunk_counts=full
    show_active_chunks=full
    show_enemy_expansion_candidate_chunks=full
    show_enemy_expansion_candidate_chunk_values=full
    show_bad_attack_chunks=full
    show_tile_variations=full
    show_raw_tile_transitions=never
    show_tile_correction_previews=never
    show_fluid_box_fluid_info=basic
    show_environment_sound_info=basic
    show_logistic_robot_targets=full
    show_fire_info=full
    show_sticker_info=full
    [sound]
    master_volume=0.600000024
    ambient_volume=0.400000006
    game_effects_volume=0.699999988
    gui_effects_volume=0.699999988
    walking_volume=0.300000012
    environment_volume=0.449999988
    alert_volume=0.550000012
    audible_distance=40
    environment_audible_distance=15
    maximum_environment_sounds=15
    active_gui_volume_modifier=1.29999995
    active_gui_environment_volume_modifier=0.600000024
    ambient_music_pause_mean_seconds=45
    ambient_music_pause_variance_seconds=30
    ambient_music_mode=interleave-main-tracks-with-interludes
    [graphics]
    lights-render-quality=0.25
    custom-ui-scale=1
    multisampling-level=0
    preferred-screen-index=255
    screenshots_queue_size=10
    screenshots_threads_count=1
    debug_font_size=18
    max-texture-size=0
    fullscreen=false
    system-ui-scale=true
    show-minimap=true
    show-pollution-on-minimap=false
    show-pollution-on-large-map=true
    show-player-names-on-minimap=true
    show-turret-radius-when-blueprinting=false
    show-item-labels-in-cursor=true
    show-grid-when-paused=true
    show-smoke=true
    show-clouds=true
    show-inserter-shadows=true
    show-inserter-arrows-when-selected=true
    show-inserter-arrows-when-detailed-info-is-on=false
    show-mining-drill-arrows-when-detailed-info-is-on=true
    show-combinator-settings-when-detailed-info-is-on=false
    force-opengl=false
    cache-sprite-atlas=false
    v-sync=false
    tree-sprite-mipmaps=true
    trilinear-filtering=true
    skip-vram-detection=false
    graphics-quality=normal
    video-memory-usage=high
    texture-compression=false
    disable-fma3=auto
    
  • Inside s1 I created a savegame like this:

    Code: Select all

    ../factorio/bin/x64/factorio -c ./config.ini --create ./saves/my-save.zip
    
  • And ran the server like this:

    Code: Select all

    ../factorio/bin/x64/factorio -c ./config.ini --start-server ./saves/my-save.zip
    
Again, everything seems to work, I can connect to the server, build stuff, and it's still there if I reconnect or restart the server, but that error message about the config file makes me think I forgot something in the setup.

Re: "Couldn't save config" when trying to setup read-only server

Posted: Fri Jan 13, 2017 1:49 pm
by mexmer
i think problem is your writable directory
./data
he can't find it, and cannot create it.
i would suggest either using absolute path, or relative to executable, like you have defined readable folder.

./data will either be relative to current folder (where you started factorio) or to executable - not sure, i'm lazy to test that tbh.

Re: "Couldn't save config" when trying to setup read-only server

Posted: Sat Feb 04, 2017 1:30 pm
by kimundi
It does create the data directory though, and create all files in it - again, the server seems to work fine, I just get that error at runtime without the server exiting.