thorkseng / pi4valheim

experimental Docker file to run a Valheim server in a Raspberry Pi4
17 stars 12 forks source link

Support for other aarch64 devices (e.g. ODROID N2/N2+), was able to get working with tweaks to Dockerfile #3

Closed rstrube closed 2 years ago

rstrube commented 2 years ago

First off all, thank you so much for putting this docker image together! It's really quite spectacular!

I was hoping you might be able to update your pre-built docker image on docker hub to take advantage of the latest Box64 release. Apparently v0.2.0 was a big release with lots of performance improvements!

I'm going to try to build your image tonight and see how it works with the latest Box64 release. I noticed that your docker file is pulling down the latest release, so I'm hoping that when I build the image it will automatically include v0.2.0 of Box64. I'll report back with my findings!

rstrube commented 2 years ago

Quick update: I was able to successfully build the image, which included Box64 v0.2.1. Unfortunately despite my best efforts I'm unable to connect to the server using the Valheim client on my PC. I put in the LAN IP address of my server (192.168.86.25) and when I try to connect, the client spins for 10-15 seconds and dumps me back to the main menu. I also tried going through my public IP (with portforwarding setup on my router) and the same issue.

I thought perhaps it was something with the image I built, but I also tried your latest image on Docker hub (tranko/pi4valheim:0.211.11) and encountered the exact same problem.

Looking at the server logs I don't notice anything unusual, the server appears to run correctly, etc. I noticed some errors related to libparty but no major crashes etc.

Here is the output from my server log:

Mono path[0] = '/root/valheim_server/valheim_server_Data/Managed'
Mono config path = '/root/valheim_server/valheim_server_Data/MonoBleedingEdge/etc'
Preloaded 'libsteam_api.so'
Unable to preload the following plugins:
    libparty.so
PlayerPrefs - Creating folder: /root/.config/unity3d/IronGate
PlayerPrefs - Creating folder: /root/.config/unity3d/IronGate/Valheim
Unable to load player prefs
Initialize engine version: 2020.3.33f1 (915a7af8b0d5)
[Subsystems] Discovering subsystems at path /root/valheim_server/valheim_server_Data/UnitySubsystems
Forcing GfxDevice: Null
GfxDevice: creating device client; threaded=0
NullGfxDevice:
    Version:  NULL 1.0 [1.0]
    Renderer: Null Device
    Vendor:   Unity Technologies
Begin MonoManager ReloadAssembly
- Completed reload, in  1.303 seconds
ERROR: Shader Sprites/Default shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Sprites/Mask shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader GUI/Text Shader shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
UnloadTime: 47.594000 ms
11/24/2022 08:56:35: Starting to load scene:start
Couldn't create a Convex Mesh from source mesh "default" within the maximum polygons limit (256). The partial hull will be used. Consider simplifying your mesh.
ERROR: Shader UI/Default shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
Couldn't create a Convex Mesh from source mesh "default" within the maximum polygons limit (256). The partial hull will be used. Consider simplifying your mesh.
ERROR: Shader Legacy Shaders/VertexLit shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Standard (Specular setup)' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader Standard (Specular setup) shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Standard (Specular setup)' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
WARNING: Shader Unsupported: 'Standard' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader Standard shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Standard' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
WARNING: Shader Unsupported: 'Autodesk Interactive' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader Autodesk Interactive shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Autodesk Interactive' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader Legacy Shaders/Particles/Additive shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Legacy Shaders/Particles/Alpha Blended shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Legacy Shaders/Particles/Alpha Blended Premultiply shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Unlit/Color shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Lux Lit Particles/ Bumped shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
HDR Render Texture not supported, disabling HDR on reflection probe.
HDR Render Texture not supported, disabling HDR on reflection probe.
Unloading 6 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 144.872250 ms
Only custom filters can be played. Please add a custom filter or an audioclip to the audiosource (Amb_MainMenu).
HDR Render Texture not supported, disabling HDR on reflection probe.
11/24/2022 08:57:04: Setting -savedir to: /root/valheim_data
11/24/2022 08:57:04: Setting -logfile to: /root/valheim_data/server.log
11/24/2022 08:57:04: Get create world Montana
11/24/2022 08:57:04: Using environment steamid 892970
11/24/2022 08:57:04: Using steam APPID:892970
[S_API] SteamAPI_Init(): Loaded local 'steamclient.so' OK.
CAppInfoCacheReadFromDiskThread took 9 milliseconds to initialize
Setting breakpad minidump AppID = 892970
[S_API FAIL] Tried to access Steam interface SteamNetworkingUtils003 before SteamAPI_Init succeeded.
11/24/2022 08:57:05: Server ID 90071992547409920
11/24/2022 08:57:06: Authentication:k_ESteamNetworkingAvailability_Waiting
11/24/2022 08:57:06: Steam game server initialized
11/24/2022 08:57:06: Using default prefs
11/24/2022 08:57:06: Valheim version:0.211.11
11/24/2022 08:57:06: Render threading mode:SingleThreaded
11/24/2022 08:57:06: Missing audio clip in music respawn
11/24/2022 08:57:07: Builder started
11/24/2022 08:57:12: Loaded localization CSV:localization language:English
11/24/2022 08:57:12: Loaded localization CSV:localization_extra language:English
Fallback handler could not load library /root/valheim_server/valheim_server_Data/Mono/libparty
Fallback handler could not load library /root/valheim_server/valheim_server_Data/Mono/libparty.so
Fallback handler could not load library /root/valheim_server/valheim_server_Data/Mono/party
Fallback handler could not load library /root/valheim_server/valheim_server_Data/Mono/libparty
Fallback handler could not load library /root/valheim_server/valheim_server_Data/Mono/libparty.so
Fallback handler could not load library /root/valheim_server/valheim_server_Data/Mono/libparty
Fallback handler could not load library /root/valheim_server/valheim_server_Data/Mono/libparty
Fallback handler could not load library /root/valheim_server/valheim_server_Data/Mono/libparty.so
Fallback handler could not load library /root/valheim_server/valheim_server_Data/Mono/party
Fallback handler could not load library /root/valheim_server/valheim_server_Data/Mono/libparty
Fallback handler could not load library /root/valheim_server/valheim_server_Data/Mono/libparty.so
Fallback handler could not load library /root/valheim_server/valheim_server_Data/Mono/libparty
DllNotFoundException: party
  at (wrapper managed-to-native) PartyCSharpSDK.Interop.PFPInterop.PartyInitialize(byte[],PartyCSharpSDK.Interop.PARTY_HANDLE&)
  at PartyCSharpSDK.SDK.PartyInitialize (System.String titleId, PartyCSharpSDK.PARTY_HANDLE& handle) [0x00006] in <b608fa7876f34b489ca90384515ce785>:0 
  at PlayFab.Party.PlayFabMultiplayerManager.InitializeImpl () [0x000be] in <b608fa7876f34b489ca90384515ce785>:0 
  at PlayFab.Party.PlayFabMultiplayerManager._Initialize () [0x0000a] in <b608fa7876f34b489ca90384515ce785>:0 
  at PlayFab.Party.PlayFabMultiplayerManager.Start () [0x00000] in <b608fa7876f34b489ca90384515ce785>:0 

The shader Hidden/Dof/DepthOfFieldHdr (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.DepthOfField) is not supported on this platform!
The image effect Main Camera (UnityStandardAssets.ImageEffects.DepthOfField) has been disabled as it's not supported on the current platform.
The shader Hidden/SunShaftsComposite (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) is not supported on this platform!
The shader Hidden/SimpleClear (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) is not supported on this platform!
The image effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) has been disabled as it's not supported on the current platform.
11/24/2022 08:57:13: Game server connected
11/24/2022 08:57:14: UI Group status changed Menu = True

Unloading 16 unused Assets to reduce memory usage. Loaded Objects now: 105713.
Total: 364.991417 ms (FindLiveObjects: 28.755250 ms CreateObjectMapping: 26.906666 ms MarkObjects: 302.342417 ms  DeleteObjects: 6.568292 ms)

Unloading 6 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 183.827541 ms
HDR Render Texture not supported, disabling HDR on reflection probe.
HDR Render Texture not supported, disabling HDR on reflection probe.
11/24/2022 08:57:17: Using default prefs
11/24/2022 08:57:17: isModded: False
11/24/2022 08:57:17: Zonesystem Awake 280
11/24/2022 08:57:17: DungeonDB Awake 280
11/24/2022 08:57:17: Registering lobby
11/24/2022 08:57:33: Audioman already exist, destroying self

Unloading 527 unused Assets to reduce memory usage. Loaded Objects now: 106143.
Total: 453.115708 ms (FindLiveObjects: 27.434333 ms CreateObjectMapping: 26.503042 ms MarkObjects: 370.141833 ms  DeleteObjects: 29.030000 ms)

11/24/2022 08:58:02: Zonesystem Start 280
11/24/2022 08:58:05: Added 3 locations, 0 vegetations, 0 environments, 0 biome env-setups from locations_cp1
11/24/2022 08:58:05: Added 1 locations, 0 vegetations, 1 environments, 0 biome env-setups from locations_mountaincaves
11/24/2022 08:58:05: DungeonDB Start 280
11/24/2022 08:58:08: ZRpc timeout set to 30s 
11/24/2022 08:58:08: Load world: Montana (Montana)
11/24/2022 08:58:08:   missing /root/valheim_data/worlds_local/Montana.db
11/24/2022 08:58:08: Generating locations
11/24/2022 08:58:08: Checking for location duplicates
11/24/2022 08:58:26: Failed to place all FireHole, placed 197 out of 200
11/24/2022 08:58:57: Failed to place all GoblinCamp2, placed 192 out of 200
11/24/2022 08:59:33: Failed to place all TrollCave02, placed 248 out of 250
11/24/2022 09:01:20: Failed to place all TarPit1, placed 64 out of 100
11/24/2022 09:01:31: Failed to place all TarPit2, placed 13 out of 100
11/24/2022 09:01:43: Failed to place all TarPit3, placed 87 out of 100
11/24/2022 09:02:13: Failed to place all MountainCave02, placed 137 out of 160
11/24/2022 09:02:13:  Done generating locations, duration:245172.715 ms
The shader Hidden/Dof/DepthOfFieldHdr (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.DepthOfField) is not supported on this platform!
The image effect Main Camera (UnityStandardAssets.ImageEffects.DepthOfField) has been disabled as it's not supported on the current platform.
The shader Hidden/SunShaftsComposite (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) is not supported on this platform!
The shader Hidden/SimpleClear (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) is not supported on this platform!
The image effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) has been disabled as it's not supported on the current platform.

And here is the output from my Box64 trace log:

Debug level is 1
Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL PageSize:4096
BOX64_LD_LIBRARY_PATH: ./linux64/:/root/steam/linux32/:$BOX64_LD_LIBRARY_PATH/
Using default BOX64_PATH: ./:bin/
Counted 27 Env var
Looking for ./valheim_server.x86_64
argv[1]="-nographics"
argv[2]="-batchmode"
argv[3]="-name"
argv[4]="MontanaMayhem"
argv[5]="-port"
argv[6]="2456"
argv[7]="-world"
argv[8]="Montana"
argv[9]="-savedir"
argv[10]="/root/valheim_data"
argv[11]="-public"
argv[12]="0"
argv[13]="-logFile"
argv[14]="/root/valheim_data/server.log"
argv[15]="-saveinterval"
argv[16]="1800"
argv[17]="-backups"
argv[18]="4"
argv[19]="-backupshort"
argv[20]="1800"
argv[21]="-backuplong"
argv[22]="1800"
Rename process to "valheim_server.x86_64"
Using emulated UnityPlayer.so
Using native(wrapped) libm.so.6
Using emulated /usr/lib/x86_64-linux-gnu/libgcc_s.so.1
Using native(wrapped) libpthread.so.0
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
Using native(wrapped) librt.so.1
Using native(wrapped) libdl.so.2
Using emulated /root/valheim_server/valheim_server_Data/MonoBleedingEdge/x86_64/libmonobdwgc-2.0.so
MonoBleedingEdge detected, disable Dynarec BigBlock and enable Dynarec StrongMem
Using emulated /root/valheim_server/valheim_server_Data/Plugins/libparty.so
Using native(wrapped) libz.so.1
Using native(wrapped) libatomic.so.1
Using native(wrapped) libpulse.so.0
Using native(wrapped) libpulse-simple.so.0
Error loading needed lib libpulse-mainloop-glib.so.0
Error loading one of needed lib
Error initializing needed lib libparty.so
Using emulated /root/valheim_server/valheim_server_Data/Plugins/libsteam_api.so
Error loading needed lib libpulse-mainloop-glib.so.0
Error loading one of needed lib
Error initializing needed lib libparty.so
Using emulated ./linux64/steamclient.so
Error loading needed lib steamservice.so
Warning: Cannot dlopen("steamservice.so"/0xffff026e1e80, 2)
Error loading needed lib libsteam.so
Warning: Cannot dlopen("libsteam.so"/0xffff929a3eb9, 2)
Error loading needed lib libpulse-mainloop-glib.so.0
Error loading one of needed lib
Error initializing needed lib libparty.so
Error loading needed lib libparty
Warning: Cannot dlopen("libparty"/0x68b73b40, 101)
Error loading needed lib libpulse-mainloop-glib.so.0
Error loading one of needed lib
Error initializing needed lib libparty.so
Warning: Cannot dlopen("libparty.so"/0x68b73b40, 101)
Error loading needed lib party
Warning: Cannot dlopen("party"/0x6890f860, 101)
Error loading needed lib libparty
Warning: Cannot dlopen("libparty"/0x68b73d50, 101)
Error loading needed lib libpulse-mainloop-glib.so.0
Error loading one of needed lib
Error initializing needed lib libparty.so
Warning: Cannot dlopen("libparty.so"/0x68b73d50, 101)
Error loading needed lib libparty
Warning: Cannot dlopen("libparty"/0x6890f910, 101)
Error loading needed lib libpulse-mainloop-glib.so.0
Error loading one of needed lib
Error initializing needed lib libparty.so
Error loading needed lib libparty
Warning: Cannot dlopen("libparty"/0x68ba2350, 101)
Error loading needed lib libpulse-mainloop-glib.so.0
Error loading one of needed lib
Error initializing needed lib libparty.so
Warning: Cannot dlopen("libparty.so"/0x68ba2350, 101)
Error loading needed lib party
Warning: Cannot dlopen("party"/0x68c6d050, 101)
Error loading needed lib libparty
Warning: Cannot dlopen("libparty"/0x68c6f360, 101)
Error loading needed lib libpulse-mainloop-glib.so.0
Error loading one of needed lib
Error initializing needed lib libparty.so
Warning: Cannot dlopen("libparty.so"/0x68c6f360, 101)
Error loading needed lib libparty
Warning: Cannot dlopen("libparty"/0x68b7e9f0, 101)
Using native(wrapped) libSDL2-2.0.so.0

I want to note that I'm running on an Odroid N2+ which is (from a hardware perspective) more powerful than the Rpi. It uses aarch64 (specifically arm64v8) like the Rpi, and I haven't had any problems running other docker images made explicitly for the Rpi in the past.

I'm currently running Ubuntu 22.04 with Kernel 6.0, so a very up-to-date system.

Let me know if there's anything else I can provide, I'd love to try to get this working!

rstrube commented 2 years ago

Another update!

I was able to get everything working, I had to modify your dockerfile with specific Cmake options for the Odroid.

Specifically (for others that might stumble across this issue):

I had to change -DRPI4ARM64=1 to -DODROIDN2=ON for both Box86 and Box64. This created a more optimzed build for my hardware.

Also it takes quite a long time for the server to become fully initialized, which is the main reason I wasn't able to connect. I left the server running for 5-10 mins, and then was able to connect no problem.

I was wondering if you would be comfortable opening up a PR with a new dockerfile for the OdroidN2+? If not, I could fork your repo and maintain the Dockerfile myself. Completely up to you! Thanks again for all the amazing work!

thorkseng commented 2 years ago

I am happy it works!

I have created a docker file for ODROID N2/N2+ with the changes that you write, let me know if its correct. I did a commit seconds ago with the new file and updated instructions on this commit

Let me know if it's correct, and I will close the issue.

Regards, Tranko.

thorkseng commented 2 years ago

Also, as you mention that box64 has a good improvements in 0.2.0 version, I am building a new image (for Pi4), and upload to docker hub.

rstrube commented 2 years ago

Thank you!

The only thing I would recommend (which I forgot to mention in my last post) is to use:

RUN make -j6; instead of RUN make -j4; since the Odroid N2/N2+ has six CPU cores to compile with. This cuts down on the compilation time significantly.

Also I'd be happy to build images on Docker Hub that you could link to in your README if you'd like!

Let me know!

Thanks again.

thorkseng commented 2 years ago

Hello!

I have created a new commit with the change

Also, I have compile a new image and upload it to the docker hub. Point that that image is for Pi4, not for Odroid. I think that the issue is fixed :) feel free to open any other to improve the new dockerfile.

Regards, Alvaro.

rstrube commented 2 years ago

Thank you the changes look great! I appreciate your efforts.