diff --git a/.env.example b/.env.example index a2fe636e9..7b44554ac 100644 --- a/.env.example +++ b/.env.example @@ -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 the server keeps on crashing. +BOX64_DYNAREC_STRONGMEM=1 # This can be set to 2 or 3 with 3 being the most stable but worst performance. +BOX64_DYNAREC_BIGBLOCK=1 # This can be set to 0 for better stability but worse performance. +BOX64_DYNAREC_SAFEFLAGS=1 # This can be set to 2 for better stability but worse performance. +BOX64_DYNAREC_FASTROUND=1 # This can be set to 0 for better stability but worse performance. +BOX64_DYNAREC_FASTNAN=1 # This can be set to 0 for better stability but worse performance. +BOX64_DYNAREC_X87DOUBLE=0 # This can be set to 1 for better stability but worse performance. \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 1c8409b7b..cff3e3402 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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-06-23 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 @@ -158,12 +158,21 @@ ENV HOME=/home/steam \ DISCORD_ERR_BACKUP_DELETE_MESSAGE_ENABLED=true \ ENABLE_PLAYER_LOGGING=true \ PLAYER_LOGGING_POLL_PERIOD=5 \ - ARM_COMPATIBILITY_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 diff --git a/README.md b/README.md index 9a63b8d9c..1d41af179 100644 --- a/README.md +++ b/README.md @@ -285,7 +285,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_COMPATIBILITY_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 | | 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 | *highly recommended to set @@ -294,6 +293,29 @@ It is highly recommended you set the following environment values before startin *** Required for docker stop to save and gracefully close the server +### ARM64-exclusive environment variables + +ARM64 hosts can use the following variables to tweak their server setup. This includes +known relevant Box64 configurations one can modify for better server stability/performance. + +For the Box64 configurations, please see the their official documentation for more info. + +> [!TIP] +> Set `ARM64_DEVICE` to the most appropriate setting for your device. `generic` is expected +> to work on all devices but better stability can be found with specifying your device. +> For more specific device compatibility, create an issue on the +> [base image repo](https://github.com/sonroyaalmerol/steamcmd-arm64). + +| Variable | Info | Default Values | Allowed Values | Added in Version | +|--------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|------------------| +| BOX64_DYNAREC_STRONGMEM | [[Box64 config](https://github.com/ptitSeb/box64/blob/main/docs/USAGE.md#box64_dynarec_strongmem-)] Enable/Disable simulation of Strong Memory model | 1 | 0, 1, 2, 3 | 0.23.0 | +| BOX64_DYNAREC_BIGBLOCK | [[Box64 config](https://github.com/ptitSeb/box64/blob/main/docs/USAGE.md#box64_dynarec_bigblock-)] Enables/Disables Box64's Dynarec building BigBlock. | 1 | 0, 1, 2, 3 | 0.23.0 | +| BOX64_DYNAREC_SAFEFLAGS | [[Box64 config](https://github.com/ptitSeb/box64/blob/main/docs/USAGE.md#box64_dynarec_safeflags-)] Handling of flags on CALL/RET opcodes | 1 | 0, 1, 2 | 0.23.0 | +| BOX64_DYNAREC_FASTROUND | [[Box64 config](https://github.com/ptitSeb/box64/blob/main/docs/USAGE.md#box64_dynarec_fastround-)] Enable/Disable generation of precise x86 rounding | 1 | 0, 1 | 0.23.0 | +| BOX64_DYNAREC_FASTNAN | [[Box64 config](https://github.com/ptitSeb/box64/blob/main/docs/USAGE.md#box64_dynarec_fastnan-)] Enable/Disable generation of -NAN | 1 | 0, 1 | 0.23.0 | +| BOX64_DYNAREC_X87DOUBLE | [[Box64 config](https://github.com/ptitSeb/box64/blob/main/docs/USAGE.md#box64_dynarec_x87double-)] Force the use of Double for x87 emulation | 0 | 0, 1 | 0.23.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 | + ### Game Ports | Port | Info | diff --git a/docusaurus/docs/getting-started/configuration/server-settings.md b/docusaurus/docs/getting-started/configuration/server-settings.md index 628784aab..2f9300322 100644 --- a/docusaurus/docs/getting-started/configuration/server-settings.md +++ b/docusaurus/docs/getting-started/configuration/server-settings.md @@ -101,7 +101,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_COMPATIBILITY_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 | | 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 | *highly recommended to set @@ -110,6 +109,30 @@ It is highly recommended you set the following environment values before startin *** Required for docker stop to save and gracefully close the server +## ARM64-exclusive environment variables + +ARM64 hosts can use the following variables to tweak their server setup. This includes +known relevant Box64 configurations one can modify for better server stability/performance. + +For the Box64 configurations, please see the their official documentation for more info. + +:::tip +Set `ARM64_DEVICE` to the most appropriate setting for your device. `generic` is expected +to work on all devices but better stability can be found with specifying your device. +For more specific device compatibility, create an issue on the +[base image repo](https://github.com/sonroyaalmerol/steamcmd-arm64). +::: + +| Variable | Info | Default Values | Allowed Values | Added in Version | +|--------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|------------------| +| BOX64_DYNAREC_STRONGMEM | [[Box64 config](https://github.com/ptitSeb/box64/blob/main/docs/USAGE.md#box64_dynarec_strongmem-)] Enable/Disable simulation of Strong Memory model | 1 | 0, 1, 2, 3 | 0.23.0 | +| BOX64_DYNAREC_BIGBLOCK | [[Box64 config](https://github.com/ptitSeb/box64/blob/main/docs/USAGE.md#box64_dynarec_bigblock-)] Enables/Disables Box64's Dynarec building BigBlock. | 1 | 0, 1, 2, 3 | 0.23.0 | +| BOX64_DYNAREC_SAFEFLAGS | [[Box64 config](https://github.com/ptitSeb/box64/blob/main/docs/USAGE.md#box64_dynarec_safeflags-)] Handling of flags on CALL/RET opcodes | 1 | 0, 1, 2 | 0.23.0 | +| BOX64_DYNAREC_FASTROUND | [[Box64 config](https://github.com/ptitSeb/box64/blob/main/docs/USAGE.md#box64_dynarec_fastround-)] Enable/Disable generation of precise x86 rounding | 1 | 0, 1 | 0.23.0 | +| BOX64_DYNAREC_FASTNAN | [[Box64 config](https://github.com/ptitSeb/box64/blob/main/docs/USAGE.md#box64_dynarec_fastnan-)] Enable/Disable generation of -NAN | 1 | 0, 1 | 0.23.0 | +| BOX64_DYNAREC_X87DOUBLE | [[Box64 config](https://github.com/ptitSeb/box64/blob/main/docs/USAGE.md#box64_dynarec_x87double-)] Force the use of Double for x87 emulation | 0 | 0, 1 | 0.23.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 | + ### Game Ports The server needs the following ports by default. diff --git a/docusaurus/docs/known-issues/known-issues.md b/docusaurus/docs/known-issues/known-issues.md index c0ecab36c..e82d2e9a4 100644 --- a/docusaurus/docs/known-issues/known-issues.md +++ b/docusaurus/docs/known-issues/known-issues.md @@ -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. @@ -100,9 +105,36 @@ 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_COMPATIBILITY_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. + +:::tip +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 diff --git a/docusaurus/i18n/de/docusaurus-plugin-content-docs/current/getting-started/configuration/server-settings.md b/docusaurus/i18n/de/docusaurus-plugin-content-docs/current/getting-started/configuration/server-settings.md index ea524074e..b92ad19da 100644 --- a/docusaurus/i18n/de/docusaurus-plugin-content-docs/current/getting-started/configuration/server-settings.md +++ b/docusaurus/i18n/de/docusaurus-plugin-content-docs/current/getting-started/configuration/server-settings.md @@ -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_COMPATIBILITY_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 diff --git a/docusaurus/i18n/ko/docusaurus-plugin-content-docs/current/getting-started/configuration/server-settings.md b/docusaurus/i18n/ko/docusaurus-plugin-content-docs/current/getting-started/configuration/server-settings.md index fc10bfa1b..90d06192c 100644 --- a/docusaurus/i18n/ko/docusaurus-plugin-content-docs/current/getting-started/configuration/server-settings.md +++ b/docusaurus/i18n/ko/docusaurus-plugin-content-docs/current/getting-started/configuration/server-settings.md @@ -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_COMPATIBILITY_MODE | 서버 업데이트를하기 위해 steamcmd를 실행시 호환성 레이어를 Box86에서 QEMU로 변경. 이 설정은 ARM64 호스트 전용입니다. | false | true/false | *설정하는 것을 적극 권장합니다. diff --git a/scripts/start.sh b/scripts/start.sh index c57b9d09b..0982ba97f 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -15,14 +15,6 @@ cd /palworld || exit # Get the architecture using dpkg architecture=$(dpkg --print-architecture) -if [ "$architecture" == "arm64" ] && [ "${ARM_COMPATIBILITY_MODE,,}" = true ]; then - LogInfo "ARM compatibility 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 @@ -45,26 +37,8 @@ fi if [ "$architecture" == "arm64" ]; then # create an arm64 version of ./PalServer.sh cp ./PalServer.sh ./PalServer-arm64.sh - - pagesize=$(getconf PAGESIZE) - box64_binary="box64" - - case $pagesize in - 8192) - LogInfo "Using Box64 for 8k pagesize" - box64_binary="box64-8k" - ;; - 16384) - LogInfo "Using Box64 for 16k pagesize" - box64_binary="box64-16k" - ;; - 65536) - LogInfo "Using Box64 for 64k pagesize" - box64_binary="box64-64k" - ;; - esac - sed -i "s|\(\"\$UE_PROJECT_ROOT\/Pal\/Binaries\/Linux\/PalServer-Linux-Shipping\" Pal \"\$@\"\)|LD_LIBRARY_PATH=/home/steam/steamcmd/linux64:\$LD_LIBRARY_PATH $box64_binary \1|" ./PalServer-arm64.sh + 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 STARTCOMMAND=("./PalServer-arm64.sh") else