Bedrock server fails to bind (ip4 ipv6 port reported as 0)
Bedrock server aborts at start:
~ $ ./bedrock_server NO LOG FILE! - setting up server logging... [2019-04-06 19:27:55 INFO] Starting Server [2019-04-06 19:27:55 INFO] Version 1.10.0.7 [2019-04-06 19:27:55 INFO] Level Name: Bedrock level [2019-04-06 19:27:55 INFO] Game mode: 0 Survival [2019-04-06 19:27:55 INFO] Difficulty: 1 EASY [2019-04-06 19:27:59 INFO] IPv4 supported, port: 0 [2019-04-06 19:27:59 INFO] IPv6 supported, port: 0 [2019-04-06 19:27:59 ERROR] Network port occupied, can't start server. Quit correctly
Snippet of the strace below. ipv6 was disabled on this system, other daemons including OpenVPN bind to UDP ports without issue
bind(7<UDP:[22049]>, {sa_family=AF_INET, sin_port=htons(19132), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
setsockopt(7<UDP:[22049]>, SOL_SOCKET, SO_RCVBUF, [262144], 4) = 0
setsockopt(7<UDP:[22049]>, SOL_SOCKET, SO_LINGER, {l_onoff=0, l_linger=0}, 8) = 0
setsockopt(7<UDP:[22049]>, SOL_SOCKET, SO_SNDBUF, [16384], 4) = 0
setsockopt(7<UDP:[22049]>, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0
getsockname(7<UDP:[22049]>, {sa_family=AF_INET, sin_port=htons(19132), sin_addr=inet_addr("0.0.0.0")}, [128->16]) = 0
setsockopt(7<UDP:[22049]>, SOL_IP, IP_HDRINCL, [0], 4) = -1 ENOPROTOOPT (Protocol not available)
getsockname(7<UDP:[22049]>, {sa_family=AF_INET, sin_port=htons(19132), sin_addr=inet_addr("0.0.0.0")}, [128->16]) = 0
sendto(7<UDP:[22049]>, "\0\0\0\0", 4, 0, {sa_family=AF_INET, sin_port=htons(19132), sin_addr=inet_addr("127.0.0.1")}, 16) = 4
socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP) = -1 EAFNOSUPPORT (Address family not supported by protocol)
close(7<UDP:[22049]>) = 0
write(1</dev/pts/0<char 136:0>>, "[2019-04-06 19:23:51 INFO] IPv4 "..., 51[2019-04-06 19:23:51 INFO] IPv4 supported, port: 0
) = 51
write(3</home/minecraft/Debug_Log.txt>, "[2019-04-06 19:23:51 INFO] IPv4 "..., 51) = 51
write(1</dev/pts/0<char 136:0>>, "[2019-04-06 19:23:51 INFO] IPv6 "..., 51[2019-04-06 19:23:51 INFO] IPv6 supported, port: 0
) = 51
write(3</home/minecraft/Debug_Log.txt>, "[2019-04-06 19:23:51 INFO] IPv6 "..., 51) = 51
fcntl(4</home/minecraft/worlds/Bedrock level/db/LOCK>, F_SETLK, {l_type=F_UNLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
close(4</home/minecraft/worlds/Bedrock level/db/LOCK>) = 0
close(6</home/minecraft/worlds/Bedrock level/db/MANIFEST-000033>) = 0
close(5</home/minecraft/worlds/Bedrock level/db/000035.log>) = 0
munmap(0x7f4830a67000, 190) = 0
munmap(0x7f4830a3b000, 190) = 0
write(1</dev/pts/0<char 136:0>>, "[2019-04-06 19:23:51 ERROR] Netw"..., 71[2019-04-06 19:23:51 ERROR] Network port occupied, can't start server.
) = 71
write(3</home/minecraft/Debug_Log.txt>, "[2019-04-06 19:23:51 ERROR] Netw"..., 71) = 71
munmap(0x7f482dc28000, 299008) = 0
Environment
Clear Linux
~ $ java -version
openjdk version "1.8.0-internal"
OpenJDK Runtime Environment (build 1.8.0-internal-_2019_03_08_14_35-b00)
OpenJDK 64-Bit Server VM (build 25.71-b00, mixed mode)
Bedrock Server '1.10.0.7'
Comments15
History2
Deleted comment:
I agree and this is one of the reasons why i don't like the New Windows 10 edition even the pocket and Xbox edition.
Resolution: Unresolved → Invalid
Im having this same problem on windows and cant seem to find an answer, if this could get more attention that would be great.
Possibly some help: https://www.minecraftforum.net/forums/support/minecraft-bedrock-support/2957523-bedrock-server-not-launching-when-run-as-a-service
The link you cite doesn’t provide a resolution.
I have this issue when trying to use worlds that are created from downloaded world templates. If I use a vanilla generated world, it works fine.
This issue occurs for me with a brand new installation. I presume this would be a vanilla world.
I was seeing this error in Ubuntu 18.04.2 when using a desktop shortcut file to run bedrock server 1.11.2.1. Interestingly, exactly the same shortcut settings worked (except for the path) for the 1.10.0.7 server.
Without changing a thing, I was able to run the 1.11.2.1 server by just launching it manually, i.e., going in the terminal to the folder and running the start command 'LD_LIBRARY_PATH=. ./bedrock_server'.
Same thing here.
Tried v1.11.2.1 on a Ubuntu 18.04.02 VM within Windows 10 and it works fine.
When using docker on Windows with a Ubuntu 18.04.02, I'm getting "Network port occupied, can't start server."
I had this problem because I had the port for both ipv4 and ipv6 set to the same port. I changed the ports to be different and then it would work. This is on Ubuntu.
As entertaining as some of these suggestions are, I just strace'd the start up again, this seems to be the relevant lines:
socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) = 7<UDP:[33556]>bind(7<UDP:[33556]>, {sa_family=AF_INET, sin_port=htons(19134), sin_addr=inet_addr("0.0.0.0")}, 16) = 0setsockopt(7<UDP:[33556]>, SOL_SOCKET, SO_RCVBUF, [262144], 4) = 0setsockopt(7<UDP:[33556]>, SOL_SOCKET, SO_LINGER, {l_onoff=0, l_linger=0}, 8) = 0setsockopt(7<UDP:[33556]>, SOL_SOCKET, SO_SNDBUF, [16384], 4) = 0setsockopt(7<UDP:[33556]>, SOL_SOCKET, SO_BROADCAST, [1], 4) = 0getsockname(7<UDP:[33556]>, {sa_family=AF_INET, sin_port=htons(19134), sin_addr=inet_addr("0.0.0.0")}, [128->16]) = 0setsockopt(7<UDP:[33556]>, SOL_IP, IP_HDRINCL, [0], 4) = -1 ENOPROTOOPT (Protocol not available)getsockname(7<UDP:[33556]>, {sa_family=AF_INET, sin_port=htons(19134), sin_addr=inet_addr("0.0.0.0")}, [128->16]) = 0sendto(7<UDP:[33556]>, "\0\0\0\0", 4, 0, {sa_family=AF_INET, sin_port=htons(19134), sin_addr=inet_addr("127.0.0.1")}, 16) = 4socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP) = -1 EAFNOSUPPORT (Address family not supported by protocol)close(7<UDP:[33556]>) = 0
If you enable the socket option "IPV6_V6ONLY" (see https://serverfault.com/a/408670) ipv4 and ipv6 can use the same ports on linux and the error is gone.
I'm having the same issue as well. The server says the port is occupied on startup, even though the lsof command does not show anything occupying the port
I had this same error with v1.11.4. In my case, the error was not related to the message displayed. I had specified the name of a world in the server.properties file (level-name=My World). When I removed the level-name line from my config, the server ran without problem.
I'm running this in a docker image and on further inspection, I noticed that the folder names mapped through from my Windows machine had extra single quotes surrounding the folder names. I have to investigate further as to why this is happening, but is probably related to Docker itself.I am having the same issue with 1.12.0.28 on Ubuntu 18.04. Removing the level-name from the config file does not work for me, and I am running from the terminal. My ipv4 and ipv6 ports are different.
Probably had the same problem with 1.12.1.1 on debian 10 VM within Windows 10, but solved it by using sudo command.
I had this issue and it was caused by the server not being shut down properly. My solution was to find the process ID and kill it. In linux this should look like:
Command:
Output:
1996 1996 1810 pts/1 00:00:08 bedrock_server
This is your bedrock server process. So to stop this you just kill the process using the PID, which in my case is 1996.
Then restart your server again and it should work just fine