Mojira Archive
BDS-1264

Unable to launch - Network port occupied, can't start server.

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.

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

Linked Issues

Comments10

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.

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!

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.

@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

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.

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.

This issue occurs on my install of Ubuntu 18.04.4 LTS on GCP.

I am using the service Multicraft to manage my dedicated bedrock alpha server, and with my server.properties file settings:

server-port=25565
server-portv6=25566

I get the error:

20.07 17:13:25 [Server] INFO Starting Server
20.07 17:13:25 [Server] INFO Version 1.16.1.2
20.07 17:13:25 [Server] INFO Session ID d765949b-8c42-4054-bbf9-08b57f461647
20.07 17:13:25 [Server] INFO Level Name: world
20.07 17:13:25 [Server] ERROR Error opening whitelist file: whitelist.json
20.07 17:13:25 [Server] INFO Game mode: 0 Survival
20.07 17:13:25 [Server] INFO Difficulty: 1 EASY
20.07 17:13:25 [Server] INFO opening worlds/world/db
20.07 17:13:28 [Server] INFO IPv4 supported, port: 0
20.07 17:13:28 [Server] INFO IPv6 supported, port: 0
20.07 17:13:28 [Server] ERROR Network port occupied, can't start server.

I have changed the sysctl rule to equal one, and have also tried to give my ipv6 port a wild number and neither methods worked. When I run:

ps -ejH | grep bedrock

No current processes are listed, and if I run lsof, no processes are using the ports above. I am not sure why it is trying to default them to 0 even though I have them set in system properties.

I also tried Zizzy's last method as well to no avail.

 

Edit: I fixed this issue, and it was related to using Multicraft to manage the bedrock server. In the bedrock.jar.conf file that is necessary to use the bedrock alpha software with multicraft, you must fill the relevant fields of info in so that Multicraft does not overwrite Minecraft's server.properties file with empty default values.

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

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.

@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!

 

 

History10

IonicEcko

Added labels: awaiting-system-requirements

Removed labels:

[Bot] Arisa

Added Confirmation Status: Unconfirmed

IonicEcko
[Bot] Arisa
IonicEcko
IonicEcko

Added labels: awaiting-response

Removed labels: awaiting-system-requirements

IonicEcko
[Mojang] Mega_Spud (Jay Wells)
[Mojang] Mega_Spud (Jay Wells)

Resolution: UnresolvedIncomplete

Incomplete
Paul Bramhall
1
4
Unconfirmed
awaiting-response
1.9.0.15