Skip to content

Commit

Permalink
remove qemu option and update to latest arm64 base image
Browse files Browse the repository at this point in the history
  • Loading branch information
sonroyaalmerol authored Jul 7, 2024
1 parent f86c047 commit 729693f
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 18 deletions.
9 changes: 9 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,12 @@ ALLOW_CONNECT_PLATFORM=Steam
USE_BACKUP_SAVE_DATA=True
USE_DEPOT_DOWNLOADER=False
INSTALL_BETA_INSIDER=False

# Box64 Configs (Only relevant for ARM64 hosts)
# These can be adjusted if server keeps on crashing.
BOX64_DYNAREC_STRONGMEM=1
BOX64_DYNAREC_BIGBLOCK=1
BOX64_DYNAREC_SAFEFLAGS=1
BOX64_DYNAREC_FASTROUND=1
BOX64_DYNAREC_FASTNAN=1
BOX64_DYNAREC_X87DOUBLE=0
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN wget -q https://github.com/gorcon/rcon-cli/archive/refs/tags/v${RCON_VERSION
FROM cm2network/steamcmd:root as base-amd64
# Ignoring --platform=arm64 as this is required for the multi-arch build to continue to work on amd64 hosts
# hadolint ignore=DL3029
FROM --platform=arm64 sonroyaalmerol/steamcmd-arm64:root-2024-07-04 as base-arm64
FROM --platform=arm64 sonroyaalmerol/steamcmd-arm64:root-2024-07-08 as base-arm64

ARG TARGETARCH
# Ignoring the lack of a tag here because the tag is defined in the above FROM lines
Expand Down Expand Up @@ -158,13 +158,21 @@ ENV HOME=/home/steam \
DISCORD_ERR_BACKUP_DELETE_MESSAGE_ENABLED=true \
ENABLE_PLAYER_LOGGING=true \
PLAYER_LOGGING_POLL_PERIOD=5 \
ARM_QEMU_MODE=false \
ARM64_DEVICE=generic \
DISABLE_GENERATE_ENGINE=true \
ALLOW_CONNECT_PLATFORM=Steam \
USE_DEPOT_DOWNLOADER=false \
INSTALL_BETA_INSIDER=false

# Sane Box64 config defaults
# hadolint ignore=DL3044
ENV BOX64_DYNAREC_STRONGMEM=1 \
BOX64_DYNAREC_BIGBLOCK=1 \
BOX64_DYNAREC_SAFEFLAGS=1 \
BOX64_DYNAREC_FASTROUND=1 \
BOX64_DYNAREC_FASTNAN=1 \
BOX64_DYNAREC_X87DOUBLE=0

# Passed from Github Actions
ARG GIT_VERSION_TAG=unspecified

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ It is highly recommended you set the following environment values before startin
| DISABLE_GENERATE_ENGINE | Whether to automatically generate the Engine.ini | true | true/false | 0.30.0 |
| ENABLE_PLAYER_LOGGING | Enables Logging and announcing when players join and leave | true | true/false | 0.31.0 |
| PLAYER_LOGGING_POLL_PERIOD | Polling period (in seconds) to check for players who have joined or left | 5 | !0 | 0.31.0 |
| ARM_QEMU_MODE | Switches the compatibility layer from Box86 to QEMU when executing steamcmd for server updates. This setting is only applicable for ARM64 hosts. | false | true/false | 0.30.0 |
| ARM64_DEVICE | Specify Box64 build to be used based on host device. This setting is only applicable for ARM64 hosts. | generic | generic, m1, rpi5, adlink | 0.39.0 |
| USE_DEPOT_DOWNLOADER | Uses DepotDownloader to download game server files instead of steamcmd. This will help hosts incompatible with steamcmd (e.g. M-series Mac) | false | true/false | 0.39.0 |

Expand Down
36 changes: 33 additions & 3 deletions docusaurus/docs/known-issues/known-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ it means that you'll need to look at the following:

## Only ARM64 hosts with 4k page size is supported

:::tip
This issue should not occur anymore after the addition of `USE_DEPOT_DOWNLOADER`. Instead, it should ask you to set the
said configuration to `true`.
:::

This error occurs when the container detects that the host kernel does not have a 4k page size,
which is required for the emulation used for ARM64 architecture. The container relies on this specific page
size for proper execution.
Expand All @@ -100,9 +105,34 @@ problematic machine to prevent steamcmd from executing.
This means that the Docker host is unable to run AArch32 binaries such as Box86 without an additional
compatibility layer which is the case for Apple Silicon.

Docker Desktop solves this by running its containers inside a VM (QEMU) with a compatible kernel.
However, if you're unable to use Docker Desktop, then try setting `ARM_QEMU_MODE` to `true`.
This will switch the container from using Box86 to QEMU when running steamcmd.
Try setting `USE_DEPOT_DOWNLOADER` to `true`. This will switch the container from using steamcmd to
DepotDownloader instead. This should avoid the need for any AArch32 emulation.

## Server keeps on crashing randomly! (ARM64 hosts)

For ARM64 hosts, emulation of the server binaries and libraries is required. As such, huge updates can cause Box64
(the emulator we use) to crash due to many reasons. Box64 has a lot of configuration options to tweak the emulator
for specific binaries. We will try to set appropriate defaults for these configs as we receive more reports. In general,
setting the following environment variables will give you the best chance of stability in exchange for performance:

* `BOX64_DYNAREC_BIGBLOCK=0` (Default: 1)
* `BOX64_DYNAREC_SAFEFLAGS=2` (Default: 1)
* `BOX64_DYNAREC_STRONGMEM=3` (Default: 1)
* `BOX64_DYNAREC_FASTROUND=0` (Default: 1)
* `BOX64_DYNAREC_FASTNAN=0` (Default: 1)
* `BOX64_DYNAREC_X87DOUBLE=1` (Default: 0)

See [Box64 usage documentation](https://github.com/ptitSeb/box64/blob/main/docs/USAGE.md) for more info.

Also, the container should have multiple Box64 variants for different host devices. This can be set using the `ARM64_DEVICE`
environment variable.

For best compatibility with **Apple Silicon**, set `ARM64_DEVICE` to `m1`.
For best compatibility with **Oracle ARM**, set `ARM64_DEVICE` to `adlink`.
For best compatibility with **Raspberry Pi 5**, set `ARM64_DEVICE` to `rpi5`.

These builds are from the [ARM64 base image](https://github.com/sonroyaalmerol/steamcmd-arm64). If your device is not listed
above, consider creating an issue on the base image's repository.

## FAQ

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ Es wird dringend empfohlen, die folgenden Umgebungsvariablen festzulegen, bevor
| DISABLE_GENERATE_ENGINE | Ob die Engine.ini automatisch generiert werden soll | true | true/false |
| ENABLE_PLAYER_LOGGING | Aktiviert das Protokollieren und die Benachrichtigung, wenn Spieler dem Spiel beitreten und es verlassen. | true | true/false |
| PLAYER_LOGGING_POLL_PERIOD | Abfrageintervall (in Sekunden), um zu überprüfen, ob Spieler dem Spiel beigetreten sind oder es verlassen haben. | 5 | !0 |
| ARM_QEMU_MODE | Schaltet die Kompatibilitätsschicht von Box86 auf QEMU um, wenn steamcmd für Serverupdates ausgeführt wird. Diese Einstellung ist nur für ARM64-Hosts relevant. | false | true/false |

*dringend empfohlen, festzulegen

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ sidebar_label: Server Settings
| DISABLE_GENERATE_ENGINE | 엔진설정의 생성을 비활성화 합니다.ini | true | true/false |
| ENABLE_PLAYER_LOGGING | 플레이어가 접속 또는 종료시 로깅과 공지를 활성화 | true | true/false |
| PLAYER_LOGGING_POLL_PERIOD | 플레이어의 접속과 종료를 확인하기위한 폴링시간(초) 설정 | 5 | !0 |
| ARM_QEMU_MODE | 서버 업데이트를하기 위해 steamcmd를 실행시 호환성 레이어를 Box86에서 QEMU로 변경. 이 설정은 ARM64 호스트 전용입니다. | false | true/false |

*설정하는 것을 적극 권장합니다.

Expand Down
10 changes: 0 additions & 10 deletions scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ cd /palworld || exit
# Get the architecture using dpkg
architecture=$(dpkg --print-architecture)

if [ "$architecture" == "arm64" ] && [ "${ARM_QEMU_MODE,,}" = true ]; then
LogInfo "ARM QEMU mode enabled"
export DEBUGGER="/usr/bin/qemu-i386-static"

# Arbitrary number to avoid CPU_MHZ warning due to qemu and steamcmd
export CPU_MHZ=2000
fi

IsInstalled
ServerInstalled=$?
if [ "$ServerInstalled" == 1 ]; then
Expand All @@ -45,8 +37,6 @@ fi
if [ "$architecture" == "arm64" ]; then
# create an arm64 version of ./PalServer.sh
cp ./PalServer.sh ./PalServer-arm64.sh

export BOX64_DYNAREC_STRONGMEM=1

sed -i "s|\(\"\$UE_PROJECT_ROOT\/Pal\/Binaries\/Linux\/PalServer-Linux-Shipping\" Pal \"\$@\"\)|LD_LIBRARY_PATH=/home/steam/steamcmd/linux64:\$LD_LIBRARY_PATH /usr/local/bin/box64 \1|" ./PalServer-arm64.sh
chmod +x ./PalServer-arm64.sh
Expand Down

0 comments on commit 729693f

Please sign in to comment.