My Factorio Info: Difference between revisions

From GotOpinion
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 24: Line 24:
<pre>$ sudo wget https://factorio.com/get-download/stable/headless/linux64</pre>
<pre>$ sudo wget https://factorio.com/get-download/stable/headless/linux64</pre>


Rename file to match version (1.1.87 in this example)
Rename file to match version (2.0.60 in this example)
<pre>$ sudo mv linux64 factorio-headless_linux_1.1.110.tar.xz</pre>
<pre>$ sudo mv linux64 factorio-headless_linux_2.0.60.tar.xz</pre>


Extract archived and zipped file
Extract archived and zipped file
Line 55: Line 55:


Start server and look for something like "File /savename does not exist."
Start server and look for something like "File /savename does not exist."
<pre>$ /opt/factorio/bin/x64/factorio --start-server savename
<pre>$ /opt/factorio/bin/x64/factorio --start-server savename.zip
  0.000 2024-05-04 17:53:44; Factorio 1.1.107 (build 62234, linux64, headless)
  0.020 Operating system: Linux (Ubuntu 22.04)
  0.020 Program arguments: "/opt/factorio/bin/x64/factorio" "--start-server" "savename"
  0.020 Config path: /opt/factorio/config/config.ini
  0.020 Read data path: /opt/factorio/data
  0.020 Write data path: /opt/factorio [1763296/1874134MB]
  0.020 Binaries path: /opt/factorio/bin
  0.024 System info: [CPU: 13th Gen Intel(R) Core(TM) i9-13900K, 32 cores, RAM: 64055 MB]
  0.024 Environment: DISPLAY=<unset> WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=<unset> XDG_SESSION_DESKTOP=<unset> XDG_CURRENT_DESKTOP=<unset> __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
  0.024 Running in headless mode
  0.046 Loading mod core 0.0.0 (data.lua)
  0.062 Loading mod base 1.1.107 (data.lua)
  0.152 Loading mod base 1.1.107 (data-updates.lua)
  0.182 Checksum for core: 607699937
  0.182 Checksum of base: 1054619811
  0.277 Prototype list checksum: 3034860339
  0.299 Info PlayerData.cpp:78: Local player-data.json unavailable
  0.299 Info PlayerData.cpp:83: Cloud player-data.json unavailable
  0.301 Factorio initialised
  0.302 Info ServerSynchronizer.cpp:29: nextHeartbeatSequenceNumber(0) initialized Synchronizer nextTickClosureTick(0).
  0.302 Info ServerMultiplayerManager.cpp:814: updateTick(4294967295) changing state from(Ready) to(PreparedToHostGame)
  0.302 Info ServerMultiplayerManager.cpp:814: updateTick(4294967295) changing state from(PreparedToHostGame) to(CreatingGame)
  0.304 Loading map /opt/factorio/savename
  0.305 Error ServerMultiplayerManager.cpp:92: MultiplayerManager failed: "File /opt/factorio/savename does not exist."
  0.305 Info ServerMultiplayerManager.cpp:814: updateTick(4294967295) changing state from(CreatingGame) to(InitializationFailed)
  0.305 Info CommandLineMultiplayer.cpp:219: Exit point.
  0.306 Info ServerMultiplayerManager.cpp:154: Quitting multiplayer connection.
  0.306 Info ServerMultiplayerManager.cpp:814: updateTick(4294967295) changing state from(InitializationFailed) to(Closed)
  0.321 Info UDPSocket.cpp:233: Closing socket
  0.322 Goodbye</pre>


At this point you can load up saved games or create some games.
At this point you can load up saved games or create some games. I find it easier to create new game in Factorio client, save it, then SFTP the saved file to my headless server save directory.


=== Update for 2.0.60 ===
With base client and headless server (i.e., no mods) installing, I got a mod mismatch error when connecting with client. To fix this, I had to edit the default "true" values to "false" in /opt/factorio/mods/mod-list.json file for "elevated-rails", "quality", and "space-age".
Here is my mod-list.json modified file:
<pre>$ cat factorio/mods/mod-list.json 
{
  "mods":
  [
   
    {
      "name": "base",
      "enabled": true
    },
   
    {
      "name": "elevated-rails",
      "enabled": false
    },
   
    {
      "name": "quality",
      "enabled": false
    },
   
    {
      "name": "space-age",
      "enabled": false
    }
  ]
}</pre>


== Publish game on Factorio matching server ==
== Publish game on Factorio matching server ==
Line 105: Line 108:
<pre>robot01@apu01:/opt/factorio$ sudo vi /opt/factorio/config/config.ini</pre>
<pre>robot01@apu01:/opt/factorio$ sudo vi /opt/factorio/config/config.ini</pre>


=== Update headless server ===
== Updating Factorio headless server ==
 
download latest headless version
 
unzip and untar
 
<pre>sudo tar -xJf linux64</pre>
 
change permissions to your dedicated factorio user
 
<pre>sudo chown -R factorio:factorio factorio</pre>
 
launch game, example with saved game called "spoon.zip":
 
<pre>/opt/factorio/bin/x64/factorio --start-server /opt/factorio/saves/spoon.zip</pre>
 
== Updating Factorio ==


# Download the latest copy of the headless server using the steps above.
# Download the latest copy of the headless server using the steps above.

Revision as of 00:23, 18 July 2025

Factorio Headless Setup

Updated 2025/07/17

These steps were done with Ubuntu 22.04.5 LTS

Resources:

Check that your version of glibc is >= 2.18 using ldd --version

$ ldd --version
ldd (Ubuntu GLIBC 2.35-0ubuntu3.7) 2.35
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

Output of ldd command confirms glibc version >2.18.

Switch to $ cd /opt directory and download latest Factorio stable headless version (2.0.60 as of this writing)

$ sudo wget https://factorio.com/get-download/stable/headless/linux64

Rename file to match version (2.0.60 in this example)

$ sudo mv linux64 factorio-headless_linux_2.0.60.tar.xz

Extract archived and zipped file

$ sudo tar -xJf factorio-headless_linux_2.0.60.tar.xz 
anon@ox:/opt$ ls -l
total 55376
drwxr-xr-x 8 factorio factorio     4096 Jul 18 05:05 factorio
-rw-r--r-- 1 root     root     56693436 Jul 10 10:05 factorio-headless_linux_2.0.60.tar.xz

Remove file (save space, you can always download the file again, if needed) using sudo rm <filename.tar.xz>

Add a new user to run factorio and assign ownership of /opt/factorio directory to same user

$ sudo useradd factorio
$ sudo chown -R factorio:factorio /opt/factorio/


Verify permissions show factorio for both user and group with ls -ld /opt/factorio

$ ls -ld /opt/factorio/
drwxr-xr-x 4 factorio factorio 4096 May  4 17:07 /opt/factorio/


Test Factorio binary by switching to factorio user then start server

robot01@apu01:/opt$ sudo su - factorio
No directory, logging in with HOME=/
$

As factorio user create /opt/factorio/ saves directory. I used saves directory.

$ mkdir /opt/factorio/saves

Start server and look for something like "File /savename does not exist."

$ /opt/factorio/bin/x64/factorio --start-server savename.zip

At this point you can load up saved games or create some games. I find it easier to create new game in Factorio client, save it, then SFTP the saved file to my headless server save directory.

=== Update for 2.0.60 ===

With base client and headless server (i.e., no mods) installing, I got a mod mismatch error when connecting with client. To fix this, I had to edit the default "true" values to "false" in /opt/factorio/mods/mod-list.json file for "elevated-rails", "quality", and "space-age".

Here is my mod-list.json modified file:

<pre>$ cat factorio/mods/mod-list.json  

{
  "mods": 
  [
    
    {
      "name": "base",
      "enabled": true
    },
    
    {
      "name": "elevated-rails",
      "enabled": false
    },
    
    {
      "name": "quality",
      "enabled": false
    },
    
    {
      "name": "space-age",
      "enabled": false
    }
  ]
}

Publish game on Factorio matching server

Copy /opt/factorio/data/server-settings.example.json to /opt/factorio/data/server-settings.json.

$ sudo cp /opt/factorio/data/server-settings.example.json /opt/factorio/data/server-settings.json

Edit appropriate server-settings.json values.

I used _comment_token versus password value. The appropriate value is located in %appdata%\Factorio\player-data.json under the key name "service-token". The service-token is populated after you've browsed the multiplayer servers via your Factorio game client.

My player-data.json for user "anon" on Windows was located at C:\Users\anon\AppData\Roaming\Factorio.

Make any changes to config ini

robot01@apu01:/opt/factorio$ sudo vi /opt/factorio/config/config.ini

Updating Factorio headless server

  1. Download the latest copy of the headless server using the steps above.
  2. Move and rename the headless server following the steps above.
  3. Assign ownership of /opt/factorio directory to factorio user used above.

Gaming