ryansheehan/terraria

Cannot Run vanilla-1.4.2.3 (ARMv7)

ronelm2000 opened this issue · 12 comments

Tried command as follows:
image

Full commands used are as follows:

pi@raspberrypi:~ $ sudo docker run -it -p 7777:7777 --rm -v $HOME/terraria/world:/root/.local/share/Terraria/Worlds ryshe/terraria:latest

Bootstrap:
world_file_name=
configpath=/root/.local/share/Terraria/Worlds
logpath=/tshock/logs

Copying plugins...
cp: cannot stat '/plugins/*': No such file or directory
No world file specified in environment WORLD_FILENAME.
Running server setup...
Error Logging Enabled.
TerrariaAPI Version: 2.1.0.0 (Protocol v1.4.2.2 (237), OTAPI 1.4.2.2)
[TShock] Info Config path has been set to /root/.local/share/Terraria/Worlds
[TShock] Info Log path has been set to /tshock/logs
TShock was improperly shut down. Please use the exit command in the future to prevent this.
TShock 4.5.2.0 (April Lyrids edition) now running.
AutoSave Enabled
Backups Disabled
Welcome to TShock for Terraria!
TShock comes with no warranty & is free software.
You can modify & distribute it under the terms of the GNU GPLv3.
[Server API] Info Plugin TShock v4.5.2.0 (by The TShock Team) initiated.
Terraria Server v1.4.2.2

n		New World
d <number>	Delete World

Choose World: pi@raspberrypi:~ $ 
pi@raspberrypi:~ $ sudo docker run -it -p 7777:7777 --rm -v $HOME/terraria/world:/root/.local/share/Terraria/Worlds ryshe/terraria:vanilla-1.4.2.3
Unable to find image 'ryshe/terraria:vanilla-1.4.2.3' locally
vanilla-1.4.2.3: Pulling from ryshe/terraria
cd38ad753522: Already exists 
678b77b1123e: Already exists 
35ee2966b2ed: Already exists 
eeb30a8d972e: Pull complete 
Digest: sha256:06f0d64d9ebe6c8fa74d9dbb91290ccc5bde4ea05c14bc056e3a9736d19c6494
Status: Downloaded newer image for ryshe/terraria:vanilla-1.4.2.3
/lib64/ld-linux-x86-64.so.2: No such file or directory

I wonder if this has to do with it trying to link a x86-64 binary on the pi, isn't the pi arm-based?

Correct, that's why it's weird.
And yes, I'm using Raspberry Pi 4 Model B to run this, so this should be using ARMv7 digest.

image
Unfortunately it still does the same thing; I still don't get why does the ARMv7 digest pulls out x86 resources. I guess the workaround for now would be to wait for the tshock for 1.4.2.3

I wonder if a different version of mono might fix this issue on ARM. Have you tried rebuilding the container against mono:6.12.0.107?

Unforunately, it still didn't work. My theory is that you'd need to manually add missing ELF libaries from TerrariaServer (see https://blog.oddbit.com/post/2015-02-05-creating-minimal-docker-images/ for more details.)

I'll see what I can do, but for now, it'll require me to manually download and perform ldd from TerrariaServer, I think.

Update: I got it working by directly using mono. (Terraria wiki said to use mono directly for non-x86-based linux distros.)

I'm not sure how to implement this on your dockerfiles, but this is the change I did (should make ARMv7 and ARMv8 working, at least), tho I think that x64/86 builds should still use the old dockerfile.

PS: When I tried updating mono, an error occurs trying to run it, so deleting System.dll and other mono related libraries may be required. See https://terraria.fandom.com/wiki/Server#Troubleshooting

FROM alpine:3.11.6 AS base

RUN apk add --update-cache \
    unzip

ENV DL_LINK=https://terraria.org/system/dedicated_servers/archives/000/000/046/original/terraria-server-1423.zip
ENV DL_VERSION=1423
ENV DL_FILE=terraria-server-1423.zip

ADD $DL_LINK /$DL_FILE

RUN unzip /$DL_FILE -d /terraria && \
    mkdir /terraria-server && \
    mv /terraria/$DL_VERSION/Linux/* /terraria-server && \
    chmod +x /terraria-server/TerrariaServer && \
    chmod +x /terraria-server/TerrariaServer.bin.x86_64

FROM mono:6.8.0.96-slim
LABEL maintainer="Ryan Sheehan <rsheehan@gmail.com>"

EXPOSE 7777

VOLUME ["/root/.local/share/Terraria/Worlds", "/config"]

COPY --from=base /terraria-server/ /terraria-server/

ENTRYPOINT ["mono", "/terraria-server/TerrariaServer.exe"]

I think I've run into a similar issue trying to run the mobile server. I'm using Portainer on a Raspberry Pi 3 and launched with a simple docker-compose.yml file pulling the mobile-latest tag. However, the server doesn't start and in the logs I see the following:

a-server/TerrariaServer: line 42: ./TerrariaServer.bin.x86: cannot execute binary file: Exec format error

It appears it is also trying to run an x86 binary on this arm32 system. I'm very new to Docker and don't understand most of what is in the posts above, but was hoping this would be a similar fix for the mobile server build.

That did it! Thank you so much @ryansheehan for your time and effort. I've never played Terraria, but my kids are super excited that this works. I was able to clone your repository and modify the Dockerfile and learned how to build the docker image, but still could not get it to run (I believe because of the dll file issues in mono that @ronelm2000 mentioned above). So glad you fixed it.

ARMv7 also works with the new tag/digest. I can't test locally for ARMv8 (because I don't have it), but it should also work there.