error building with linux/amd64 flag on Apple Silicon (ARM)
steveafrost opened this issue · 2 comments
This image runs perfect on an Intel-based machine but I am trying to run it on an Apple Silicon (M2 specifically) using the platform=linux/amd64
flag tip from another thread on this repo.
It seems to get stuck at mono and throws a fatal error/signal and then the server is not booted completely. Anybody have this happen or familiar with how I can resolve the mono error on an Apple Silicon machine?
Thanks for the help!
docker-compose.yml
services:
removed-server-name:
image: ghcr.io/lloesche/valheim-server
platform: linux/amd64
cap_add:
- sys_nice
volumes:
- $HOME/docker/valheim/config:/config
- $HOME/docker/valheim/data:/opt/valheim
ports:
- "2456-2458:2456-2458/udp"
- "9001:9001/tcp"
env_file:
- $HOME/docker/valheim/valheim.env
restart: always
stop_grace_period: 2m
Logs on docker compose up
Apr 3 18:35:27 supervisord: valheim-server V: mono_helper_ldstr_mscorlib
Apr 3 18:35:27 supervisord: valheim-server * Assertion at ../../mono/arch/amd64/../x86/x86-codegen.h:410, condition `offset == (gint32)offset' not met
Apr 3 18:35:27 supervisord: valheim-server Caught fatal signal - signo:6 code:-6 errno:0 addr:0x1ef
Apr 3 18:35:27 supervisord: valheim-server Obtained 65 stack frames.
Apr 3 18:35:27 supervisord: valheim-server #0 0x007ffffd802140 in funlockfile
Apr 3 18:35:27 supervisord: valheim-server #1 0x007ffffd653ce1 in gsignal
Apr 3 18:35:27 supervisord: valheim-server #2 0x007ffffd63d537 in abort
Apr 3 18:35:27 supervisord: valheim-server #3 0x007ffff988e161 in monoeg_assert_abort
Apr 3 18:35:27 supervisord: valheim-server #4 0x007ffff98776a2 in mono_dl_fallback_unregister
Apr 3 18:35:27 supervisord: valheim-server #5 0x007ffff988e479 in monoeg_g_logv
Apr 3 18:35:27 supervisord: valheim-server #6 0x007ffff988e5b2 in monoeg_assertion_message
Apr 3 18:35:27 supervisord: valheim-server #7 0x007ffff988e5e2 in mono_assertion_message
Apr 3 18:35:27 supervisord: valheim-server #8 0x007ffff972255f in monovm_shutdown
Apr 3 18:35:27 supervisord: valheim-server #9 0x007ffff96688f6 in _init
Apr 3 18:35:27 supervisord: valheim-server #10 0x007ffff966a811 in _init
Apr 3 18:35:27 supervisord: valheim-server #11 0x007ffff966b9f6 in _init
Apr 3 18:35:27 supervisord: valheim-server #12 0x007ffff966f688 in mono_jit_set_domain
Apr 3 18:35:27 supervisord: valheim-server #13 0x007ffff96ed603 in mono_install_ftnptr_eh_callback
Apr 3 18:35:27 supervisord: valheim-server #14 0x007ffff96ed06c in mono_install_ftnptr_eh_callback
Apr 3 18:35:27 supervisord: valheim-server #15 0x007ffff9600396 in (Unknown)
Apr 3 18:35:27 supervisord: valheim-server #16 0x007ffff90f6f87 in string:LastIndexOfAny (char[])
Apr 3 18:35:27 supervisord: valheim-server #17 0x007ffff90f6e1b in System.IO.Path:GetDirectoryName (string)
Apr 3 18:35:27 supervisord: valheim-server #18 0x007ffff90f0dbf in System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,bool,System.IO.FileOptions)
Apr 3 18:35:27 supervisord: valheim-server #19 0x007ffff90f0c2f in System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions)
Apr 3 18:35:27 supervisord: valheim-server #20 0x007ffff90f0ba7 in (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions)
Apr 3 18:35:27 supervisord: valheim-server #21 0x007ffff90ef8db in System.IO.PathInternal:GetIsCaseSensitive ()
Apr 3 18:35:27 supervisord: valheim-server #22 0x007ffff90ef7eb in System.IO.PathInternal:.cctor ()
Apr 3 18:35:27 supervisord: valheim-server #23 0x007ffff90e7efd in (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
Apr 3 18:35:27 supervisord: valheim-server #24 0x007ffff90ec937 in System.IO.File:Exists (string)
Apr 3 18:35:27 supervisord: valheim-server #25 0x007ffff90ec6ef in System.TimeZoneInfo:TryLoadTzFile (string,byte[]&,string&)
Apr 3 18:35:27 supervisord: valheim-server #26 0x007ffff90ea40b in System.TimeZoneInfo:TryGetLocalTzFile (byte[]&,string&)
Apr 3 18:35:27 supervisord: valheim-server #27 0x007ffff90ea247 in System.TimeZoneInfo:GetLocalTimeZoneFromTzFile ()
Apr 3 18:35:27 supervisord: valheim-server #28 0x007ffff90ea1fb in System.TimeZoneInfo:GetLocalTimeZone (System.TimeZoneInfo/CachedData)
Apr 3 18:35:27 supervisord: valheim-server #29 0x007ffff90ea0e3 in System.TimeZoneInfo/CachedData:CreateLocal ()
Apr 3 18:35:27 supervisord: valheim-server #30 0x007ffff90ea023 in System.TimeZoneInfo/CachedData:get_Local ()
Apr 3 18:35:27 supervisord: valheim-server #31 0x007ffff90e9feb in System.TimeZoneInfo:get_Local ()
Apr 3 18:35:27 supervisord: valheim-server #32 0x007ffff90e9117 in System.TimeZoneInfo:GetDateTimeNowUtcOffsetFromUtc (System.DateTime,bool&)
Apr 3 18:35:27 supervisord: valheim-server #33 0x007ffff90e877b in System.DateTime:get_Now ()
Apr 3 18:35:27 supervisord: valheim-server #34 0x007ffff90e82b3 in BepInEx.Preloader.Entrypoint:Main ()
Apr 3 18:35:27 supervisord: valheim-server #35 0x007ffff90e86e0 in (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
Apr 3 18:35:27 supervisord: valheim-server #36 0x007ffff9673328 in mono_get_runtime_build_info
Apr 3 18:35:27 supervisord: valheim-server #37 0x007ffff98123fe in mono_runtime_invoke
Apr 3 18:35:27 supervisord: valheim-server #38 0x007ffff980ea99 in mono_runtime_class_init
Apr 3 18:35:27 supervisord: valheim-server #39 0x007ffff966bddf in _init
Apr 3 18:35:27 supervisord: valheim-server #40 0x007ffff966f688 in mono_jit_set_domain
Apr 3 18:35:27 supervisord: valheim-server #41 0x007ffff96ed603 in mono_install_ftnptr_eh_callback
Apr 3 18:35:27 supervisord: valheim-server #42 0x007ffff96ed06c in mono_install_ftnptr_eh_callback
Apr 3 18:35:27 supervisord: valheim-server #43 0x007ffff9600396 in (Unknown)
Apr 3 18:35:27 supervisord: valheim-server #44 0x007ffff9673328 in mono_get_runtime_build_info
Apr 3 18:35:27 supervisord: valheim-server #45 0x007ffff98123fe in mono_runtime_invoke
Apr 3 18:35:27 supervisord: valheim-server #46 0x007ffff9812373 in mono_runtime_invoke
Apr 3 18:35:27 supervisord: valheim-server #47 0x007fffff7cb00c in jit_init_hook
Apr 3 18:35:27 supervisord: valheim-server #48 0x007ffffe680a30 in (Unknown)
Apr 3 18:35:27 supervisord: valheim-server #49 0x007ffffe697cdd in (Unknown)
Apr 3 18:35:27 supervisord: valheim-server #50 0x007ffffe704744 in (Unknown)
Apr 3 18:35:27 supervisord: valheim-server #51 0x007ffffe704fca in PlayerMain(int, char**)
Apr 3 18:35:27 supervisord: valheim-server #52 0x007ffffd63ed0a in PlayerMain(int, char**)
Apr 3 18:35:27 supervisord: valheim-server #53 0x00555555555029 in __libc_start_main
2024-04-03 18:35:27,792 INFO reaped unknown pid 499 (exit status 0)
Apr 3 18:35:27 supervisord: valheim-server /usr/local/bin/valheim-server: line 123: 495 Aborted LD_PRELOAD=$SERVER_LD_PRELOAD "$valheim_server" -nographics -batchmode -name "$SERVER_NAME" -port "$SERVER_PORT" -world "$WORLD_NAME" -public "$SERVER_PUBLIC" "${password_args[@]}" $SERVER_ARGS > >(filter) 2>&1
Apr 3 18:35:27 supervisord: valheim-server DEBUG - [490] - Valheim server with PID 495 stopped
Apr 3 18:35:27 supervisord: valheim-server INFO - Releasing PID file /var/run/valheim/valheim-server.pid
Apr 3 18:35:27 supervisord: valheim-server INFO - Shutdown complete
2024-04-03 18:35:28,810 INFO exited: valheim-server (exit status 0; not expected)
2024-04-03 18:35:28,811 INFO gave up: valheim-server entered FATAL state, too many start retries too quickly
2024-04-03 18:35:31,827 INFO reaped unknown pid 498 (exit status 0)
2024-04-03 18:35:32,831 INFO reaped unknown pid 507 (exit status 0)
I found this report that confirms it should work. TL;DR: instead of attempting to run it with arm64, they create a VM with x86 emulation and run the image there.
@ivan-danilov wow, that's awesome. I didn't come across that in my research. I've tried Azure VM and Azure Containers but both were too expensive in the long run.
Following along with those instructions and modifying with what I've learned from Docker in the past week through this project I was able to get the server up and running within an hour w/ an existing world.
Closing this out and hope Ivan's link helps someone else in the future!