Projekt Julians Ark Server

From JoBaPedia
Jump to navigation Jump to search

Starten

The Island

sudo systemctl start ark1

Maybe later more maps...

Stoppen

Backup gibt es automatisch nur alle 5 min also besser mit SaveWorld:

EnableCheats <Password>
AdminCheat SaveWorld
AdminCheat DoExit

oder statt DoExit

sudo systemctl stop ark1

Weitere Kommandos

http://ark.gamepedia.com/Console_Commands

Lokale Welt auf Server kopieren

lokale SavedLocalArcs nach SavedArks auf dem Server kopieren und lokales Profil einer Steam ID geben

cp -av ~/Backup/Saved.windows/SavedArksLocal ShooterGame/Saved/SavedArks
cp ShooterGame/Saved/SavedArks/LocalPlayer.arkprofile ShooterGame/Saved/SavedArks/76561198229816152.arkprofile

Server im Router freigeben

das hat Juli 2023 funktioniert (verwendet Ports für bis zu drei Ark Servern):

caba1 (192.168.1.175, ::1ac1:e84:997c:7b97)

Ark-UDP-3x-Game+Raw 7777 - 7782
Ark-UDP-3x-Query    27015 - 27017
Ark-TCP-3x-Query    27015 - 27017
Steam-UDP           27020 - 27050
Steam-TCP           27020 - 27050

folgende UDP Ports weiterleiten

4242
7777-7778
26900-26905
27015-27020
27215

From https://ark.gamepedia.com/Dedicated_Server_Setup

Server instance           Game port  Raw UDP port      Query port   RCON port
Server game instance 1         7777 	      7778      27015        27020
Server game instance 2         7779          7780      27016        27021
Server game instance 3         7781          7782      27017        27022
Server game instance 4
completely different ports 	9999         10000       37015       37016 

Ports can be set as start parameters (or GameUserSettings.ini?)

Server konfigurieren

Details https://ark.gamepedia.com/Dedicated_Server_Setup

sudo vi /etc/sysctl.conf
fs.file-max=1000000
sudo sysctl -p /etc/sysctl.conf
sudo vi /etc/security/limits.conf
steam               soft    nofile          1000000
steam               hard    nofile          1000000
sudo vi /etc/pam.d/common-session
session required pam_limits.so

above is probably not necessary if using this service file /etc/systemd/system/ark1.service

[Unit]
Description=ARK: Survival Evolved dedicated server 1
Wants=network-online.target
After=syslog.target network.target nss-lookup.target network-online.target

[Service]
ExecStartPre=/home/steam/Steam/linux32/steamcmd +force_install_dir /home/steam/ark1 +login anonymous +app_update 376030 +quit
ExecStart=/home/steam/ark1/ShooterGame/Binaries/Linux/ShooterGameServer TheIsland?listen -server -log
WorkingDirectory=/home/steam/ark1/ShooterGame/Binaries/Linux
LimitNOFILE=1000000
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s INT $MAINPID
User=steam
Group=users
TimeoutStartSec=300

[Install]
WantedBy=multi-user.target

for other "official" maps like TheIsland, e.g. Fjordur, just replace the name in the ShooterGameServer command. See https://www.g-portal.com/de/blog/ark-alle-maps-%C3%BCbersicht for available maps

after creating/changing the file do a

systemctl daemon-reload

to start the service

systemctl start ark1

to start after every boot

systemctl enable ark1

Updaten

den service restarten führt automatisch ein Update aus

systemctl restart ark1
systemctl status ark1

wenn diese Fehlermeldung kommt:

Error! App '376030' state is 0x206 after update job. :: ARK: Survival...

dann ist wahrscheinlich der Platz in /home/steam ausgegangen.

Konfiguration

siehe GameUserSettings.ini Referenz

im Verzeichnis, das man beim Installieren/Updaten angegeben hat (z.B. ~/servers/ark4walze1) in das Unterverzeichnis ShooterGame/Saved/Config/LinuxServer wechseln. Dort gibt es die Datei GameUserSettings.ini. Diese enthält unter anderem diese wichtigen Einstellungen. Vor allem die letzten beiden muss man bei der Installation anpassen!


ShowMapPlayerLocation=True
proximityChat=True
MaxStructuresInRange=1000
MaxPlayers=10
DifficultyOffset=0.2
SessionName=some-descriptive-name
ServerPassword=some-passsword
ServerAdminPassword=some-other-password

ein paar Einstellungen noch, die das Spiel leichter oder schwerer machen. Bei manchen haben schon winzige Änderungen einen großen Effekt:

NightTimeSpeedScale=3.0
TamingSpeedMultiplier=3.5
HarvestAmountMultiplier=1.5
DifficultyOffset=0.2
XPMultiplier=2

Und noch ein paar Einstellungen in Game.ini

[/script/shootergame.shootergamemode]
MatingIntervalMultiplier=1.0
EggHatchSpeedMultiplier=20.0
BabyMatureSpeedMultiplier=20.0

Neue Map

wenn es eine neue Map gibt, kann man sie als user steam so installieren (statt X eine Nummer):

cp -a ~/servers/ark4walze1 ~/servers/ark4walzeX
cp ~/start-ark4walze1.sh ~/start-ark4walzeX.sh
cp ~/update-ark4walze1.sh ~/update-ark4walzeX.sh

Dann in den Skripten noch das servers Verzeichnis anpassen (1 -> X) und im start-ark4walzeX.sh den Map-Namen (TheIsland?listen -> Ragnarok?listen) oder die Map ID ersetzen

Backup wiederherstellen

wenn's mal nicht so gut läuft, und man deshalb einen älteren Stand wieder herstellen will:

su - steam
killall ShooterGameServer
cd ~/servers/ark4walze3/ShooterGame/Saved/SavedArks
cp -av Ragnarok.ark Ragnarok_bad_luck.ark
cp -av Ragnarok_22.06.2017_18.28.22.ark Ragnarok.ark
~/start-ark4walze3.sh

die Backup Zeiten sind UTC nicht MEZ (also im Sommer um zwei Stunden verschoben, im Winter um eine)

Troubleshooting

First install (and a later one) with steamcmd had to be done with sudo or an error appears after 0% done

After first install, chown install directory from root to steam user and remove /tmp/dumps then it works fine without root privilege

History

The server did work. Then, after some time (and app/os updates) whithout playing, it no longer works. The server shows up on client list, but on connect attempt it always fails.

Traffic from/to ARK server and Steam client

log all TCP and UDP activities (listening or connected ports) of the server process user 10008

while sleep 1; do 
  out=`(cat /dev/shm/ss; ss -tupaen | grep 'uid:10008') | sort -u`; 
  echo "$out" | cat >/dev/shm/ss; 
done
tcp    LISTEN     16        *:27015                 *:*                   users:(("ShooterGameServ",pid=3674,fd=16)) uid:10008 ino:40596325 sk:5d35 <->
tcp    LISTEN     5      192.168.1.4:40470                 *:*                   users:(("ShooterGameServ",pid=3674,fd=22)) uid:10008 ino:40620317 sk:5eae <->
udp    UNCONN     0         *:27015                 *:*                   users:(("ShooterGameServ",pid=3674,fd=11)) uid:10008 ino:40597086 sk:5ce9 <->
udp    UNCONN     0         *:7778                  *:*                   users:(("ShooterGameServ",pid=3674,fd=18)) uid:10008 ino:40603817 sk:5d76 <->
udp    UNCONN     0      192.168.1.4:40884                 *:*                   users:(("ShooterGameServ",pid=3674,fd=23)) uid:10008 ino:40620881 sk:5eec <->
udp    UNCONN     0      192.168.1.4:43704                 *:*                   users:(("ShooterGameServ",pid=3674,fd=19)) uid:10008 ino:40620278 sk:5ea6 <->
udp    UNCONN     0      192.168.1.4:44104                 *:*                   users:(("ShooterGameServ",pid=3674,fd=20)) uid:10008 ino:40620279 sk:5ea7 <->
udp    UNCONN     0      192.168.1.4:47841                 *:*                   users:(("ShooterGameServ",pid=3674,fd=24)) uid:10008 ino:40620882 sk:5eed <->
udp    UNCONN     0      192.168.1.4:48225                 *:*                   users:(("ShooterGameServ",pid=3674,fd=21)) uid:10008 ino:40621075 sk:5eab <->
udp    UNCONN     0      192.168.1.4:48227                 *:*                   users:(("ShooterGameServ",pid=3674,fd=25)) uid:10008 ino:40620918 sk:5eef <->

Dump all traffic to and from server during a "server start, client connect attempt" event

Server (192.168.1.4), client (192.168.1.8) and router (192.168.1.222)

S='( ( src host 192.168.1.4 or src host 192.168.1.8 or src host 192.168.1.222 ) and ( dst host 192.168.1.222 or dst host 192.168.1.4 or dst host 192.168.1.8 or ! dst net 192.168.1.0/24 ) )'
D='( ( dst host 192.168.1.4 or dst host 192.168.1.8 or dst host 192.168.1.222 ) and ( src host 192.168.1.4 or src host 192.168.1.8 or src host 192.168.1.222 or ! src net 192.168.1.0/24 ) )'
tcpdump -qnti br0 "$S or $D" >/dev/shm/td

Dump all traffic during the same event on fritz box

The server was "exposed host" during that time and no firewall was active on the server

http://fritz.box/html/capture.html

Generate capture file for lan in wireshark format: iad-if-eth0_11.03.18_1351.bin

Analyze

All files on server in /root/ark-trace

Install and use generic steamcmd

Just in case opensuse does not provide a working steamcmd, this worked July 2023:

  • Removing steam related user config files
rm -rf ~steam/.local/share/steam* ~steam/.steam*
  • Deinstalling steamcmd and other steam related tumbleweed packages
(1/7) Removing ca-certificates-steamtricks-1-1.16.noarch ...[done]
(2/7) Removing steam-1.0.0.78-1.2.x86_64 ...[done]
(3/7) Removing steam-devices-1.0.0.78-1.2.x86_64 ...[done]
(4/7) Removing steamtricks-data-20180128.f77bb8e-1.15.noarch ...[done]
(5/7) Removing libopenssl1_0_0-steam-32bit-1.0.2u-17.1.x86_64...[done]
(6/7) Removing libopenssl1_0_0-steam-1.0.2u-17.1.x86_64 ...[done]
(7/7) Removing steamtricks-0.3.1-2.3.noarch ...[done]
sudo zypper rm steamcmd
rm -rf ~/Steam
mkdir ~/Steam
cd ~/Steam
curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -
./steamcmd.sh

As it probably provides fixes faster I'll keep that for now...