factorio.service always timed out on headless server at Ubuntu 18.04

Anything that prevents you play the game properly. Do you have issues with paying for the game, downloading it or properly running it on your computer? Let us know here.
Post Reply
Stahp_
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sun Jul 19, 2020 9:37 am
Contact:

factorio.service always timed out on headless server at Ubuntu 18.04

Post by Stahp_ »

Hi there,
I've set up my own factorio headless server on Ubuntu 18.04 and it works as it should. The problem started when I decided to make service so that it would boot itself automaticly on startup and restart at crashes. So I've created service using this example after changing it to fit my configuration to:

Code: Select all

[Unit]
Description=Factorio Server
Wants=network-online.target
After=network.target network-online.target

[Service]
User=fac
# Group=factorio

# We will store a pid file in your ${WRITE_DIR}/server.pid
# Adjust if you change the write dir of your server
PIDFile=/opt/factorio/server.pid

Type=forking
TimeoutStartSec=20
ExecStart=/opt/factorio/bin/x64/factorio --start-server /home/fac/saves/fabryczQ.zip
TimeoutStopSec=20
# ExecStop=/opt/factorio/bin/x64/factorio --stop-server /home/fac/saves/fabryczQ.zip
RestartSec=20
Restart=on-failure

[Install]
WantedBy=multi-user.target
When I start service with

Code: Select all

sudo systemctl start factorio
it timesout with log:

Code: Select all

Jul 19 10:00:47 factorio-ubuntu factorio[5579]:    0.041 Operating system: Linux (Ubuntu 18.04)
Jul 19 10:00:47 factorio-ubuntu factorio[5579]:    0.041 Program arguments: "/opt/factorio/bin/x64/factorio" "--start-server" "/home/fac/saves/fabryczQ.zip"
Jul 19 10:00:47 factorio-ubuntu factorio[5579]:    0.041 Read data path: /opt/factorio/data
Jul 19 10:00:47 factorio-ubuntu factorio[5579]:    0.041 Write data path: /opt/factorio [27088/29598MB]
Jul 19 10:00:47 factorio-ubuntu factorio[5579]:    0.042 Binaries path: /opt/factorio/bin
Jul 19 10:00:47 factorio-ubuntu factorio[5579]:    0.047 System info: [CPU: Intel(R) Xeon(R) Platinum 8171M CPU @ 2.60GHz, 1 core, RAM: 889 MB]
Jul 19 10:00:47 factorio-ubuntu factorio[5579]:    0.047 Environment: DISPLAY=<unset> WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=<unset> XDG_SESSION_DESKTOP=<unset> XDG_CURRENT_DESKTOP=<unset> __GL_FSAA_MODE=<un
Jul 19 10:00:47 factorio-ubuntu factorio[5579]:    0.047 Running in headless mode
Jul 19 10:00:47 factorio-ubuntu factorio[5579]:    0.049 Loading mod core 0.0.0 (data.lua)
Jul 19 10:00:47 factorio-ubuntu factorio[5579]:    0.100 Loading mod base 0.18.36 (data.lua)
Jul 19 10:00:47 factorio-ubuntu factorio[5579]:    0.395 Loading mod base 0.18.36 (data-updates.lua)
Jul 19 10:00:48 factorio-ubuntu factorio[5579]:    0.537 Checksum for core: 1110023843
Jul 19 10:00:48 factorio-ubuntu factorio[5579]:    0.537 Checksum of base: 1297274940
Jul 19 10:00:48 factorio-ubuntu factorio[5579]:    0.744 Prototype list checksum: 3870670541
Jul 19 10:00:48 factorio-ubuntu factorio[5579]:    0.794 Info PlayerData.cpp:68: Local player-data.json available, timestamp 1595152827
Jul 19 10:00:48 factorio-ubuntu factorio[5579]:    0.794 Info PlayerData.cpp:75: Cloud player-data.json unavailable
Jul 19 10:00:48 factorio-ubuntu factorio[5579]:    0.844 Factorio initialised
Jul 19 10:00:48 factorio-ubuntu factorio[5579]:    0.845 Info ServerSynchronizer.cpp:28: nextHeartbeatSequenceNumber(0) initialized Synchronizer nextTickClosureTick(0).
Jul 19 10:00:48 factorio-ubuntu factorio[5579]:    0.845 Info ServerMultiplayerManager.cpp:771: updateTick(4294967295) changing state from(Ready) to(PreparedToHostGame)
Jul 19 10:00:48 factorio-ubuntu factorio[5579]:    0.845 Info ServerMultiplayerManager.cpp:771: updateTick(4294967295) changing state from(PreparedToHostGame) to(CreatingGame)
Jul 19 10:00:48 factorio-ubuntu factorio[5579]:    0.854 Loading map /home/fac/saves/fabryczQ.zip: 18639915 bytes.
Jul 19 10:00:48 factorio-ubuntu factorio[5579]:    0.874 Loading level.dat: 49030850 bytes.
Jul 19 10:00:48 factorio-ubuntu factorio[5579]:    0.895 Info Scenario.cpp:187: Map version 0.18.36-0
Jul 19 10:00:50 factorio-ubuntu factorio[5579]:    3.449 Loading script.dat: 331 bytes.
Jul 19 10:00:51 factorio-ubuntu factorio[5579]:    3.627 Checksum for script /opt/factorio/temp/currently-playing/control.lua: 1680294422
Jul 19 10:00:51 factorio-ubuntu factorio[5579]:    3.664 Info UDPSocket.cpp:27: Opening socket at (IP ADDR:({0.0.0.0:34197}))
Jul 19 10:00:51 factorio-ubuntu factorio[5579]:    3.664 Hosting game at IP ADDR:({0.0.0.0:34197})
Jul 19 10:00:51 factorio-ubuntu factorio[5579]:    3.664 Info HttpSharedState.cpp:54: Downloading https://auth.factorio.com/generate-server-padlock-2?api_version=4
Jul 19 10:00:51 factorio-ubuntu factorio[5579]:    4.076 Info AuthServerConnector.cpp:66: Obtained serverPadlock for serverHash (2a8wVW1sc74AEWNUnPLArYgVbiOj71RK) from the auth server.
Jul 19 10:00:51 factorio-ubuntu factorio[5579]:    4.077 Info ServerMultiplayerManager.cpp:771: updateTick(23814930) changing state from(CreatingGame) to(InGame)
Jul 19 10:00:51 factorio-ubuntu factorio[5579]:    4.077 Error InterruptibleStdioStream.cpp:61: Got EOF on stdin; closing
Jul 19 10:01:07 factorio-ubuntu systemd[1]: factorio.service: Start operation timed out. Terminating.
Jul 19 10:01:07 factorio-ubuntu factorio[5579]:   20.239 Received SIGTERM, shutting down
Jul 19 10:01:07 factorio-ubuntu factorio[5579]:   20.239 Quitting: signal.
Jul 19 10:01:07 factorio-ubuntu factorio[5579]:   20.240 Info MainLoop.cpp:402: Saving map as /home/fac/saves/fabryczQ.zip
Jul 19 10:01:08 factorio-ubuntu factorio[5579]:   20.595 Info MainLoop.cpp:413: Saving progress: 0.007218%
Jul 19 10:01:08 factorio-ubuntu factorio[5579]:   21.429 Info MainLoop.cpp:413: Saving progress: 100.000000%
Jul 19 10:01:09 factorio-ubuntu factorio[5579]:   22.103 Info ServerMultiplayerManager.cpp:112: Disconnecting multiplayer connection.
Jul 19 10:01:09 factorio-ubuntu factorio[5579]:   22.103 Info ServerMultiplayerManager.cpp:771: updateTick(23814930) changing state from(InGame) to(DisconnectingScheduled)
Jul 19 10:01:09 factorio-ubuntu factorio[5579]:   22.137 Info ServerMultiplayerManager.cpp:771: updateTick(23814930) changing state from(DisconnectingScheduled) to(Disconnecting)
Jul 19 10:01:09 factorio-ubuntu factorio[5579]:   22.170 Info ServerMultiplayerManager.cpp:771: updateTick(23814930) changing state from(Disconnecting) to(Disconnected)
Jul 19 10:01:09 factorio-ubuntu factorio[5579]:   22.171 Info ServerMultiplayerManager.cpp:136: Quitting multiplayer connection.
Jul 19 10:01:09 factorio-ubuntu factorio[5579]:   22.171 Info ServerMultiplayerManager.cpp:771: updateTick(23814930) changing state from(Disconnected) to(Closed)
Jul 19 10:01:09 factorio-ubuntu factorio[5579]:   22.401 Info UDPSocket.cpp:218: Closing socket
Jul 19 10:01:09 factorio-ubuntu factorio[5579]:   22.401 Info UDPSocket.cpp:248: Socket closed
Jul 19 10:01:10 factorio-ubuntu factorio[5579]:   22.456 Goodbye
Jul 19 10:01:10 factorio-ubuntu systemd[1]: factorio.service: Failed with result 'timeout'.
Jul 19 10:01:10 factorio-ubuntu sudo[5576]: pam_unix(sudo:session): session closed for user root
Jul 19 10:01:10 factorio-ubuntu systemd[1]: Failed to start Factorio Server.
Why does it even timeout when server correctly running? Does it has something to do with how headless works? Is there any alternative to achieve same without creating service? Thanks.

EDIT:
When I changed service to:

Code: Select all

[Unit]
Description=Factorio Server
After=network.target

[Service]
User=fac
Type=simple
ExecStart=/opt/factorio/bin/x64/factorio --start-server /home/fac/saves/fabryczQ.zip
Restart=on-failure

[Install]
WantedBy=multi-user.target
it started working. Still wondering why forking doesnt work..

execthis
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sat May 23, 2020 10:17 am
Contact:

Re: factorio.service always timed out on headless server at Ubuntu 18.04

Post by execthis »

Hi Stahp_

I suggest using factorio-init, what comes with systemd files: https://github.com/Bisa/factorio-init#f ... nit-script

Regards
exec

Post Reply

Return to “Technical Help”

Who is online

Users browsing this forum: No registered users