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).
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*
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*
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*
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:
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
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
Can I use the normal version of Ubuntu?
Hey ediwn,
Absolutely! It even works on many other flavors of Linux (ones that use apt are the easiest). The normal desktop version of Ubuntu will work just fine though for sure!
Hey James, I installed the server, but whenever I try to start it it just keep crashing, here is the log file generated. I hope you can help me
Hey Alejandro,
I don’t think the log file came through but feel free to paste it in here in your reply!
Hi James,
one again I’ve a question:
Is there a possibility to setup/create a “skyblock” world on the dedicated bedrock server?
Greetings
Matthias
Hey Matthias,
Welcome back! So that is absolutely possible but it’s a little tricky. Basically the “Skyblock” world is just a map and people do distribute Bedrock maps sometimes (it’s basically your “worlds” folder in a zip file) so you would pretty much just set up a new server and put this map in there (and run ./fixpermissions.sh). Here’s one.
Here’s one that comes as a .mcworld file. You can rename this file to .zip and you will see the level files inside it. Make a new server and then go to the “worlds” folder. You should see one folder inside with the name of your level. Go inside that subfolder and then you should see files that look a lot like what is inside the .mcworld file we renamed to a .zip file and opened. Go ahead and put the files from the .mcworld/zip in that folder (may be called something generic like ‘Bedrock Level’ or something, it doesn’t matter). If it’s easier you can do the extraction stuff on your Windows PC and then just sftp / file share the files to your Linux server (this is what I would do).
Finally, run ./fixpermissions.sh from inside your server folder so it sets the proper permissions on the new world. And that’s it! You should be able to start the server. If you have any errors check the “logs” file as we may have to change something in server.properties to point to the right world folder but I am looking at the files and it looks safe to extract them into the existing folder inside your “worlds” folder without renaming it which should let you do this without having to change server.properties as long as you run ./fixpermissions.sh before starting the server.
Go ahead and give it a try and I can definitely help if you run into trouble. There’s a lot of little steps so I think this method will let us avoid having to deal with them but if you get errors check the logs file and I can definitely assist!
Hi James,
now I found the time to setup a Mincraft Skyblock server as you described above (I’ve taken on with 1.17 Features). It’s a lot of fun, thanks for it. 😉
After testing it, I now have the Problem to run both worlds (the Skyblock and my “old” one). If I understood you right, it is not possible to run 2 worlds on one (software) server, but is there as possibility to run 2 dedicated server installations on one hardware server with different ports?
Hey Matthias,
Great question! You absolutely can, and it’s already set up to do this. You can just run SetupMinecraft.sh and pick a different set of default ports and a different server label and you should be all set!
Hi,
First ff, thanks James for putting all these scripts and tutorial together. This is much appreciated! Now, I am having issues downloading 1.17.10. I am using the part of start.sh that checks for the newest version of minecraft and downloads it when the version is newer that what is installed. The script downloads the file “bedrock-server-1.17.10.04.zip” to the ‘downloads’ directory, but it is looking like these are actually the files for 1.17.2. The script unzips it and all looks good but then the clients are saying that the server is outdated (and is version 1.17.2). I changed the script to download to another directory and the files that were unzipped had the same size and dates as the production directory (the bedrock server file was showing an update date of June 21). I’m not sure how to validate that the files are for 1.17.2 but with that Update date, it doesn’t seems right for 1.17.10 (plus the clients are saying it is 1.17.2). Not sure how to trouble shoot past this, at the moment, so checking if there are any thoughts to help trouble shoot. Here is the script that I am using to get the newest version:
# Test internet connectivity first
curl -H "Accept-Encoding: identity" -H "Accept-Language: en" -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.$RandNum.212 Safari>
if [ "$?" != 0 ]; then
echo "Unable to connect to update website (internet connection may be down). Skipping update ..."
else
# Download server index.html to check latest version
curl -H "Accept-Encoding: identity" -H "Accept-Language: en" -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.$RandNum.212 Sa>
DownloadURL=$(grep -o 'https://minecraft.azureedge.net/bin-linux/[^"]*' downloads/version.html)
DownloadFile=$(echo "$DownloadURL" | sed 's#.*/##')
# Download latest version of Minecraft Bedrock dedicated server if a new one is available
if [ -f "downloads/$DownloadFile" ]
then
echo "Minecraft Bedrock server is up to date..."
else
echo "New version $DownloadFile is available. Updating Minecraft Bedrock server ..."
curl -H "Accept-Encoding: identity" -H "Accept-Language: en" -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.$RandNum.21>
unzip -o "downloads/$DownloadFile" -x "*server.properties*" "*permissions.json*" "*whitelist.json*" "*valid_known_packs.json*" -d /home/adam/downloads/
#docker/minecraftbedrock/
Permissions=$(chmod u+x /home/adam/docker/minecraftbedrock/bedrock_server >/dev/null)
fi
fi
Any help in troubleshooting would be appreciated!
Adam
Hey Adam,
Great question, and thanks for the kind words! It’s basically just at the mercy of whatever version the Minecraft team has posted on their web site. The client in contrast is updated through the Windows Store typically. You can always check what version you’re going to get by going to:
https://www.minecraft.net/en-us/download/server/bedrock
then click the accept button and then click on the Linux Minecraft server. Right now only an hour or two after you posted this I’m getting:
bedrock-server-1.17.10.04.zip
This is exactly how the script works. All it does is download that download page and it checks which version is available publicly and downloads it.
Now open your Bedrock client. The version is always in the bottom right corner in the title screen. 1.17.10 for me. Everything matches. Don’t worry if the client doesn’t show the very last number (the .04 part in this example) as that number seems to be internal to the server/client builds and won’t cause a version mismatch between the two.
There are occasions where the Minecraft team doesn’t upload the dedicated server right when they put the patch on the store. There’s nothing you can do about this. You can’t debug it and the script isn’t making the choice. The script only downloads the publicly posted version of the Minecraft Bedrock server.
Your version #s sound like you are confusing Java with Bedrock to me. The latest version of Java Minecraft is 1.17.1 (not 1.17.2) and the Bedrock dedicated server is on 1.17.10 basically. As far as I can tell there is no such thing as 1.17.2 (yet) on either version (or we passed it a long time ago on Bedrock, at least 8 versions ago) and I would definitely validate those by going to the web page yourself in a browser and seeing what the publicly posted version is as well as open the Bedrock client and check the bottom right corner of the title screen.
If the publicly posted version does not match the version that is on the Minecraft store you will have to wait for them to post it to their web site. I’m guessing in this case this has already happened because the versions I’m seeing right on the public web site don’t match what you posted this morning. When this happens there’s nothing you can do but wait. They did match when I checked just now a few hours later.
The script isn’t “deciding” which version to get. It always just gets the publicly posted version. If you download it yourself in the web browser you’ll also get the same version the script does from the download link. Basically anyone with a dedicated server whether they use these scripts or not will also have to wait for them to post the version publicly because it simply just isn’t available yet. Hopefully that helps!
Hi! Help
./start.sh: line 62: pushd: mine/minecraftbe/world/backups: No such file or directory
rm: cannot remove ‘definitions’: Is a directory
rm: cannot remove ‘structures’: Is a directory
./start.sh: line 62: popd: directory stack empty
Checking for the latest version of Minecraft Bedrock server …
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 303k 0 303k 0 0 767k 0 –:–:– –:–:– –:–:– 766k
Minecraft Bedrock server is up to date…
Starting Minecraft server. To view window type screen -r world
To minimize the window and let the server run in the background, press Ctrl+A then Ctrl+D
Hey ARnine,
That doesn’t look like a valid directory you’re choosing because it doesn’t start with a / and all full Linux paths should.
Try using ~/mine as your installation directory or just ~ because mine/minecraftbe/world/backups is not a real path (or is a relative path). Try that and you should be all set!
Thank you so much! My carelessness.
Don’t sweat it at all, this was also partly my mistake for not validating the path properly for sure since the script is designed to make this pretty easy and straightforward and without proper validation that was not the case. What happened to you can’t happen to anyone else anymore as it will just say “choose a different path” until you go with a valid one or the default path (strongly recommended, and I updated the prompt to also strongly suggest almost everyone should go with the default instead of leave it open ended like maybe you should pick a custom one and give people an unnecessary headache).
Sorry about that, it was a relatively new feature (that I resisted adding because I didn’t want to add things to make it more difficult to use) and even worse things happened to someone who was upgrading an existing server and entered an invalid path. It has been requested for years though and someone even did a pull request for it so I got the message and implemented it. This was a growing pain from adding it but given the number of requests for the feature (and good use cases like a dedicated disk just for the Minecraft server) I think it will be worth it in the end!
I’m very glad you came back to follow up so I know you did succeed despite encountering this and I uploaded the fixes to GitHub a day or two ago to make this much more straightforward to avoid anyone else running into this. Cheers and have fun!
sound silly but restart ubuntu. mine hung just like that and there was still an old version of the server running.
Thank you so much! My carelessness.
Hi James, Derek again. Looks like the start.sh script is getting stuck on “Checking for the latest version of the minecraft bedrock server….” I copied the script and commented out the updating part and it started fine but the MC client won’t allow my son to connect to an outdated server.
Thoughts?
Hey Derek,
No worries, that is an easy fix! The current version doesn’t use wget which is what is freezing. Go ahead and update to the latest using:
curl https://raw.githubusercontent.com/TheRemote/MinecraftBedrockServer/master/SetupMinecraft.sh | bash
and that should take care of it!
Thanks James – that fixed it! So this seems like it ran setup all over again? Does that mean when it now searches for an update it will use curl instead of wget?
Ahh, spoke too soon. I start the server and it seems like it’s running but it doesn’t. Here is what I did:
– ran the curl script you mentioned
– used the name for existing server and placed install in same directory as before
– used same ports for TCP and UDP (defaults)
– start server using start.sh script
When my son attempts to connect to the server, it can’t find it and when I run the stop.sh script, it tells me no server is running. Here is what the start.sh output looks like.
Hey Derek,
It looks like yours is also using a relative path that doesn’t start with /. I think I probably am going to have to start checking the path. The issue is this isn’t the right path and it’s pointing to a place that doesn’t exist (and can’t exist, a folder starting without a / is a relative folder). I really just suggest leaving the install folder the default (~) and then typing the name of your existing server and let the script manage the paths itself. This is how the script used to work and if you’re typing something other than ~ for the path then you are telling it to install to a different place than before. If the path isn’t a fully qualified path (the equivalent of including C:/to/folder on Windows) on Linux it’s definitely not going where you’re expecting.
Technically, your old server path would be /home/yourusername or ~. If you aren’t typing those (or using the safe recommended default) it’s not going to work. If this is an old server from before paths were added you should ALWAYS use the default (~). After that type in your existing server name and the scripts will be updated. The main installation directory it asks you for first is the root directory (which may contain several servers) and should be ~ for everyone unless you’re doing a custom storage setup and putting it on a special drive or something like that. Nobody else should ever change this option or you’re going to get weird errors like this.
This was one of the reasons I didn’t allow a custom directory for so long (literally years) but people kept asking and someone did a pull request so I added it but this was my primary concern and it’s exactly everything I was afraid of so far but I may be able to do some safety checks to help. Almost *everyone* should use the default or you’re going to have issues like this if you don’t 100% understand Linux directories/folder paths/etc. I think I need to probably add some error checking where invalid paths won’t be allowed.
I’ve updated the script to no longer allow picking non-existing root directories, go ahead and try one more time and let’s see if it’s fixed once and for all, and thanks for following up on this as there is stuff I can do to alleviate these problems and I’m committing those fixes thanks to this!
I ran the script again per your suggestion (~ as default install directory) and I only have one directory with Minecraft installed: /home/ubuntu/minecraftbe/mcraft. This is where it installed before. It looks like it overwrote some of what was there because I had a backup start.sh script and it’s gone. There is also a new script called start.sh.save. Unfortunately, the same thing happens when I run the start script but without the errors this time.
Everything looks like it’s working but the minecraft server doesn’t start. I think at this point, I may want to copy the backups, rip out the minecraft is there, install it as fresh as I can and restore the backups (simple as copying them to the backups folder?).
Thanks again for your insight!
Hey Derek,
Thanks for the additional information. That does indeed look much better! I think your theory is correct and that some of your Minecraft server files were deleted/pruned. I bet it left exactly 10 files in the main folder because with all the path wackiness your server folder likely got pruned instead of the backup folder. That is not good, and I updated the script this morning to make sure that it absolutely will not even let you continue until it has a validated path.
Fortunately your “world” files will not be impacted. This would have been the main root of the server folder only and only a couple of files in there (such as server.properties) have anything important in them at all that isn’t the same on every single Minecraft install and they’re easily replaceable. Your output looks great, and I can even see the successful world backup going which tells us the paths are now correct or it would not be able to find the files and show all that output. Now we just need to fix the damage to the old server root container files.
I completely agree with your suggested approach to restore a backup to fix these pruned files. There’s a few different ways you can fix this. Restoring a backup is the easiest and most straightforward way after renaming the old server folder (make sure you have copies of your backups beyond just the ones in the backups folder before changing/moving/doing this). You may need to go back a couple of backups since the backup in the output you just posted probably would be missing some files in the root container theoretically so just make sure the backup you restore is from before these last few runs and from when the server was last working.
You can also create a completely new server and literally copy everything in your existing server folder over the top of it. The only reason I would suggest the backup instead is that some of the files that may have got pruned might be something like server.properties and if that’s the case you’re going to get unexpected behavior. SetupMinecraft.sh / restoring a backup would set up that file again even if it was lost with no problem while the method of just replacing the missing files could miss one or two of these or replace them with stock versions.
Basically if you rename the old server folder and run the script again and put the existing server label you should be able to follow the standard backup restoration instructions in this guide. Definitely let me know if you run into any issues and I will assist but I completely agree with your diagnosis and plans and eagerly await the outcome!
So, we have success and not success. I was able to successfully re-install the game and my son can connect to it but my backups don’t go far back enough. The one thing I didn’t do (which I thought of) was to backup the backups folder (or take a snapshot) when the problem first starting happening. See, my first install of the game over a month ago didn’t allow for nightly start/stops and backups. This meant I had backups from June in my backups folder. When I re-installed the game a few days ago, it didn’t overwrite the backup folder but with all the starting/stopping I was doing to troubleshoot, it eventually filled up my backups folder with new backups, making the older ones obsolete. Grrrrrr!!
I will take note next time – lesson learned. Thanks again for your help James!
Minecraft is critical for kids 🙂 daily/weekly/monthly snaps! What filesystem are you using? ZFS snaps don’t take up that much space.
Hey Derek,
That is fantastic news, I’m so relieved you were able to get up and running! If you still have the old folder I have a tip for you for sure.
Your entire level is stored in one single folder in the old server folder. That is the “worlds” folder, inside of which will be another folder like this:
bedrock@bedrock:~/minecraftbe/test333$ ls
backups fixpermissions.sh start.sh bedrock_server logs stop.sh
bedrock_server_how_to.html minecraftpe structures behavior_packs permissions.json treatments
Dedicated_Server.txt premium_cache valid_known_packs.json definitions release-notes.txt whitelist.json
development_behavior_packs resource_packs worlds development_resource_packs restart.sh world_templates
development_skin_packs server.properties downloads SetupMinecraft.sh
bedrock@bedrock:~/minecraftbe/test333$ cd worlds
bedrock@bedrock:~/minecraftbe/test333/worlds$ ls
'Bedrock level'
Here you can see the folder layout. The “worlds” folder is quite insulated (there’s even another subfolder before you get to any files) and would not have been impacted.
It is safe for you to shut down the server completely (make sure it’s closed and that screen -r doesn’t open anything) and rename the current “worlds” folder and copy the one from your damaged server container to the “new” server’s folder that is working. Leave everything else the same. That should completely restore your world to how it was. That’s just a tip in case significant progress has been lost that you can take that folder and restore it (just like restoring a backup) but we’re restoring an even smaller “piece” from the latest server that is newer than the one we have in your backup instead of restoring the entire server backup. I’ve done this before and it’s easy and safe if you want to give it a try!
I’m really starting to feel like Wooderson from Dazed and Confused: “Alright alright alright!” We were able to successfully restore the old “worlds” folder and his 2 months of progress is there! We are in a great spot now, however, linux doesn’t fully see the server running (see this screenshot for details):
1. the top command shows the bedrock_server running so technically, I can stop it will the kill command but I don’t think this shuts it down gracefully? Hence, does it make a backup?
2. the ./stop script doesn’t work because it doesn’t see the server running
3. screen -r (or -ls) shows no screens to attach to
Digging this deep, I think we’ve discovered the problem that was happening all along: the server is starting but Linux doesn’t fully see it for some reason. What I do know is before I restored the old “worlds” folder, screen -r worked so something must be amiss inside the old “worlds” folder. I am just going to leave it as is for now hoping that the nightly backups work. However, I can’t run any commands on the minecraft server (we were going to whitelist his friends soon) which could be a future issue.
Thanks again James!
Hey Derek,
This partially happens if you start the server with start.sh instead of using:
sudo systemctl start yourserver
then the server’s service will show as “offline” in Linux. However when you use start.sh you should be able to see it using screen -r unless it’s running as a different user than yourself. Did you run start.sh as root like with “sudo ./start.sh” instead of just “./start.sh”? If so it would be running as the root user and you could find it with:
sudo screen -r
You don’t want to run it as the root user. I would say try using the sudo systemctl start/restart/stop yourserver commands and see if that gets it to run as the correct user! Try to kill the bedrock_server process but I don’t believe it can run on it’s own without the screen so the screen must be running as root and can be pulled up with ‘sudo screen -r’ (unless it’s a zombie process possibly, but it looks like it’s active at 50%). SetupMinecraft.sh has a check to make sure you run it as a regular user but I just checked and start.sh doesn’t so it will allow you to do this for the moment (although I am going to add the check in here, it definitely should have one).
The Bedrock server process looks like it’s pegged to me (using close to 50% CPU) so I agree it’s possible something may be wrong with your old world folder but it’s most likely just permissions and not anything serious. I have an idea. Can you run the “fixpermissions.sh” script in your server directory? I am thinking maybe the world folder has the wrong permissions which is common when moving folders / restoring backups.
It would also be worth looking in your “logs” folder. Almost certainly something in there is going to tell us / give us a hint of what is going on I think on this one. I would not be surprised at all to see permissions errors on startup and feel free to post any suspicious looking output you see here. The fixpermissions.sh script will show you the last 5 entries of the logs at the end so I would just run that. You can run the permissions fix script like this from your server folder:
./fixpermissions.sh
and then try starting the server again (making sure that 50% CPU stuck bedrock process is gone/killed first). Someone else earlier today said that a reboot fixed a similar stuck startup issue as well for what it’s worth if all else fails.
Let us know what you find!
So that was it! I was running ./start.sh as sudo but trying to attach the screen as the ubuntu user. I am just so used to ubuntu balking at a non sudo command, lol! All is good now, I run ./start.sh as ubuntu which means I can screen in and run ./stop.sh as well. Woot woot!
Hey Derek,
That’s fantastic, congratulations and thanks for seeing it all the way through! It sounds like you’re all set here, have fun and enjoy and take care!
Hi James – just got your install running on a fresh Ubuntu 20.04 install and am excited to see how easy it is to get running! One thing I did notice however is that this is kind of locked to my “named” user vs. a dedicated “minecraft” user, i.e. a non-login, non-root, non-sudo’ing account. After setup, what changes would I need to make to have this running in its own dedicated user account for both service restarts and server software updates?
Hey Peter,
That’s a great question! The best way is to just run SetupMinecraft.sh again as the user you want to run it as and let it update the scripts with the new user and then run ./fixpermissions.sh. To do it manually the main change you would do to make service account changes would be in:
sudo nano /etc/systemd/system/yourserver.service
You’ll see this line:
[Service]
User=userxname
You’re going to have permissions errors if you start changing stuff like this because whatever user you change it to won’t own the files. Make sure you run the ./fixpermissions.sh script in your server directory (and as the minecraft user, not you, whether using sudo or by logging in as them) otherwise it will go to 50% CPU usage and freeze usually.
If you run start.sh manually it will start as whichever user is logged in (unless you do a sudo -i -u newuser to change identities) but as stated earlier if the user running the server doesn’t own the files it’s going to freeze/have a heart attack. Start.sh would also need to be modified since it tries to take ownership of the server files on startup (but will typically fail if it’s owned by root or a completely different user that doesn’t have +g rights since it’s not running as root).
To do the rest of the scripts manually if you open the templates of start.sh, stop.sh on GitHub if you do all the modifications by hand you would want to replace the userxname with your minecraft user name in the templates of all of your active files but it would be much easier to just run the SetupMinecraft.sh as the correct/new user again and let it set up the service/scripts with the right user name. If you want to modify it by hand you absolutely can by going through the templates and searching for these placeholders and making sure you update each instance on your existing server files.
I definitely don’t know why anyone would do this manually though as changing which user runs the scripts is fundamental enough that you should just run the SetupMinecraft.sh again rather than chase down every place I may have used them etc. because all SetupMinecraft.sh does is download these templates and replace the variables with what you choose during setup. Avoiding manually setting up/changing variables like this every time you want to make a change like a different user (or other configuration changes) is exactly why I created this script in the first place. You don’t have to do that because that is what SetupMinecraft.sh does/is for and will do it for you. Let it just replace the important bits in the templates and you’re good to go without worrying about whether you got every single instance etc. which is exactly the problem this script is meant to solve basically (and was written with the ability to safely update old servers instead of new ones to apply changes since they installed / changes to the environment like which user is running it).
Basically, it’s designed to do this for you safely in a nutshell (as long as you run it as the user you want running the server and then run ./fixpermissions.sh as that user as well to take ownership of the server files). You can absolutely do this and it’s one of the advantages of not just running it as root all the time (outside the obvious security implications). Having a dedicated service account is a positive step even beyond that (vs. running it as another normal user that almost certainly has additional rights not necessary for the Minecraft server) and I highly approve! Hopefully that helps!
I’ve been using this for awhile on ubuntu 18. It worked beginning of june, now it won’t start. I tried the setup again and no-go. It does the backup, but get stuck at: “checking for latest version of Minecraft Bedrock server”. Nothing has changed in the system
Hey Matthew,
That sounds like a old version and probably the same problem Derek is having as well. I would run the latest SetupMinecraft.sh script with:
curl https://raw.githubusercontent.com/TheRemote/MinecraftBedrockServer/master/SetupMinecraft.sh | bash
and that will get the latest versions that don’t use wget so they can’t freeze like this!
Got it. I restored a snapshot and it still didn’t work. I reran the setup a couple more times but it kept hanging like it did for ARnine
. I noticed that the Minecraft client was listing an old minecraft server, but it wouldn’t show in screen -r. I rebooted my Ubuntu VM, ran setup, rebooted again and surprise, it worked. I hope this helps someone. Thank you to James Chambers for being responsive and maintaining the setup and blog; my kids love having their own server.
Hey Matthew,
How strange! I’m actually very glad you posted this because it may save several people hours of time if they try it and it gets something unstuck!