Minecraft balena server not working

Hi,
I’ve recently used this tutorial: https://www.balena.io/blog/how-to-create-a-minecraft-server-for-the-pi-4-with-balena/ to create a minecraft server on my raspberry pi 4 with 2gb of ram, however i can’t connect to it and get the below error:

this is my output from the balena dashboard that i think is related to the problem

[04:10:59 INFO]: Starting GS4 status listener
[04:10:59 WARN]: Unable to determine local host IP, please set server-ip in server.properties
13.10.20 12:10:59 (+0800)  mc-server  java.net.UnknownHostException: balenaminecraftserver: balenaminecraftserver: No address associated with hostname
13.10.20 12:10:59 (+0800)  mc-server    at java.net.InetAddress.getLocalHost(InetAddress.java:1642) ~[?:?]
13.10.20 12:10:59 (+0800)  mc-server    at net.minecraft.server.v1_16_R2.RemoteStatusListener.<init>(SourceFile:67) ~[patched_1.16.3.jar:git-Paper-220]
13.10.20 12:10:59 (+0800)  mc-server    at net.minecraft.server.v1_16_R2.RemoteStatusListener.a(SourceFile:89) ~[patched_1.16.3.jar:git-Paper-220]
13.10.20 12:10:59 (+0800)  mc-server    at net.minecraft.server.v1_16_R2.DedicatedServer.init(DedicatedServer.java:248) ~[patched_1.16.3.jar:git-Paper-220]
13.10.20 12:10:59 (+0800)  mc-server    at net.minecraft.server.v1_16_R2.MinecraftServer.w(MinecraftServer.java:939) ~[patched_1.16.3.jar:git-Paper-220]
13.10.20 12:10:59 (+0800)  mc-server    at net.minecraft.server.v1_16_R2.MinecraftServer.lambda$a$0(MinecraftServer.java:177) ~[patched_1.16.3.jar:git-Paper-220]
13.10.20 12:10:59 (+0800)  mc-server    at java.lang.Thread.run(Thread.java:834) [?:?]
13.10.20 12:10:59 (+0800)  mc-server  Caused by: java.net.UnknownHostException: balenaminecraftserver: No address associated with hostname
13.10.20 12:10:59 (+0800)  mc-server    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[?:?]
13.10.20 12:10:59 (+0800)  mc-server    at java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:929) ~[?:?]
13.10.20 12:10:59 (+0800)  mc-server    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1515) ~[?:?]
13.10.20 12:10:59 (+0800)  mc-server    at java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848) ~[?:?]
13.10.20 12:10:59 (+0800)  mc-server    at java.net.InetAddress.getAllByName0(InetAddress.java:1505) ~[?:?]
13.10.20 12:10:59 (+0800)  mc-server    at java.net.InetAddress.getLocalHost(InetAddress.java:1637) ~[?:?]
13.10.20 12:10:59 (+0800)  mc-server    ... 6 more

Hi

Are you setting this up for playing over the local network?

Can you tell the detailed steps that you did to get here? I am guessing you flashed the pi, the device came online, and this is what you saw - is that right? Did you run any other commands?

I’m trying to set it up for the local network - and have been messing around with it for about an hour trying to get it to work - i managed to fix the corrupt jarfile issue and get it to not come up with the error ‘could not connect’ but got stuck on this. I haven’t been able to access the server at any point throughout my debugging if that helps

Hi,

I have tried setting up the server and I can confirm that I am able to see the message you shared but it looks like a warning to me, below that I can see the server starting successfully:

[12:44:11 INFO]: Starting GS4 status listener
[12:44:11 WARN]: Unable to determine local host IP, please set server-ip in server.properties
13.10.20 14:44:11 (+0200)  mc-server  java.net.UnknownHostException: balenaminecraftserver: balenaminecraftserver: No address associated with hostname
13.10.20 14:44:11 (+0200)  mc-server    at java.net.InetAddress.getLocalHost(InetAddress.java:1642) ~[?:?]
13.10.20 14:44:11 (+0200)  mc-server    at net.minecraft.server.v1_16_R2.RemoteStatusListener.<init>(SourceFile:67) ~[patched_1.16.3.jar:git-Paper-228]
13.10.20 14:44:11 (+0200)  mc-server    at net.minecraft.server.v1_16_R2.RemoteStatusListener.a(SourceFile:89) ~[patched_1.16.3.jar:git-Paper-228]
13.10.20 14:44:11 (+0200)  mc-server    at net.minecraft.server.v1_16_R2.DedicatedServer.init(DedicatedServer.java:248) ~[patched_1.16.3.jar:git-Paper-228]
13.10.20 14:44:11 (+0200)  mc-server    at net.minecraft.server.v1_16_R2.MinecraftServer.w(MinecraftServer.java:939) ~[patched_1.16.3.jar:git-Paper-228]
13.10.20 14:44:11 (+0200)  mc-server    at net.minecraft.server.v1_16_R2.MinecraftServer.lambda$a$0(MinecraftServer.java:177) ~[patched_1.16.3.jar:git-Paper-228]
13.10.20 14:44:11 (+0200)  mc-server    at java.lang.Thread.run(Thread.java:834) [?:?]
13.10.20 14:44:11 (+0200)  mc-server  Caused by: java.net.UnknownHostException: balenaminecraftserver: No address associated with hostname
13.10.20 14:44:11 (+0200)  mc-server    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[?:?]
13.10.20 14:44:11 (+0200)  mc-server    at java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:929) ~[?:?]
13.10.20 14:44:11 (+0200)  mc-server    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1515) ~[?:?]
13.10.20 14:44:11 (+0200)  mc-server    at java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:848) ~[?:?]
13.10.20 14:44:11 (+0200)  mc-server    at java.net.InetAddress.getAllByName0(InetAddress.java:1505) ~[?:?]
13.10.20 14:44:11 (+0200)  mc-server    at java.net.InetAddress.getLocalHost(InetAddress.java:1637) ~[?:?]
13.10.20 14:44:11 (+0200)  mc-server    ... 6 more
[12:44:11 INFO]: Thread Query Listener started
[12:44:11 INFO]: Starting remote control listener
[12:44:11 INFO]: Query running on 0.0.0.0:25565
[12:44:11 INFO]: Thread RCON Listener started
[12:44:11 INFO]: RCON running on 0.0.0.0:25575
[12:44:11 INFO]: Running delayed init tasks
[12:44:11 INFO]: Done (17.407s)! For help, type "help"

Can you check whether you can see that as well? Or share the whole log from the mc-server service if you do not mind.
Also, are you trying to connect using the balenaminecraftserver hostname to connect to the server? Could you try using the IP address to connect and see whether that works?

Thanks

It seems to have started working when i turned on my pi this morning - i could successfully connect using the address balenaminecraftserver, which is weird because it wouldn’t work before. Thanks for your help and I’m sorry for any inconvenience caused.

I came here for a different balena project that was failing due to the same exception. I eventually found the solution and I thought I’d post it here in case anyone else needs it.

To fix this error, you need to add an entry to /etc/hosts pointing the balena device name to 127.0.0.1.
See here for more info: java - InetAddress.getLocalHost() throws UnknownHostException - Stack Overflow

My project was running some java code over SSH on a balena device. The call the InetAddress.getLocalHost works fine when run directly, but fails over SSH.

Thanks for sharing @daniel-crowe!