[BDS-1264] Unable to launch - Network port occupied, can't start server. Created: 08/Aug/19  Updated: 21/Jun/21  Resolved: 29/Jan/21

Status: Resolved
Project: Bedrock Dedicated Server
Affects Version/s: 1.9.0.15
Fix Version/s: None

Type: Bug
Reporter: Paul Bramhall Assignee: Unassigned
Resolution: Incomplete Votes: 1
Labels: awaiting-response
Environment:

Debian 10 (Buster)

Linux 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64 GNU/Linux

openjdk 11.0.4 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Debian-1deb10u1)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Debian-1deb10u1, mixed mode, sharing)

BDS Version 1.12.0.28


Issue Links:
Duplicate
is duplicated by BDS-9198 Bug - Bedrock server uses port 0 inst... Resolved
Confirmation Status: Unconfirmed

 Description   

Upon trying to launched bedrock server, it appears that it is ignoring both options within server.properties:

 

server-port=19132
server-portv6=19133

 

The following output is observed:

# LD_LIBRARY_PATH=. ./bedrock_server
NO LOG FILE! - setting up server logging...
[2019-08-08 13:58:15 INFO] Starting Server
[2019-08-08 13:58:15 INFO] Version 1.12.0.28
[2019-08-08 13:58:15 INFO] Session ID e0d9fbf4-a584-4d6e-8df1-03e76330598f
[2019-08-08 13:58:15 INFO] Level Name: Bedrock level
[2019-08-08 13:58:15 INFO] Game mode: 0 Survival
[2019-08-08 13:58:15 INFO] Difficulty: 1 EASY
[2019-08-08 13:58:16 INFO] IPv4 supported, port: 0
[2019-08-08 13:58:16 INFO] IPv6 supported, port: 0
[2019-08-08 13:58:16 ERROR] Network port occupied, can't start server.
Quit correctly

It appears that BDS is trying to bind both IPv6 and IPv4 to port 0.

Also, it is incorrectly identifying IPv6 as being supported, as this is disabled on the host via grub upon launch:

default/grub:10:GRUB_CMDLINE_LINUX="ipv6.disable=1" 

This is with a fresh copy of BDS, with default config values present:

server-name=Dedicated Server
gamemode=survival
difficulty=easy
allow-cheats=false
max-players=10
online-mode=true
white-list=false
server-port=19132
server-portv6=19133
view-distance=10
tick-distance=4
player-idle-timeout=30
max-threads=8
level-name=Bedrock level
level-seed=
default-player-permission-level=member
texturepack-required=false
content-log-file-enabled=false

No other processes or services are running on the ports set within the configuration.



 Comments   
Comment by Req001 [ 21/Jun/21 ]

@Zizzy zizzy
“Failed successfully”. I laughed so hard that I spelt my coffee, luckily not on the keyboard.

I’ve been running a Bedrock server in Docker for about a year and suddenly started having the port ‘0’ issue. (bds v 1.17.1.01)

After reading this I’ve set-up my server.properties

SERVER_PORT_V6: “disable”

Fails perfectly!

 

 

Comment by Zizzy zizzy [ 02/Mar/21 ]

This is still broken on Ubuntu 18 with Bedrock Server v1.16.201.3.

If IPv6 is disabled completely via GRUB, Bedrock Server crashes during startup. There doesn't appear to be a way to tell it to only use IPv4, even when the entire server has already been configured to do so.

/etc/apt/apt.conf.d/99force-ipv4:
Acquire::ForceIPv4 "true";

/etc/sysctl.conf:
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
net.ipv6.bindv6only=1

/etc/default.grub:
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"
GRUB_CMDLINE_LINUX="ipv6.disable=1"

IPv6 causes nothing but problems on every server I've ever encountered, which is why we always disable it completely. If something odd is going on with networking/DNS/etc., disabling IPv6 and rebooting usually does the trick.

Comment by [Mojang] Mega_Spud (Jay Wells) [ 29/Jan/21 ]

Cleaning up old tickets: This ticket had been set to 'Awaiting Response', but has not received a response from the reporter (~3 months+) so is being closed as Incomplete. If you feel this is still a valid issue then please comment, or create a new ticket following the Issue Guidelines which includes steps to reproduce the problem.

Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

Comment by IonicEcko [ 24/Jun/20 ]

Does this issue happen on a Ubuntu 18+ install?

If so can someone please provide steps to reproduce:

What I expected to happen was...:

When I killed a squid, it should have dropped an ink sac.

What actually happened was...:

Instead, it dropped an apple.

Steps to Reproduce:

  1. Find a squid (though we all know how difficult they are to find when you actually want to find one).
  2. Kill the squid.
  3. Notice that it drops apples instead of ink sacs. How am I supposed to get black dye now?

The original report was for Debian which is not a supported OS for BDS and therefore would not be a valid report unless it can be reproduced on a new Ubuntu install.

Comment by Zizzy zizzy [ 16/Apr/20 ]

Update - the 99999 port hack stopped working randomly.

Now I have to script it so a random, unused lower port is assigned to the server-portv6 line:

 

freeport=$(comm -23 <(seq 1025 19130 | sort) <(ss -Huan | awk '{print $4}' | cut -d':' -f2 | sort -u) | shuf | head -n 1) 

That works fine now. Just make sure to remove the kernel ipv6.disable=1 line if it's active, and then reboot. I found out on a different Ubuntu server that with that kernel option enabled, there is no work-around to this frustrating issue.

Comment by Zizzy zizzy [ 26/Mar/20 ]

@Paul Thanks for that!

Even with ipV6 disabled, if you specify just a random ipV6 port that happens to be in use by anything, the server says "IPv6 supported", then "Network port occupied". Same if you leave it undefined, same if you remove it from server.properties completely.

Even more head-scratching: if you set the port to something completely invalid, it starts up fine. I certainly appreciate that this is unsupported and basically a "gift" from Microsoft to have it available at all, but seriously - who writes this stuff?

"Failed successfully!"

[2020-03-26 23:03:56 INFO] IPv4 supported, port: 19134
[2020-03-26 23:03:56 INFO] IPv6 not supported
[2020-03-26 23:03:56 INFO] IPv4 supported, port: 35122
[2020-03-26 23:03:56 INFO] IPv6 not supported
[2020-03-26 23:03:57 INFO] Server started.
stop
Quit correctly
# grep port server.properties
server-port=19134
server-portv6=99999
Comment by Jeppe Øland [ 15/Mar/20 ]

Just ran into the same.

When disabling with GRUB, it refused to start the server.

After sysctl, it starts.
But as in the log above, it seems really confused about what port to use.

Comment by Lukas Zapletal [ 29/Feb/20 ]

For the record, Minecraft exits with this weird error if it's unable to write to data directories. I unpacked the ZIP file accidentaly by root, executed as minecraft user and the error was the exactly same one. Beware!

Comment by Paul Bramhall [ 08/Aug/19 ]

After some further digging, it appears that BDS doesn't respect using the kernel boot-time option ipv6.disable=1 and relies entirely on ipv6 being disabled via sysctl:

sysctl net.ipv6.conf.all.disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 1

Once ipv6 was disabled via sysctl, BDS would launch successfully:

NO LOG FILE! - setting up server logging...
[2019-08-08 15:04:12 INFO] Starting Server
[2019-08-08 15:04:12 INFO] Version 1.12.0.28
[2019-08-08 15:04:12 INFO] Session ID 41d3e2e9-0e7a-4b0c-bbd4-2554fc0b8b08
[2019-08-08 15:04:12 INFO] Level Name: Bedrock level
[2019-08-08 15:04:12 INFO] Game mode: 0 Survival
[2019-08-08 15:04:12 INFO] Difficulty: 1 EASY
[2019-08-08 15:04:14 INFO] IPv4 supported, port: 19132
[2019-08-08 15:04:14 INFO] IPv6 not supported
[2019-08-08 15:04:14 INFO] IPv4 supported, port: 50531
[2019-08-08 15:04:14 INFO] IPv6 not supported
[2019-08-08 15:04:15 INFO] Server started.
Generated at Sat Jan 11 07:17:11 UTC 2025 using Jira 9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13.