Minecraft Bedrock Edition – Ubuntu Dedicated Server Guide

Minecraft Bedrock Edition Logo
Minecraft: Bedrock Edition Logo

Minecraft Bedrock Edition is the version of Minecraft that powers the iPhone / Android versions (formerly Minecraft Pocket Edition), the Xbox / PlayStation / Nintendo Switch editions and the free Windows 10 Minecraft edition.

Mojang has released a dedicated server which is considered to be in alpha testing.  I have found it to be very stable and able to run on a wide variety of hardware.

This script and guide are written to help you get a robust Minecraft Bedrock dedicated server up and running in only a few minutes!

This is the standalone version. The easiest and most problem-free way to run this is using Docker (installed as simply as sudo apt install docker.io): Legendary Minecraft Bedrock Container

I’ve also released a way for Java and Bedrock players to play on the same server using Geyser: Minecraft Java + Bedrock Server Together – Geyser + Floodgate

It’s now possible to convert your worlds between Bedrock and Java versions. Check out my guide on Chunker here for more information.

Features

  • Sets up the official Minecraft Bedrock Server (currently in alpha testing)
  • Fully operational Minecraft Bedrock edition server in a couple of minutes
  • Ubuntu / Debian distributions supported
  • Sets up Minecraft as a system service with option to autostart at boot
  • Automatic backups when server restarts
  • Supports multiple instances — you can run multiple Bedrock servers on the same system
  • Updates automatically to the latest or user-defined version when server is started
  • Easy control of server with start.sh, stop.sh and restart.sh scripts
  • Adds logging with timestamps to “logs” directory
  • Optional scheduled daily restart of server using cron

Requirements

  • A computer with a 64 bit processor (if you are trying to use ARM read my article on the limitations). 32 bit binaries of the official server are not available so it needs to be 64 bit!
  • 1 GB of RAM or higher
  • The only officially supported platform by Microsoft is Ubuntu 22.04 / 20.04 (current LTS, recommended)
  • Other Linux flavors supported by this script as well as long as they use systemd (for the service). The script assumes apt is installed but there are minimal dependencies so you could install these on another distro (that doesn’t have apt present) and use the script normally.

Recommended Gear

Game Editions

Minecraft: Bedrock Edition is the “Windows 10” version of Minecraft as well as the version of Minecraft on the Xbox / Playstation / Switch. The versions of Minecraft for Android and iOS are also the Bedrock edition.

All of these versions support cross-platform play with each other (but not with the Java edition).

Minecraft Bedrock Digital Code
Minecraft Bedrock Digital Code

This is the PC Minecraft for Windows 10 (Bedrock) edition of Minecraft. It is able to play cross-platform with other players on Android / iOS / Playstation / Xbox / Switch. Available as a code that is instantly activated to give you permanent access to the game!

Links: Amazon.com*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*

Minecraft Bedrock Playstation
Minecraft Bedrock Playstation

The Sony PlayStation version of Minecraft: Bedrock edition.

Links: Amazon.com*, Amazon.ca*, Amazon.com.au*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*, Amazon.nl*, Amazon.se*, Amazon.sg*

Minecraft Bedrock Nintendo Switch
Minecraft Bedrock Nintendo Switch

This is the Nintendo Switch version of Minecraft: Bedrock edition.

Links: Amazon.com*, Amazon.ca*, Amazon.com.au*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.se*, Amazon.sg*

Minecraft Bedrock Xbox One
Minecraft Bedrock Xbox One

This is the Microsoft Xbox version of Minecraft: Bedrock edition.

Links: Amazon.com*, Amazon.ca*, Amazon.com.au*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*, Amazon.nl*, Amazon.sg*

Recommended Storage (Solid State Drive)

I strongly recommend a Solid State drive (SSD) for your server. This is because Minecraft is constantly reading/storing chunks to the disk which makes I/O performance very important.

These are much cheaper than they used to be. Here’s a decent 120 GB one (higher capacity options are available) at a very low price:

Kingston A400 SSD
Kingston A400 2.5″ SATA SSD

The Kingston A400 is reliable, widely available around the world, has low power requirements and performs very well. It’s also very affordable. This drive has been benchmarked over 1000 times at Pi Benchmarks and is the #1 most popular SSD among the community!

Links: AliExpress*, Amazon.com*, Amazon.ca*, Amazon.com.au*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.se*, Amazon.sg*

If you have a M.2 NVME slot in your motherboard you can go with a high end drive. This will give your server maximum performance even if a large number of players are running around on the server changing blocks and triggering disk writes.

This is the one I have in my machine. These range from 250 GB to 2 TB depending on how big your server might grow:

The Samsung 980 Pro (NVMe) is a professional grade SSD and one of the fastest in the world. The Samsung NVMe drives have been at the top of this category for a long time and are well trusted for both their performance and reliability / long life.

Links: AliExpress*, Amazon.com*, Amazon.ca*, Amazon.com.au*, Amazon.co.jp*, Amazon.co.uk*, Amazon.de*, Amazon.es*, Amazon.fr*, Amazon.it*, Amazon.nl*, Amazon.pl*, Amazon.se*, Amazon.sg*

Computer / CPU / Memory

Almost any PC made in the last few years will be a x86_64 bit computer. If you have an older computer around that isn’t being used then it will most likely have the right CPU and amount of memory (as well as fast storage) to run a basic server.

Throwing a SSD in one of these older computers will provide an excellent server experience for small and larger player counts.

The speed of your storage will make the largest difference. Older HDDs are going to have significantly slower performance than any modern SSD even with all other hardware equal. This is because the Minecraft server is constantly reading/writing chunks of your world as well as updates to it to the disk so this tends to be the bottleneck.

Operating System

I highly recommend using Ubuntu Server to run the Minecraft dedicated server. It is available here.

At the time of writing the current version is Ubuntu Server 20.04. This is a secure and robust operating system and will leave plenty of resources available for the server to run.

The script should run on any Debian based flavor of Linux but since the Minecraft Bedrock server is compiled natively for Ubuntu I recommend sticking with it. If you have a GUI flavor of Ubuntu and a decent PC (>= 2 GB of RAM) the server will work just fine on it.

Note: People have reported in the comments that Ubuntu 16.x is no longer working with the latest official Mojang binaries. Ubuntu 18.04 is the minimum requirement for the latest versions, and 20.04 is recommended!

Installation

Log into your Linux server either using SSH or a mouse and keyboard and paste/type the following command:

curl https://raw.githubusercontent.com/TheRemote/MinecraftBedrockServer/master/SetupMinecraft.sh | bash

The script will setup the Minecraft sever and ask you some questions on how to configure it. I’ll explain here what they mean.

The first question will be the installation path. This is the root installation path for ALL servers you will have. If you add additional servers later you should select the exact same installation path. It should always be left as the default (~).

The only exception is if you have something like a completely dedicated disk for the Minecraft server. In that case you should always use the same root path of /mnt/yourdrive or wherever the path is for every new/additional server you install.

“Start Minecraft server at startup automatically (y/n)?” – This will set the Minecraft service to start automatically when your server boots. This is a great option to set up a Minecraft server that is always available.

“Automatically restart and backup server at 4am daily (y/n)?” – This will add a cron job to the server that reboots the server every day at 4am. This is great because every time the server restarts it backs up the server and updates to the latest version. See the “Scheduled Daily Reboots” section below for information on how to customize the time or remove the reboot.

That is it for the setup script. The server will finish configuring and start!

First Run

The server will start up and start displaying output to the console.

[2019-03-30 20:25:12 INFO] Starting Server
[2019-03-30 20:25:12 INFO] Version 1.10.0.7
[2019-03-30 20:25:12 INFO] Level Name: Bedrock level
[2019-03-30 20:25:12 INFO] Game mode: 0 Survival
[2019-03-30 20:25:12 INFO] Difficulty: 1 EASY
[2019-03-30 20:25:20 INFO] IPv4 supported, port: 19132
[2019-03-30 20:25:20 INFO] IPv6 supported, port: 19133
[2019-03-30 20:25:23 INFO] Server started.

Once you see the “Server started” line you will be able to connect from the client.

To add the server to the client open Minecraft and click “Play”. Then at the top of the screen select the “Servers” tab and click “Add Server”.

This will ask you for a Server Name and Server IP Address. For the name you can put anything and for the server IP address put the address of your Linux server. Leave the port as the default 19132. For more information on how to let people from outside your network on go to the “Port Forwarding” section below.

Now choose the server you just added in the list and connect!

Start, Stop and Restart Server

The server can be started, stopped and restarted two different ways. You can use the provided scripts in the Minecraft folder or you can use systemctl. Here are the commands:

cd ~/minecraftbe
./start.sh
./stop.sh
./restart.sh

-OR-

sudo systemctl start minecraftbe
sudo systemctl stop minecraftbe
sudo systemctl restart minecraftbe

Automatic Backups

The server backs up each time it starts. This helps you recover easily if something goes wrong. This system works best if you configured the server to restart daily since it means you will have a backup every day.

To access these backups type:

cd ~/minecraftbe/backups
ls

When a backup is made the filename will be the date and time the backup was taken. If you need to restore a backup it’s very easy. Substitute the timestamp in my example to the backup you want to roll back to. Type:

cd ~/minecraftbe
./stop.sh
rm -rf worlds
tar -xf backups/2019.02.15.22.06.30.tar.gz
./start.sh

Your world has now been restored! It’s a good idea to download these backups off the server periodically just in case the server’s storage fails.

Installing Resource Packs / RTX Support

For instructions on how to install resource packs (including optional RTX support) view my step by step Minecraft Bedrock Dedicated Server Resource Packs guide here.

Scheduled Daily Reboots

The daily reboots are scheduled using cron. It’s very easy to customize the time your server restarts.

To change the time that the server restarts type: crontab -e

This will open a window that will ask you to select a text editor (I find nano to be the easiest) and will show the cronjobs scheduled on the server. The Minecraft one will look like the following:

0 4 * * * /home/ubuntu/minecraftbe/restart.sh
Crontab's syntax layout
Crontab’s syntax layout

There are 5 fields here. The default restart time is set to reboot at 0 minutes of the 4th hour of the day (4 AM). The other 3 fields are left as * to represent every day of every month. Make any desired changes here and press Ctrl+X to exit nano and update the cronjob.

To remove the daily reboot simply delete the line and save.

Reconfigure / Update Scripts

The scripts can always be reconfigured and updated by downloading the latest SetupMinecraft.sh and running the installer again. It will update all of the scripts in the Minecraft directory and reinstall the startup service for you.

Running SetupMinecraft.sh again will also give you a chance to reconfigure options such as the memory dedicated to the server, daily reboots, starting the server on boot, etc.

This will not overwrite your world or any other data so it is safe to run!

Port Forwarding

If everyone on your server is on the same LAN or WiFi network as you then you don’t need to do this. If you want people to connect from outside your local network then you need to set up port forwarding on your router.

The process for this is different for every router so the best thing to do is just look at your router and find the model # and put that in google with port forwarding for easy instructions on how to do it for your specific router.

You want to forward port 19132. The type of connection is both TCP and UDP. On some routers you need to do both a TCP entry and then a second entry as UDP.

Once you do this people will be able to connect to your Minecraft server through your public IP address. This is different than your local IP which is usually a 192.x.x.x or 10.x.x.x. If you don’t know what that is just go to google and type “what’s my ip” and Google will kindly tell you!

Version Override

You can revert to a previous version with the revert.sh script included in your directory like this:

james@jamesgigabyte-linux:~/minecraftbe/james$ ./revert.sh
Set previous version in version_pin.txt: bedrock-server-1.19.10.20.zip

If you have a specific version you would like to run you can also create version_pin.txt yourself like this:

echo "bedrock-server-1.18.33.02.zip" > version_pin.txt

The version hold can be removed by deleting version_pin.txt. This will allow it to update to the latest version again!

Wired vs. Wireless

Going with an ethernet (wired) connection is going to be faster and more reliable. There’s so much wireless traffic and other interference in the air that running your server on WiFi is not recommended.

Even if it is working great 99% of the time it can ruin your experience very quickly if the WiFi drops for a couple of seconds and you get blown up by a creeper!

All that being said, the server works fine on wireless. The script will work fine as is with a wireless connection.

Benchmarking / Testing Storage

If you’re getting poor performance you may want to run my storage benchmark with:

sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash

PC results won’t show up on the site yet (it’s meant for Raspberry Pi) but it will run on Linux just fine and give you a score. If you search for the model of your drive on Pi Benchmarks you can compare your score with others and make sure the drive is performing correctly!

Troubleshooting Note – Oracle Virtual Machines

A very common problem people have with the Oracle Virtual Machine tutorials out there that typically show you how to use a free VM is that the VM is much more difficult to configure than just about any other product / offering out there.

It is because there are several steps you need to take to open the ports on the Oracle VM. You need to both:

  • Set the ingress ports (TCP/UDP) in the Virtual Cloud Network (VCN) security list
  • *and* set the ingress ports in a Network Security Group assigned to your instance

Both of these settings are typically required before you will be able to connect to your VM instance. This is purely configuration related and has nothing to do with the script or the Minecraft server itself.

I do not recommend this platform due to the configuration difficulty but the people who have gone through the pain of configuring an Oracle VM have had good experiences with it after that point. Just keep in mind it’s going to be a rough ride through the configuration for most people.

Troubleshooting Note – Hyper-V

There is a weird bug in Hyper-V that breaks UDP connections on the Minecraft server. The fix for this is that you have to use a Generation 1 VM with the Legacy LAN network driver.

Conclusion

The Minecraft Bedrock Edition dedicated server runs much better than previous third party servers in the past that were missing critical features. The performance is very good even on low end hardware. It has never been easier to set up a Minecraft Bedrock server.

If you have any feedback or suggestions let me know in the comment section. A lot of the changes and developments in this script and guide are directly from readers.

Have fun!

Other Resources

For a guide on how to set up resource packs check out my Minecraft Bedrock Resource Pack guide

If you’re trying to run this on the Raspberry Pi check out the Raspberry Pi specific guide here

1,529 thoughts on “Minecraft Bedrock Edition – Ubuntu Dedicated Server Guide”

  1. Avatar for Kyk

    Hello. I use Google translator, I apologize if there are errors somewhereHello. I use Google translator, I apologize if there are errors somewhere.
    I ran the script, everything went well, in screen -r also all is well, ports are open. But when I enter the ip and port into Minecraft and try to connect, I get nothing “could not connect to the world” I receive such a message. Minecraft cannot find the server, what should I do?

    1. Avatar for James A. Chambers

      Hey Kyk,

      Often the issue in these cases is on the client side. Minecraft Bedrock uses UDP so if you’re connecting from the “Windows 10” client you should choose “Public” in the firewall type. UDP traffic is a connectionless protocol so it is *always* public. You can also try temporarily disabling the firewall on the client trying to connect.

      The other thing I wanted to mention is that if it fails to connect once you need to restart the client for it to connect successfully again. Otherwise it will continue to fail even if you bring the server back up. I have seen this happen both on PC and Android. Basically if it fails to connect you should completely close the client before trying to connect again.

      It sounds like you covered all your bases well pulling up the console and that the server is running. I think it has to be some client-side firewall configuration or possibly additional network restrictions related to UDP. People have usually been able to resolve these with some fiddling but it’s definitely something we’ve seen before. Hopefully all that helps!

  2. Avatar for Bob

    Hi there,
    Thanks for your guide. Unfortunately I seem to be running into a problem and I can’t figure it out, originally I thought it was similar to Gerry’s but I still can’t figure it out.
    It appears to be running fine, but when I try to telnet to the port I get no response, and I can’t connect.
    My log file looks normal:

    [2021-12-20 07:51:22] NO LOG FILE! - [] setting up server logging...
    [2021-12-20 07:51:22] [2021-12-20 07:51:22:670 INFO] Starting Server
    [2021-12-20 07:51:22] [2021-12-20 07:51:22:670 INFO] Version 1.18.2.03
    [2021-12-20 07:51:22] [2021-12-20 07:51:22:670 INFO] Session ID cb2e6ab3-bc1c-4097-841a-b7f5a4f7f601
    [2021-12-20 07:51:22] [2021-12-20 07:51:22:670 INFO] Level Name: Bedrock level
    [2021-12-20 07:51:22] [2021-12-20 07:51:22:672 INFO] Game mode: 0 Survival
    [2021-12-20 07:51:22] [2021-12-20 07:51:22:672 INFO] Difficulty: 1 EASY
    [2021-12-20 07:51:22] [2021-12-20 07:51:22:707 INFO] opening worlds/Bedrock level/db
    [2021-12-20 07:51:23] [2021-12-20 07:51:23:482 INFO] IPv4 supported, port: 31808
    [2021-12-20 07:51:23] [2021-12-20 07:51:23:482 INFO] IPv6 supported, port: 31809
    [2021-12-20 07:51:23] [2021-12-20 07:51:23:787 INFO] Server started.
    [2021-12-20 07:51:23] [2021-12-20 07:51:23:814 INFO] IPv4 supported, port: 19132
    [2021-12-20 07:51:23] [2021-12-20 07:51:23:814 INFO] IPv6 supported, port: 19133

    However netstat doesn’t show anything on any of those ports:
    sbob@www:~/$ sudo netstat -tnlp | grep :31808

    returns blank, same as all the other ports. But I can see those ports using ss
    sbob@www:~/$ sudo ss -tunlp
    Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
    udp UNCONN 0 0 0.0.0.0:39078 0.0.0.0:* users:(("/usr/sbin/amavi",pid=566434,fd=15))
    udp UNCONN 0 0 0.0.0.0:47431 0.0.0.0:* users:(("/usr/sbin/amavi",pid=566441,fd=15))
    udp UNCONN 0 0 0.0.0.0:39837 0.0.0.0:* users:(("/usr/sbin/amavi",pid=566443,fd=15))
    udp UNCONN 0 0 0.0.0.0:31808 0.0.0.0:* users:(("bedrock_server",pid=686862,fd=8))
    udp UNCONN 0 0 127.0.0.1:8125 0.0.0.0:* users:(("netdata",pid=3596,fd=61))
    udp UNCONN 0 0 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=1043,fd=12))
    udp UNCONN 0 0 0.0.0.0:631 0.0.0.0:* users:(("cups-browsed",pid=665964,fd=7))
    udp UNCONN 0 0 0.0.0.0:58540 0.0.0.0:* users:(("/usr/sbin/amavi",pid=566440,fd=15))
    udp UNCONN 0 0 0.0.0.0:19132 0.0.0.0:* users:(("bedrock_server",pid=686862,fd=10))
    udp UNCONN 0 0 0.0.0.0:43833 0.0.0.0:* users:(("/usr/sbin/amavi",pid=566442,fd=15))
    udp UNCONN 0 0 0.0.0.0:44032 0.0.0.0:* users:(("/usr/sbin/amavi",pid=566435,fd=15))
    udp UNCONN 0 0 0.0.0.0:60933 0.0.0.0:* users:(("avahi-daemon",pid=1068,fd=14))
    udp UNCONN 0 0 0.0.0.0:37239 0.0.0.0:* users:(("/usr/sbin/amavi",pid=566436,fd=15))
    udp UNCONN 0 0 0.0.0.0:5353 0.0.0.0:* users:(("avahi-daemon",pid=1068,fd=12))
    udp UNCONN 0 0 *:31809 *:* users:(("bedrock_server",pid=686862,fd=9))
    udp UNCONN 0 0 [::]:48736 [::]:* users:(("avahi-daemon",pid=1068,fd=15))
    udp UNCONN 0 0 *:19133 *:* users:(("bedrock_server",pid=686862,fd=11))

    but as you can see, it’s finding the udp ports, not the tcp ports.
    I’ve tried chmod +x bedrock_server with no luck.
    My ufw is currently disabled, iptables shows no rules so it should be letting everything through. The webserver on the same machine is working correctly.

    Any help would be so appreciated.

    1. Avatar for James A. Chambers

      Hey Bob,

      Hmm, this is a tricky one. You already covered your bases on the permissions on bedrock_server (incredibly common). I have seen more rare cases where the permissions have been “lost” when the server was running. All of these ended up being a corrupt partition that needed a fsck repair ran on the drive (usually pretty painless, a few cases the drives were corrupt and a reimage was in order). It’s worth checking at least.

      Before that though can you pull up the server console with:

      screen -r

      ? If you can pull up the console and type in commands and everything looks normal (your logs certainly do) then it would point to it still being port/network related somehow.

      Did you choose those ports yourself? Those aren’t the bugged ports that show when Minecraft starts I hope. I believe this is how Gerry actually fixed his. He was looking at the bugged ports showing up in the console and trying those. After he ran SetupMinecraft again and manually picked the ports I believe that is what ultimately got it for him. Most people say choosing both as non-default ports but manually specified worked for them, but there’s a small minority (of more than just 1-2 people) that have better luck choosing both of the default ports exclusively.

      There’s a ton of bugs related to the ports that I’ve posted a bunch of links to before (I think it’s on the main doc page too) but basically for some people setting the ports in SetupMinecraft.sh both to default fixed it but I believe for most people setting *neither* of the ports to the default ports fixed it.

      There has to be something like this going on. I think it’s related to the bugs most likely. See BDS-3989, BDS-9198, BDS-4552 and I could link a bunch of others. It’s a long standing bug with nothing to do with the script specifically (i.e. I can’t fix it) but I can definitely point you in the right direction for what has fixed it for others for sure. Be advised there are active bugs opened on this you are fighting against though so some fiddling is probably required.

      I don’t think anyone has never not been able to get it going though if you run SetupMinecraft.sh and experiment with the different combinations of not using the default ports or using both of them. Definitely give that a try first thing and let’s see if that gets it for you without too much more pain!

      1. Avatar for Bob

        Thank you for your help. In the end it was a problem with the Firewall after all. I think it was maybe because I am also using iRedmail on that box, but it had nftables configured to refuse the connection. Once nftables was configured it worked.
        Now to figure out how to connect a switch to it 🙁

  3. Avatar for Moses

    Hello James! 🙂

    For some reason I just can’t make it to work! I downloaded and followed your guide step by step. But when i try to use this command “./start.sh”, I get this:

    moses@localhost:~/minecraftbe/Test$ ./start.sh Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Network interface not up, will try again in 1 second
    Waiting for network interface to come up timed out - starting server without network connection ...
    Checking for the latest version of Minecraft Bedrock server ...
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    0 0 0 0 0 0 0 0 --:--:-- -100 63522 0 63522 0 0 169k 0 --:--:-- -100 303k 0 303k 0 0 537k 0 --:--:-- --:--:-- --:--:-- 537k
    Minecraft Bedrock server is up to date...
    Starting Minecraft server. To view window type screen -r Test
    To minimize the window and let the server run in the background, press Ctrl+A then Ctrl+D
    ~~~~~~~~~

    And then nothing happens. The server isn’t running or anything. Do you know why? 🙁

    1. Avatar for James A. Chambers

      Hey Moses,

      Did you type screen -r? I can’t tell if it successfully downloaded the server or not but it looks like it’s having networking issues.

      What do the log files say in the minecraft server’s “log” folder?

      1. Avatar for Moses

        I get this when I write screen -r:

        moses@localhost:~/minecraftbe/Test$ screen -r
        There is no screen to be resumed.
        ~~~~~
        So that’s a no go 😛

        And about the logs, I have a few log files in the “log” folder but they are all completely empty. No text or anything 🙁

        So it won’t work anymore? I think I’m going to try another Ubuntu Xfce4 version.

        1. Avatar for James A. Chambers

          Hey Moses,

          That sounds like it’s not starting at all. I think trying another version would be a good idea just to check, something seems strange here! You can also check sudo systemctl status yourserver and see if you get a startup error from it!

          1. Avatar for Moses

            Hi again James! 🙂

            I wrote “Sudo systemfel status” and this popped up;

            “System has not been booted with systemd as init system (PID 1). Can’t operate. Failed to connect to bus: Host is down”

            It’s strange since I do have internet connection and everything works!

            I have no plans to port-forward this so other outside my network can join. I just want to use this using LAN only.
            I opened the “server-properties” file and changed the “online-mode=true” to false. But it still doesn’t work. But this time i get this instead, even though it doesn’t work:

            **** I got like 9 of those network thingy, so I removed them and only put 2** 😛

            Network interface not up, will try again in 1 second Network interface not up, will try again in 1 second Waiting for network interface to come up timed out - starting server without network connection ... Checking for the latest version of Minecraft Bedrock server ... % Total % Received % Xferd Average Speed Time Time Time Current
            Dload Upload Total Spent Left Speed
            0 0 0 0 0 0 0 0 --:--:-- - 0 0 0 0 0 0 0 0 --:--:-- -100 303k 0 303k 0 0 346k 0 --:--:-- --:--:-- --:--:-- 346k

            Minecraft Bedrock server is up to date…
            Starting Minecraft server. To view window type screen -r test
            To minimize the window and let the server run in the background, press Ctrl+A then Ctrl+D

            1. Avatar for James A. Chambers

              Hey Moses,

              It looks like this version of Linux doesn’t use systemd (which is what the system service uses). That certainly explains a lot since it’s written as a systemd service. What kind of box/server is this exactly and which distro is it running?

  4. Avatar for Mark

    Hi – I start and restart the server from a terminal command line it requires sudo password. It’s also not restarting with the backup and reboot each night until I terminal in and use ./start.sh and enter the sudo password when prompted. Anyway to have sudo password requirement removed?

    1. Avatar for James A. Chambers

      Hey Mark,

      It should use the sudoers file for that (SetupMinecraft.sh sets it up). Can you try running SetupMinecraft.sh again? The sudoers line is for the exact path and everything.

      If you run it again and it’s not working let me know what distro you are on as it probably has a non-standard sudo file (I think some RHEL based ones have a different one maybe). Hopefully running it again creates the correct entry for you!

      1. Avatar for Mark

        Thanks for the quick reply – ran it again, but no luck. I’m on Ubuntu 20.04.3. Generic kernel etc – nothing custom as such. I checked the sudoers user list, and the minecraftbe user hasn’t been added.

            1. Avatar for Mark

              Bummed to say that it’s been back for a while. I ran the fixpermissions script i didn’t see anywhere were mincraftbe sudoer got ownership of anything. It’s either my own user account or this… mode of '/home/amoc/minecraftbe/Hearnecraft/start.sh' retained as 0755 (rwxr-xr-x).

              I checked the sudoer file too and minecraftbe is not a user (I’m a bit new to Ubuntu, so please forgive the ignorance).

              1. Avatar for James A. Chambers

                Hey Mark,

                Welcome back! So the minecraftbe isn’t actually a user. The sudoers file allows all users to execute those specific commands. The minecraftbe referenced is just the folder (usually ~/minecraftbe/yourserver, minecraftbe is the base folder). The specific commands (that have to be specified all the way down to the correct folder for security reasons) are allowed to run by all users without putting the password in.

                If you are on Ubuntu it does not use a different sudoers file. The script was written on Ubuntu and the sudoers line should work without modification. Before trying anything else I’d run SetupMinecraft.sh again. You do not need to configure any of this stuff. Something is wrong on your system it sounds like to me.

                Why are you trying to fix the permissions? Is the issue still that the server won’t start up on reboot again? Which Ubuntu version is this? Is it up to date / a fresh install?

                How about log files? What does sudo systemd status minecraft say when this happens as well as your server log files? I want to restate it is not typical to have to mess with *any* of this stuff especially on Ubuntu. I think something else is wrong here but we’re going to need more info I think to figure it out but I’m sure we can get it!

              2. Avatar for Mark

                I reran SetupMinecraft.sh and ran a reboot – had to manually restart the Minecraft server again.

                Why are you trying to fix the permissions? Is the issue still that the server won’t start up on reboot again?
                Yes. Backups work as designed, but every morning I need to jump in run ./start.sh via a terminal to get the Minecraft server restarted (incidentally, it asks for my sudo password to run the script).

                Which Ubuntu version is this?

                20.04.3

                Is it up to date / a fresh install?

                Yes. I ran apt-get update and upgrade again. Livepatch reports no updates needed.

                How about log files? What does sudo systemd status minecraft say when this happens as well as your server log files?

                From auth log:
                Jan 6 04:00:32 amocserver sudo: amoc : a password is required ; TTY=unknown ; PWD=/home/amoc ; USER=root ; COMMAND=/usr/bin/systemctl start Hearnecraft

                From syslog:
                Jan 6 04:00:01 amocserver CRON[369920]: (amoc) CMD (/home/amoc/minecraftbe/Hearnecraft/restart.sh 2>&1)
                Jan 6 04:00:01 amocserver CRON[369921]: (amoc) CMD (/home/amoc/minecraftbe/mc/restart.sh)
                Jan 6 04:00:01 amocserver CRON[369922]: (amoc) CMD (/home/amoc/minecraftbe/hearnecraft/restart.sh 2>&1)
                Jan 6 04:00:01 amocserver CRON[369923]: (amoc) CMD (/home/amoc/minecraftbe/hearnecraft/restart.sh)
                Jan 6 04:00:01 amocserver CRON[369919]: (CRON) info (No MTA installed, discarding output)
                Jan 6 04:00:01 amocserver CRON[369917]: (CRON) info (No MTA installed, discarding output)
                Jan 6 04:00:01 amocserver CRON[369918]: (CRON) info (No MTA installed, discarding output)
                Jan 6 04:00:32 amocserver CRON[369916]: (CRON) info (No MTA installed, discarding output)
                Jan 6 04:09:01 amocserver CRON[370299]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
                Jan 6 04:09:12 amocserver canonical-livepatch.canonical-livepatchd[798]: Client information is recent, not refreshing.

                Systemmd check (Minecraft server is running)
                amoc@amocserver:~/Desktop$ systemctl status minecraft
                Unit minecraft.service could not be found.

                I want to restate it is not typical to have to mess with *any* of this stuff especially on Ubuntu. I think something else is wrong here but we’re going to need more info I think to figure it out but I’m sure we can get it!

                Thank you for your help, and patience.

              3. Avatar for James A. Chambers

                Hey Mark,

                It looks like the name of your systemd service is “Hearnecraft”. Can you try:

                sudo systemctl status Hearnecraft

                We may need to catch it right after this happens / the reboot or first thing in the morning.

                Just for good measure, can you try a:

                sudo systemctl daemon-reload
                sudo systemctl enable Hearnecraft

                as well?

                I do see one other thing in here:

                amocserver CRON[369921]: (amoc) CMD (/home/amoc/minecraftbe/mc/restart.sh)

                Is this for a second server or another server? Are there two servers running at once by chance? Or is this maybe left behind from another server? If there’s any left over servers you can go to:

                cd /etc/systemd/system

                If you have any old servers around they would be that server’s name .service and you can do:

                sudo rm mc.service
                sudo systemctl daemon-reload

                Definitely be careful here and don’t delete the wrong service by accident but they’re basically just text files (you can open them in nano / a text editor and see the few lines of instructions).

                I think we’re on the right track here, let’s check those couple of things and see if we can get it here!

              4. Avatar for Mark

                Result from sudo systemctl status Hearnecraft
                ● Hearnecraft.service - Hearnecraft Minecraft Bedrock Server
                Loaded: loaded (/etc/systemd/system/Hearnecraft.service; enabled; vendor preset: enabled)
                Active: failed (Result: exit-code) since Fri 2022-01-07 04:00:35 MST; 2 days ago
                Process: 1041 ExecStart=/bin/bash /home/amoc/minecraftbe/Hearnecraft/start.sh (code=exited, status=0/SUCCESS)
                Process: 56708 ExecStop=/bin/bash /home/amoc/minecraftbe/Hearnecraft/stop.sh (code=exited, status=1/FAILURE)

                Jan 06 07:23:06 amocserver bash[2417]: % Total % Received % Xferd Average Speed Time Time Time Current
                Jan 06 07:23:06 amocserver bash[2417]: Dload Upload Total Spent Left Speed
                Jan 06 07:23:06 amocserver bash[2417]: [158B blob data]
                Jan 06 07:23:06 amocserver bash[1041]: Minecraft Bedrock server is up to date...
                Jan 06 07:23:06 amocserver bash[1041]: Starting Minecraft server. To view window type screen -r Hearnecraft
                Jan 06 07:23:06 amocserver bash[1041]: To minimize the window and let the server run in the background, press Ctrl+A then Ctrl+D
                Jan 06 07:23:06 amocserver systemd[1]: Started Hearnecraft Minecraft Bedrock Server.
                Jan 07 04:00:35 amocserver bash[56708]: Server is not currently running!
                Jan 07 04:00:35 amocserver systemd[1]: Hearnecraft.service: Control process exited, code=exited, status=1/FAILURE
                Jan 07 04:00:35 amocserver systemd[1]: Hearnecraft.service: Failed with result 'exit-code'.

                Removed mc.service. Will let you know if it correctly restarts overnight.

              5. Avatar for James A. Chambers

                Hey Mark,

                The service is in failed status. What happens if you bring it up with sudo systemctl start Hearnecraft? Then if you do a sudo systemctl status Hearnecraft does it work?

                What does your startup routine look like? Do you have some sort of secondary internet connection / a VPN / anything like that which might explain the server starting too early before networking is ready? It’s supposed to wait for networking to be ready. It looks like it’s retrieving the version correctly.

                The log files you posted are from when you originally started the server. What about when you restart it? Are they just empty? That would mean the server isn’t even attempting to be started basically. The systemd status says it’s throwing an exit code. That means screen should be generating a log file for it during the restart.

                What happens if you just reboot your computer? Does it start then? It looks like it’s having trouble actually stopping the service. “bin/bash /home/amoc/minecraftbe/Hearnecraft/stop.sh (code=exited, status=1/FAILURE)” seems to point to stop.sh as the problem.

                I’ve literally never seen this before, but I have an idea. Can you open start.sh and try changing the “exit 1” (there’s two instances of this right after the path variable is set) to “exit 0”? I think it’s trying to stop the server and then since it’s returning a non=zero exit code maybe that’s doing it for some reason? It doesn’t seem like things are happening the way they should. I could only speculate as to why as that would be a system-specific configuration issue but I can definitely continue to assist via log output.

                Let’s see if that modification makes it reboot correctly just as a test. If it does maybe I’ll just change that exit code to 0 permanently as there’s really no benefit to it returning a non-zero exit code except for scripting purposes and we don’t utilize that in this script. Hopefully we’re getting close here, this really is a strange one!

              6. Avatar for Mark

                Server not started this morning. As you suggested – sudo systemctl start Hearnecraft then sudo systemctl status Hearnecraft. Worked.

                Hearnecraft.service - Hearnecraft Minecraft Bedrock Server
                Loaded: loaded (/etc/systemd/system/Hearnecraft.service; enabled; vendor preset: enabled)
                Active: active (running) since Wed 2022-01-12 07:12:10 MST; 23s ago
                Process: 407796 ExecStart=/bin/bash /home/amoc/minecraftbe/Hearnecraft/start.sh (code=exited, status=0/SUCCESS)
                Tasks: 20 (limit: 19046)
                Memory: 432.2M
                CGroup: /system.slice/Hearnecraft.service
                ├─407832 SCREEN -L -Logfile logs/Hearnecraft.2022.01.12.07.12.10.log -dmS Hearnecraft /bin/bash -c LD_LIBRARY_PA>
                ├─407833 /bin/bash -c LD_LIBRARY_PATH=/home/amoc/minecraftbe/Hearnecraft /home/amoc/minecraftbe/Hearnecraft/bedr>
                ├─407834 /home/amoc/minecraftbe/Hearnecraft/bedrock_server
                └─407835 gawk { print strftime("[%Y-%m-%d %H:%M:%S]"), $0 }

                Jan 12 07:12:09 amocserver bash[407806]: worlds/Hearnecraft/db/044753.ldb
                Jan 12 07:12:09 amocserver bash[407806]: worlds/Hearnecraft/db/043478.ldb
                Jan 12 07:12:09 amocserver bash[407796]: Checking for the latest version of Minecraft Bedrock server ...
                Jan 12 07:12:10 amocserver bash[407824]: % Total % Received % Xferd Average Speed Time Time Time Current
                Jan 12 07:12:10 amocserver bash[407824]: Dload Upload Total Spent Left Speed
                Jan 12 07:12:10 amocserver bash[407824]: [158B blob data]
                Jan 12 07:12:10 amocserver bash[407796]: Minecraft Bedrock server is up to date...
                Jan 12 07:12:10 amocserver bash[407796]: Starting Minecraft server. To view window type screen -r Hearnecraft
                Jan 12 07:12:10 amocserver bash[407796]: To minimize the window and let the server run in the background, press Ctrl+A then C>
                Jan 12 07:12:10 amocserver systemd[1]: Started Hearnecraft Minecraft Bedrock Server.

                What does your startup routine look like?

                Not sure how to answer that. Is there a log or such I can pull? The setup is very vanilla.

                Do you have some sort of secondary internet connection / a VPN / anything like that which might explain the server starting too early before networking is ready?

                No. Server is connected to router via Ethernet. Wifi is turned off.

                The log files you posted are from when you originally started the server. What about when you restart it? Are they just empty?

                Not empty. Auth.log
                Jan 12 07:19:58 amocserver systemd-logind[732]: System is rebooting.
                Jan 12 07:19:58 amocserver nxexec: pam_unix(nx:session): session opened for user amoc by (uid=129)
                Jan 12 07:19:58 amocserver sudo: pam_unix(sudo:session): session closed for user root
                Jan 12 07:20:19 amocserver systemd-logind[719]: New seat seat0.
                Jan 12 07:20:19 amocserver systemd-logind[719]: Watching system buttons on /dev/input/event2 (Power Button)
                Jan 12 07:20:19 amocserver systemd-logind[719]: Watching system buttons on /dev/input/event1 (Power Button)
                Jan 12 07:20:19 amocserver systemd-logind[719]: Watching system buttons on /dev/input/event0 (Sleep Button)
                Jan 12 07:20:25 amocserver sudo: pam_unix(sudo:auth): conversation failed
                Jan 12 07:20:25 amocserver sudo: pam_unix(sudo:auth): auth could not identify password for [amoc]
                Jan 12 07:20:25 amocserver gdm-autologin]: gkr-pam: no password is available for user
                Jan 12 07:20:25 amocserver gdm-autologin]: pam_unix(gdm-autologin:session): session opened for user amoc by (uid=0)
                Jan 12 07:20:25 amocserver systemd-logind[719]: New session 1 of user amoc.
                Jan 12 07:20:25 amocserver systemd: pam_unix(systemd-user:session): session opened for user amoc by (uid=0)
                Jan 12 07:20:25 amocserver gdm-autologin]: gkr-pam: gnome-keyring-daemon started properly
                Jan 12 07:20:26 amocserver gnome-keyring-daemon[1159]: The Secret Service was already initialized
                Jan 12 07:20:26 amocserver gnome-keyring-daemon[1159]: The PKCS#11 component was already initialized
                Jan 12 07:20:27 amocserver polkitd(authority=local): Registered Authentication Agent for unix-session:1 (system bus name :1.52 [/usr/bin/gnome-shell], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
                Jan 12 07:20:31 amocserver PackageKit: uid 1000 is trying to obtain org.freedesktop.packagekit.system-sources-refresh auth (only_trusted:0)
                Jan 12 07:20:31 amocserver PackageKit: uid 1000 obtained auth for org.freedesktop.packagekit.system-sources-refresh
                Jan 12 07:20:51 amocserver nxexec: pam_unix(nx:session): session opened for user amoc by (uid=129)
                Jan 12 07:20:51 amocserver systemd-logind[719]: New session c1 of user amoc.
                Jan 12 07:21:30 amocserver pkexec: pam_unix(polkit-1:session): session opened for user root by (uid=1000)
                Jan 12 07:21:30 amocserver pkexec[2768]: amoc: Executing command [USER=root] [TTY=unknown] [CWD=/home/amoc] [COMMAND=/usr/lib/update-notifier/package-system-locked]
                Jan 12 07:21:47 amocserver nxexec: pam_unix(nx:session): session opened for user amoc by (uid=129)
                Jan 12 07:21:47 amocserver systemd-logind[719]: New session c2 of user amoc.
                Jan 12 07:22:03 amocserver smbd: pam_unix(samba:session): session closed for user nobody
                Jan 12 07:22:25 amocserver smbd: pam_unix(samba:session): session closed for user nobody
                Jan 12 07:22:42 amocserver smbd: pam_unix(samba:session): session closed for user nobody

                from syslog (it’s got a ton of stuff, so just pulling what looks relevant – let me know if better to share the whole thing)

                Jan 12 07:19:58 amocserver systemd[1]: Stopping Hearnecraft Minecraft Bedrock Server...
                ....
                Jan 12 07:20:24 amocserver systemd[1]: Finished Network Manager Wait Online.
                Jan 12 07:20:24 amocserver systemd[1]: Reached target Network is Online.
                Jan 12 07:20:24 amocserver systemd[1]: Starting Hearnecraft Minecraft Bedrock Server...
                Jan 12 07:20:24 amocserver systemd[1]: Starting LSB: disk temperature monitoring daemon...
                Jan 12 07:20:24 amocserver systemd[1]: Starting Tool to automatically collect and submit kernel crash signatures...
                Jan 12 07:20:24 amocserver systemd[1]: Starting Samba NMB Daemon...
                Jan 12 07:20:24 amocserver systemd[1]: Starting LSB: LDAP connection daemon...
                Jan 12 07:20:24 amocserver systemd[1]: Starting Plex Media Server...
                Jan 12 07:20:24 amocserver systemd[1]: Started crash report submission daemon.
                Jan 12 07:20:24 amocserver systemd[1]: Started LSB: LDAP connection daemon.
                Jan 12 07:20:24 amocserver whoopsie[1065]: [07:20:24] Using lock path: /var/lock/whoopsie/lock
                Jan 12 07:20:24 amocserver cron[1073]: (CRON) INFO (pidfile fd = 3)
                Jan 12 07:20:24 amocserver systemd[1]: Started Regular background program processing daemon.
                Jan 12 07:20:24 amocserver systemd[1]: Starting GNOME Display Manager...
                Jan 12 07:20:24 amocserver systemd[1]: Started Plex Media Server.
                Jan 12 07:20:24 amocserver cron[1073]: (CRON) INFO (Running @reboot jobs)
                Jan 12 07:20:24 amocserver systemd[1]: Started LSB: disk temperature monitoring daemon.
                Jan 12 07:20:24 amocserver Plex Media Server[1081]: /bin/sh: 1: exec: /usr/lib/plexmediaserver/Plex Media Server: not found
                Jan 12 07:20:24 amocserver systemd[1]: kerneloops.service: Found left-over process 1099 (kerneloops) in control group while starting unit. Ignoring.
                Jan 12 07:20:24 amocserver systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
                Jan 12 07:20:24 amocserver systemd[1]: plexmediaserver.service: Main process exited, code=exited, status=127/n/a
                Jan 12 07:20:24 amocserver systemd[1]: plexmediaserver.service: Failed with result 'exit-code'.
                Jan 12 07:20:24 amocserver bash[1090]: sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
                Jan 12 07:20:25 amocserver systemd[1]: Started Tool to automatically collect and submit kernel crash signatures.
                Jan 12 07:20:25 amocserver bash[1055]: Backing up server (to minecraftbe/Hearnecraft/backups folder)
                Jan 12 07:20:25 amocserver systemd[1]: Started GNOME Display Manager.
                Jan 12 07:20:25 amocserver bash[1110]: worlds/
                Jan 12 07:20:25 amocserver bash[1110]: worlds/Bedrock level/
                Jan 12 07:20:25 amocserver bash[1110]: worlds/Bedrock level/level.dat_old
                ... and then the minecraft server continues to load(this is with a restart this morning!)

                What happens if you just reboot your computer? Does it start then?

                Yes, which is a bit odd. I think I’ve had to manually start the minecraft server every time I rebooted. I rebooted again and the server started again.

                Can you open start.sh and try changing the “exit 1” (there’s two instances of this right after the path variable is set) to “exit 0”?

                Done. We’ll see what happens with this night’s backup and reboot.

              7. Avatar for James A. Chambers

                Hey Mark,

                The system just looks broken to me. The Minecraft server isn’t the only thing that isn’t booting:

                Plex Media Server[1081]: /bin/sh: 1: exec: /usr/lib/plexmediaserver/Plex Media Server: not found
                plexmediaserver.service: Main process exited, code=exited, status=127/n/a

                The kernel crash daemon is even broken/stuck right as starting the system it looks like (or it’s flat out corrupted/missing dependencies):

                kerneloops.service: Found left-over process 1099 (kerneloops) in control group while starting unit. Ignoring.
                This usually indicates unclean termination of a previous run, or service implementation deficiencies.

                Your sudo implementation/sudoers file is somehow broken too:

                Jan 12 07:20:24 amocserver bash[1090]: sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper

                I can’t explain why if you manually reboot it it will take the sudo command but our system integrity is not high enough here to take it too seriously. Can you see how many broken services you have with:

                sudo systemctl --failed
                sudo systemctl --failed status

                This isn’t a clean boot and will be in “degraded” status for sure. It almost looks like a repurposed Plex install or it previously contained a Plex install that was only partially removed and is basically in a broken state. Whatever this is, it is/has already taken far, far more time to troubleshoot than a clean reinstall and that’s my recommendation at this point. We can’t go in and manually fix all these broken services, and I would never attempt to do so either privately or professionally because you’re looking at 1-2 hours to completely reinstall a corrupt OS / restore backups.

                I’ve had a few threads like this. It has always ended up being a broken OS that needed to be reinstalled and *nothing* short of that ever got it working and it was working only a couple of hours once they finally decided to do it. We could go and manually fix all of these broken services one by one but what is the point? You’ll still have a machine that you can’t trust is actually running correctly because there were so many corrupt/broken services. Not even the kerneloops service or sudo is working correctly on this rig at the moment.

                Nothing has changed with the script for a few months that would explain any of it. It definitely looks like something finally “snapped” with sudo as that looks like is where it’s failing (but only on start up for some reason, but not a startup you manually initiate). Without a functioning sudo it’s failing to launch the service. This is all undefined behavior by the OS from what it looks like are a few error conditions with your core OS. There’s definitely a lot of missing/broken stuff here though that should never be missing/broken on a sound OS install.

                We’ve had a few like this over the years. Here’s an example from GitHub. Here’s another one I had that went on for about 7-8 more replies than this one has where the system was similarly mysteriously broken in the strangest ways but with apt. He spent WEEKS before I convinced him his OS was broken and to reinstall it and once he did he never had another problem again and as far as I know is still successfully hosting that.

                I definitely have learned to sound the alarm earlier and not humor ones that are this broken as in Linux it’s a total waste of time to attempt to fix something once you have multiple system services broken/failing. Something at some point went very wrong with some kind of package update or other update in the past usually to cause these and there could be dozens or hundreds of pieces like missing symlinks, abandoned folders, old service tags and a million other broken things that even if you ran a side by side image comparison against a working image with a forensic tool you’d never find them all and it would take so long to find them it would never be justified vs. just reinstalling and restoring a backup. I think this is at the point where this system is falling into that category as the more I look at the logs the more broken things I see that are essentially built-in system tools.

                Hopefully that helps here!

              8. Avatar for Mark

                Definitely helps. I’ll embark on a reinstall this weekend. Thank you again for the patience. I’m also going to dive into some UNIX/Ubuntu tutorials to get better at this.

              9. Avatar for James A. Chambers

                Hey Mark,

                I’m excited to hear how this goes! I’m glad I wasn’t too off-putting in my last message. I try to be very direct when giving the “bad news” like this for an OS install. The reason for this is when working professionally as a tech a lot of other techs would beat around the bush with this stuff and people did not appreciate it. A lot of the time it’s a sign that the tech just doesn’t know how to fix the problem.

                In your case we could absolutely fix those broken services one by one but the issue is we have reasons to doubt the system’s overall integrity beyond what we can “see”. That is a lot of services to break at once and would point to some other issue like maybe part of the partition got corrupted, an apt upgrade went haywire or power was cut during a dpkg configure, or some other one in a million thing that even with those odds over years of time it’s not too uncommon to have some pop up.

                Given that we were able to spot at least 3 malfunctioning core system services in the log snippets so far I’m guessing if we looked at the full giant systemd log that we could find at least a dozen more. So in addition to not being able to trust the system integrity and that we got everything it would take much more time to fix than a clean install which restores our faith in the system’s overall integrity with a clean image solving both problems (and permanently).

                It’s my personality to always want to fix them, but I have learned the hard way over time. Let’s see how things go after a reinstall and restoring a backup here!

              10. Avatar for Mark

                Reinstalled. Smooth operation, although I did have a blank moment when trying to remember what I did to make it headless (xorg). MC was up and running this morning, fully backed up! Thanks again!

              11. Avatar for James A. Chambers

                Hey Mark,

                Congratulations, I’m glad you got it going here! Definitely let me know if this comes back as it would point to there is something else going on but I’m guessing you’ll be in great shape here. Enjoy!

  5. Avatar for Gerry

    Just used your script to setup a bedrock server for my son, thanks. Looks like the server starts up:
    [2021-12-12 19:37:33] NO LOG FILE! – [] setting up server logging…
    [2021-12-12 19:37:33] [2021-12-12 19:37:33:561 INFO] Starting Server
    [2021-12-12 19:37:33] [2021-12-12 19:37:33:561 INFO] Version 1.18.2.03
    [2021-12-12 19:37:33] [2021-12-12 19:37:33:561 INFO] Session ID 3e050eec-1e61-49a7-bc86-f04433ceab32
    [2021-12-12 19:37:33] [2021-12-12 19:37:33:561 INFO] Level Name: Bedrock level
    [2021-12-12 19:37:33] [2021-12-12 19:37:33:565 INFO] Game mode: 0 Survival
    [2021-12-12 19:37:33] [2021-12-12 19:37:33:565 INFO] Difficulty: 1 EASY
    [2021-12-12 19:37:33] [2021-12-12 19:37:33:624 INFO] opening worlds/Bedrock level/db
    [2021-12-12 19:37:34] [2021-12-12 19:37:34:734 INFO] IPv4 supported, port: 19132
    [2021-12-12 19:37:34] [2021-12-12 19:37:34:737 INFO] IPv6 supported, port: 19133
    [2021-12-12 19:37:34] [2021-12-12 19:37:34:095 INFO] Server started.
    [2021-12-12 19:37:34] [2021-12-12 19:37:34:123 INFO] IPv4 supported, port: 39570
    [2021-12-12 19:37:34] [2021-12-12 19:37:34:123 INFO] IPv6 supported, port: 39654

    The issue is, when I run netstat, I dont see it listening:

    netstat -nat
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address Foreign Address State
    tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN
    tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
    tcp 0 256 192.168.22.22:22 192.168.22.98:63913 ESTABLISHED
    tcp 0 0 192.168.22.22:47312 99.84.243.65:443 TIME_WAIT

    Logs dont show anything out of the ordinary. Any ideas?

    1. Avatar for James A. Chambers

      Hey Gerry,

      How about a:

      netstat -l?

      The server has both a TCP and UDP port (Bedrock primarily uses UDP, a connectionless protocol) but netstat -l or netstat -al should *definitely* reveal them. Are you able to pull up the console with screen -r? Does everything look normal there?

      1. Avatar for Gerry

        netstat -l
        Active Internet connections (only servers)
        Proto Recv-Q Send-Q Local Address Foreign Address State
        tcp 0 0 localhost:domain 0.0.0.0:* LISTEN
        tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
        tcp6 0 0 [::]:ssh [::]:* LISTEN
        udp 0 0 0.0.0.0:39570 0.0.0.0:*
        udp 0 0 0.0.0.0:19132 0.0.0.0:*
        udp 0 0 localhost:domain 0.0.0.0:*
        udp 0 0 kmminecraft.madd:bootpc 0.0.0.0:*
        udp6 0 0 [::]:19133 [::]:*
        udp6 0 0 [::]:39654 [::]:*
        udp6 0 0 kmminecra:dhcpv6-client [::]:*
        raw6 0 0 [::]:ipv6-icmp [::]:* 7
        Active UNIX domain sockets (only servers)
        Proto RefCnt Flags Type State I-Node Path
        unix 2 [ ACC ] SEQPACKET LISTENING 18449 /run/udev/control
        unix 2 [ ACC ] STREAM LISTENING 26226 /run/user/1000/systemd/private
        unix 2 [ ACC ] STREAM LISTENING 26231 /run/user/1000/bus
        unix 2 [ ACC ] STREAM LISTENING 26232 /run/user/1000/gnupg/S.dirmngr
        unix 2 [ ACC ] STREAM LISTENING 26233 /run/user/1000/gnupg/S.gpg-agent.browser
        unix 2 [ ACC ] STREAM LISTENING 22706 /var/snap/lxd/common/lxd/unix.socket
        unix 2 [ ACC ] STREAM LISTENING 26234 /run/user/1000/gnupg/S.gpg-agent.extra
        unix 2 [ ACC ] STREAM LISTENING 15770 @/org/kernel/linux/storage/multipathd
        unix 2 [ ACC ] STREAM LISTENING 26235 /run/user/1000/gnupg/S.gpg-agent.ssh
        unix 2 [ ACC ] STREAM LISTENING 26236 /run/user/1000/gnupg/S.gpg-agent
        unix 2 [ ACC ] STREAM LISTENING 26237 /run/user/1000/pk-debconf-socket
        unix 2 [ ACC ] STREAM LISTENING 26238 /run/user/1000/snapd-session-agent.socket
        unix 2 [ ACC ] STREAM LISTENING 15757 /run/systemd/private
        unix 2 [ ACC ] STREAM LISTENING 15759 /run/systemd/userdb/io.systemd.DynamicUser
        unix 2 [ ACC ] STREAM LISTENING 15768 /run/lvm/lvmpolld.socket
        unix 2 [ ACC ] STREAM LISTENING 18434 /run/systemd/fsck.progress
        unix 2 [ ACC ] STREAM LISTENING 18444 /run/systemd/journal/stdout
        unix 2 [ ACC ] STREAM LISTENING 16842 /run/systemd/journal/io.systemd.journal
        unix 2 [ ACC ] STREAM LISTENING 22703 /run/dbus/system_bus_socket
        unix 2 [ ACC ] STREAM LISTENING 22708 /run/snapd.socket
        unix 2 [ ACC ] STREAM LISTENING 22710 /run/snapd-snap.socket
        unix 2 [ ACC ] STREAM LISTENING 22712 /run/uuidd/request
        unix 2 [ ACC ] STREAM LISTENING 22943 /run/irqbalance//irqbalance689.sock
        unix 2 [ ACC ] STREAM LISTENING 31178 /run/screen/S-gerrym/2058.KMMineCraft
        unix 2 [ ACC ] STREAM LISTENING 22705 @ISCSIADM_ABSTRACT_NAMESPACE

        1. Avatar for Gerry

          [2021-12-12 19:37:33] NO LOG FILE! - [] setting up server logging...
          [2021-12-12 19:37:33] [2021-12-12 19:37:33:561 INFO] Starting Server
          [2021-12-12 19:37:33] [2021-12-12 19:37:33:561 INFO] Version 1.18.2.03
          [2021-12-12 19:37:33] [2021-12-12 19:37:33:561 INFO] Session ID 3e050eec-1e61-49a7-bc86-f04433ceab32
          [2021-12-12 19:37:33] [2021-12-12 19:37:33:561 INFO] Level Name: Bedrock level
          [2021-12-12 19:37:33] [2021-12-12 19:37:33:565 INFO] Game mode: 0 Survival
          [2021-12-12 19:37:33] [2021-12-12 19:37:33:565 INFO] Difficulty: 1 EASY
          [2021-12-12 19:37:33] [2021-12-12 19:37:33:624 INFO] opening worlds/Bedrock level/db
          [2021-12-12 19:37:34] [2021-12-12 19:37:34:734 INFO] IPv4 supported, port: 19132
          [2021-12-12 19:37:34] [2021-12-12 19:37:34:737 INFO] IPv6 supported, port: 19133
          [2021-12-12 19:37:34] [2021-12-12 19:37:34:095 INFO] Server started.
          [2021-12-12 19:37:34] [2021-12-12 19:37:34:123 INFO] IPv4 supported, port: 39570
          [2021-12-12 19:37:34] [2021-12-12 19:37:34:123 INFO] IPv6 supported, port: 39654

            1. Avatar for James A. Chambers

              Hey Gerry,

              So you should be trying to connect to ports 39654 and 39570. Those are the ones you put in SetupMinecraft.sh. If you want to change the ports to the default ports you’d want to run the SetupMinecraft.sh script again.

              In fact, that’s exactly what I would recommend at this point as that should fix permissions issues as well. Something is not right here. I would run SetupMinecraft.sh from scratch again and leave everything the default and see what you’re getting.

              The server is starting up fine. You did not choose the default ports during SetupMinecraft.sh though so you shouldn’t be trying to connect to those. You want to ignore the default ports. That’s a well known BDS bug. Ignore them unless that’s what you picked in SetupMinecraft.sh (which it shouldn’t be or you wouldn’t see the second set of ports usually, but sometimes we’ve seen the default ports cause it, more on that in a moment).

              If you *ARE* using the default ports then I would actually recommend SetupMinecraft.sh and set them to *not* be the default ports as this bug may be hitting you in that way too (we’ve seen both). These are long standing Bedrock Dedicated Server bugs that have nothing to do with the script and are in the Bedrock Dedicated Server binary itself by Microsoft essentially that are as of yet unaddressed unfortunately.

              Hopefully that gets it!

              1. Avatar for Gerry

                Got it working, thanks for your help. One last thing in server.properties, I have creative mode enabled and when the server starts, it says creative mode, but when I connect to the server its in survival mode still.

              2. Avatar for James A. Chambers

                Hey Gerry,

                Excellent work, I’m glad to hear you got it working! I think I can help with this one. Each player has their own game mode and the one in the server.properties file is just the default game mode for new players.

                Unless you make the following modification:

                force-gamemode=false
                *to*
                force-gamemode=true

                Otherwise your game mode in server.properties is treated as the default for new players as you can individually change each player’s game mode with /gamemode player creative (or you can use the #s like the server.properties file). Otherwise I believe the behavior is you get the game mode you had the last time you logged out / had a player save if I remember correctly (this is so that the game mode command “sticks” when an admin uses it on a player).

                Setting everyone to the same gamemode is likely what you want so I would change the force-gamemode and that should get it going for you!

        2. Avatar for James A. Chambers

          Excellent, let’s see what we can find here:

          udp6 0 0 [::]:39654 [::]:*

          There’s the UDP socket for the game server for IPV6

          udp 0 0 0.0.0.0:39570 0.0.0.0:*

          And there’s the IPV4 port 39654. Which ports are you looking for? It’s actually a (well known and several year old unfortunately) bug that it shows the 19132 and 19133 ports even when you have alternate ports selected. Your ports are actually listening in this shot on 19132 and 19133 as well. It does look like it’s listening for sure although I don’t even see the TCP sockets and am only seeing UDP (which shouldn’t matter, the TCP is only used for the number of players online in Bedrock while Java is largely TCP in-game if I’m not mistaken).

          Are you having trouble connecting? It’s often on the client side I’ve found. A couple common reasons are: not clicking to allow “Public” in the firewall when the Minecraft client starts (UDP traffic is *always* public because it is a connectionless protocol), *or* failing to connect to the server and then trying to connect again without restarting the game client (affects both PC and Android versions for sure). For some reason something gets cached on these failed connects then if you restart the client and connect again it will connect.

          Last but not least, hopefully you are not using the Java edition of Minecraft, which is not what this server is for but I do have one here for Java: Raspberry Pi Minecraft Server Setup Script w/ Startup Service

          If you have a firewall like ufw you may need to do something like:

          ufw allow 39570
          ufw allow 39654

          You will not see them connected to the server either in netstat (at least as an established connection), you need to do a netstat -al and then it will show you all the “streams” and you can find them in there a lot of the time. Hopefully that helps here!

          1. Avatar for Gerry

            Thanks for your help James, I disabled ipv6 and tried to restart the service, now I’m getting:
            Displaying last 10 lines from log file /home/gerrym/minecraftbe/KMMineCraft/logs/KMMineCraft.2021.12.12.20.06.28.log in /logs folder:
            [2021-12-12 20:06:29] Upload Date: 2021-12-12 20:06:29 UTC
            [2021-12-12 20:06:29] Session ID: 977438b8-54f6-4b18-813f-4a792542a1b5
            [2021-12-12 20:06:29] Commit hash: 74c6ce6eb10dfe6b481aa14578b375b50a5d2028
            [2021-12-12 20:06:29] Build id: 7966228
            [2021-12-12 20:06:29] CrashReporter Key: b201d04f-e5d0-3630-89a3-45bc4e1c3751
            [2021-12-12 20:06:29]
            [2021-12-12 20:06:29] Crash
            [2021-12-12 20:06:29] [2021-12-12 20:06:29:319 INFO]
            Failed to open curl lib from binary, use libcurl.so instead
            [2021-12-12 20:06:30] db3ace51-c50d-40b9-961a-0fd72b49adf3

            1. Avatar for James A. Chambers

              Hey Gerry,

              Ahh, that is progress! It looks like not seeing the listening TCP ports was indeed a red flag.

              It looks like you are either missing the curl library (unlikely but possible) or far more likely your bedrock_server is missing the +x permission as it is statically built so libcurl is (mostly) actually inside there. Go ahead and try a:

              chmod +x bedrock_server

              and try launching again. It may also be good to chmod +x any other library or .so objects in the folder (I think there’s only one or two) but it’s almost always the bedrock_server binary that needs the +x.

              I should mention that the other times we’ve seen this it was because the partition was corrupted (needed an fsck on the drive). In this case they would give the server +x permissions and start it and then it would magically lose +x permissions. This was because the partition table was corrupt and writing to certain portions of the map would cause it to revert to not having +x permissions again. I just wanted to throw that in in case you see that.

              Let’s see if those things get it!

  6. Avatar for Paul Fielding

    Thank you for this guide! I have a question regarding removing a server. Having created one for testing purposes, I’m ready to start setting up the specific servers I want to use. I’d like to delete the world I created (ie. the service, crontab entry, etc). I’m sure if I dig through things enough I can figure out everything that manually needs to be removed, but is there any more efficient way already worked out, or is there a list of the specific things to remove already documented somewhere? Many thanks!

    1. Avatar for James A. Chambers

      Hey Paul,

      No worries at all, that’s exciting you’re moving to multiple servers! So it’s super easy to remove. The service is just a text file located at:

      /etc/systemd/system/yourservername.service

      You may remove that file with:

      sudo rm -f /etc/systemd/system/yourservername.service
      sudo systemctl daemon-reload

      And that’s it! All you have to do other than that for a full uninstallation is delete the old server folder. There is also a /etc/sudoers file modification but if you’re reinstalling multiple servers I wouldn’t worry about that one and would just remove the old service. Hopefully that helps!

Leave a Comment

Your email address will not be published. Required fields are marked *

Type here..

Exit mobile version