Raspberry Pi Minecraft Server Setup Script w/ Startup Service

Minecraft 1.17 - Caves and Cliffs Update
Minecraft 1.17 – Caves and Cliffs Update

Minecraft 1.17 (Caves and Cliffs Update) is here! This script and guide are written to help you get a great performing Raspberry Pi Minecraft server up and running in only a few minutes.

This is the standalone version. It runs on most flavors of Linux and should work on most architectures as well (arm, aarch64, etc.).

I highly recommend using Docker over the standalone version for most people. Installing Docker is as simple as sudo apt install docker.io. There are 3 Docker options available:

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 fully operational Minecraft server in a couple of minutes
  • Runs the highly efficient “Paper” Minecraft server
  • Raspbian / Ubuntu / Debian distributions supported
  • Installs and configures OpenJDK 18
  • Sets up Minecraft as a system service with option to autostart at boot
  • Automatic backups to minecraft/backups when server restarts
  • Updates automatically to the latest version when server is started
  • Easy control of server with start.sh, stop.sh and restart.sh scripts
  • Optional scheduled daily restart of Pi using cron

Requirements

  • Raspberry Pi model with 1 GB of RAM or higher. Basically a Raspberry Pi 2B or higher. (No Zero unfortunately, 512MB is not enough RAM to do this, I’ve tried!)
  • Headless Linux distribution such as Raspbian Buster Lite, Ubuntu Server 18.04.2, or any Debian based distribution (GUI distros can be used at the expense of available RAM and server performance)
  • Solid state drive highly recommended but not required.
    You can get a SSD setup on a Pi for less than most Micro SD cards cost. See my article here for details
  • If using MicroSD you want to be using a high range card otherwise you will really be hurting on IO when the server is reading/writing chunks of terrain! Click here for MicroSD card benchmarks/recommendations.

Recommended Gear

Minecraft Java for PC
Minecraft Java for PC / Mac / Linux*
Raspberry Pi 4
Raspberry Pi 4

The Raspberry Pi 4 is available in different memory configurations all the way up to 8 GB. It’s about the size of a credit card and uses an extremely low amount of power making it ideal for all sorts of projects and ideas!

Links: Amazon.com*, AliExpress*, 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*

Raspberry Pi 400 Kit
Raspberry Pi 400 Kit

The Raspberry Pi 400 kit includes everything you need for a full Pi 400 desktop build. The Pi 400 is the fastest Raspberry Pi ever released and comes in the form factor of a keyboard!

Links: Amazon.com*, AliExpress*, 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*

Kingston A400 SSD
Kingston A400 2.5″ SATA SSD

The Kingston A400 has been a great drive to use with the Pi for years. It’s 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 pibenchmarks.com and is the #1 most popular SSD among the Pi 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*

StarTech 2.5" SATA to USB 3.0/3.1 Adapter
StarTech 2.5″ SATA to USB 3.1 Adapter

The USB 3.1 variant of the StarTech 2.5″ SATA adapter works well with the Pi 4. The USB 3.0 variant doesn’t have firmware updates available and is not recommended.

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*

SD Card Setup:

SanDisk Extreme A1
SanDisk Extreme A1

The SanDisk Extreme A1-A2 SD card has the best scoring SD card on Pi Benchmarks for years and is second in popularity only to the SanDisk Ultra (often included in combo kits). The application class (A1) means random I/O speeds (very important when running an OS) have to meet a higher standard. There’s no benefit on the Pi for A2 right now so get whichever is cheaper/available.

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*

Choosing a Linux Distribution

The most important consideration when choosing which flavor of Linux to run the server on is simple: available RAM. Headless Linux distributions such as Raspbian Lite that don’t have a built in GUI have

Our biggest obstacle when running a Minecraft server on the Pi is available RAM since 1 GB is extremely low for this type of server. To have a playable experience you should not be running anything else on the Pi so all memory is available to be used.

After testing on many different distros I am finding Raspbian Lite and Ubuntu Server 18.04.4 32-bit to be the best choices. These distributions come with very few background processes and have rock solid support and performance.

64-bit vs 32-bit

There’s a lot of discussion in the Pi world about the up and coming aarch64 64-bit distributions vs. armhf 32-bit distributions. They have been and continue to improve dramatically. There are already use cases where 64-bit is far superior such as video encoding, advanced compression, etc.

So how about for running a Minecraft server? I have been testing extensively with Ubuntu Server 18.04 64-bit and the Debian Buster 64-bit. I have consistently had worse performance and stability than on 32-bit versions of the exact same distros.

But how can that be? It’s certainly true that Minecraft servers benefit in CPU performance from 64-bit versions of Java. The answer is actually incredibly simple: memory. The server running on a 64-bit Java Virtual Machine uses a minimum of about 100 MB more memory. This makes perfect sense because 64 bits > 32 bits by definition!

The Raspberry Pi’s 1 GB of memory has been the biggest obstacle for this project since the very beginning. Back when I first went into the Paper Minecraft developer IRC room and told them what I was trying to do I was practically laughed out of the chat room for even thinking of trying this. Most Minecraft server branches including vanilla can’t even start on the Pi because of the limited memory.

For a dedicated Minecraft server on the Pi I very highly recommend staying 32-bit. You will have more available memory which means it will be much faster and more stable. Since memory is our bottleneck the increased CPU throughput does not help us and losing *any* of our memory is disastrous!

If the Raspberry Pi 4 has more memory like we all expect it to this recommendation will change completely. Even 2 GB of memory would make the extra memory that 64-bit uses a non-issue and the CPU throughput performance gains very desirable. For now though stay 32-bit for a Minecraft server!

Tested Distributions

Raspberry Pi OS – It’s Raspbian. It has very low memory usage and is the official distribution of the Raspberry Pi. The server runs very well on this. It’s overall the best choice. The Buster release has made OpenJDK 11 available on it so it’s no longer behind the rest of the distros.

Ubuntu Server 18.04 / 20.04 – Ubuntu Server is my favorite Linux distro. I use it for nearly all of my projects. The performance of the 32-bit armhf version is on par with Raspbian. It’s a great choice! Click here for my Ubuntu setup guide for Raspberry Pi. The 64-bit version is not a fantastic choice and not recommended because of the higher memory usage. Stick with 32-bit and you’ll be a happy camper with Ubuntu Server.

Debian Buster 64-bit – Debian is the distribution Raspbian is based on. This version is a preview of Debian “Buster” which is the successor to Stretch and will be the next version of Raspbian when it is released. I like this distribution but it is currently still unofficial and unsupported. Performance and stability was less than Ubuntu and Raspbian.

Minecraft Server Installation

SSH into your Raspberry Pi and paste the following commands:

curl https://raw.githubusercontent.com/TheRemote/RaspberryPiMinecraft/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.

“Enter amount of memory in megabytes to dedicate to the Minecraft server” – The amount of memory that will be dedicated to the Minecraft server. The more the better, but you must leave some room for the operating system background processes.

If you exceed the total available memory either the server will crash or the Pi will get incredibly slow to the point where your SSH session will start timing out. The setup script will make a recommendation to you which is your available memory – 10% for headroom. If you aren’t sure what to put just go with the recommended amount.

Note for Raspberry Pi 4: Currently on 32-bit Raspbian 2700 MB is the maximum that Linux will let us allocate in a 32 bit environment. The script has been updated to check for this as the server will not start if it is set over 2700M on a 32 bit server. 64 bit operating systems will be able to allocate all available memory as Pi 4 support rolls out for them.

“Start Minecraft server at startup automatically (y/n)?” – This will set the Minecraft service to start automatically when your Pi boots. This is great because whenever you want to play you can just plug it in and go without having to SSH in.

“Automatically reboot Pi and update server at 4am daily (y/n)?” – This will add a cron job to the server that reboots the Pi 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!

Check Java Version

Sometimes if you have multiple versions of Java installed the wrong version of Java will be selected as the default. If the server didn’t start check that the right version of Java is selected with this command:

sudo update-alternatives --config java

If you get the message “update-alternatives: error: no alternatives for java” then you only have one version of Java installed and can skip to the next section.

If you are presented with a list of choices then your machine has multiple versions of Java installed. It will look like this:

update-alternatives: warning: /etc/alternatives/java has been changed (manually or by a script); switching to manual updates only
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1101      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1101      manual mode
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

You will usually want to just select the newest version of OpenJDK that is listed so you would type 0 and press enter. In some cases on some platforms you may want to switch to the official Oracle JDK although I strongly recommend sticking with OpenJDK!

First Run

The first time you run the server it will take a little longer to start since it is generating all the server data. If you try to log in before it fully starts you will get a connection timeout error. Watch for the line: “Timings Reset”. This is the last line that prints when the server is ready to rock and roll. At this point you will be able to connect successfully.

The very first time you log into the server it will be slow for about 1-2 minutes. This is because since nobody has logged in before the server has to scramble to generate all the chunks within your view distance (10 by default) and send them to you/store them. During this time you may not be able to see very far and if you try to destroy blocks there will be noticeable lag from when they break to when they actually disappear.

Don’t panic! This will go away within a couple of minutes as the Pi catches up with all the first time login stuff it needs to do. Performance stabilizes and it will feel very much like the offline experience after that.

If you are hosting for a few friends I’d recommend logging in for the first time right after you set up the server instead of having several people nail a blank server at first startup. This gets it out of the way and when everyone is ready to log in the starting area chunks will be fully fleshed out and the Pi just has to read them. It’s an order of magnitude faster for the Pi to read chunks than to generate and store chunks.

In my experience after the initial login exploring new parts of the server doesn’t cause any lag even though new chunks are being generated. The reason for this is that when you’re walking it’s really only having to generate a new chunk as you get close to the border instead of a huge square area of chunks in all directions and all at the same time like during the first login.

Benchmarking / Testing Storage

If you’re getting poor performance or just want to verify everything is working correctly you may want to run my storage benchmark with:

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

If you search for the model of your drive on pibenchmarks.com you can compare your score with others and make sure the drive is performing correctly!

Changing Minecraft Server Version

To override the default version let’s grab a copy of the script locally:

wget https://raw.githubusercontent.com/TheRemote/RaspberryPiMinecraft/master/SetupMinecraft.sh 
nano SetupMinecraft.sh

Now make these changes from inside nano:

Version="1.16.5" 
AllowLocalCopy="1"

Now press Ctrl+X to exit nano and answer “y” to save. Now let’s run the script:

chmod +x SetupMinecraft.sh
./SetupMinecraft.sh

And the setup will run and install the version of Minecraft you set at the top of the file!

Changing Minecraft Client Version

If you are wisely running the “stable” branch instead of the “development” branch there will be times where you need to select the version of Minecraft to run otherwise you will get an error message that your client is outdated when you try to log in.

Fortunately this is very easy. Open up the Minecraft launcher and instead of hitting “Play” choose “Launch Options” in the menu at the top of the window. It will look like this:

Minecraft launch options
Minecraft Launcher “Launch Options” Tab

Click the “Add new” button and pick which version you want to add. You can optionally gave it a name or just click save.

Now when you go back to the “News” tab you will see a dropdown arrow where you can select which version of Minecraft you want to play!

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 ~/minecraft
./start.sh
./stop.sh
./restart.sh

-OR-

sudo systemctl start minecraft
sudo systemctl stop minecraft
sudo systemctl restart minecraft

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 ~/minecraft/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 ~/minecraft
./stop.sh
rm -rf world world_nether world_the_end
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 Pi periodically just in case the Pi’s storage fails.

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 Pi. The Minecraft one will look like the following:

0 4 * * * /home/ubuntu/minecraft/restart.sh
cron options

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.

Installing Mods / Plugins

The server supports plugins that are compatible with Bukkit / Spigot / Paper. A popular place that you can get plugins is at dev.bukkit.org where there are thousands of them!

To install a plugin you simply download the .jar to the minecraft/plugins folder and restart the server. For example, WorldGuard is a very popular plugin that lets you add protection to different areas of your server.

To install this plugin on our Minecraft server we would use the following commands:

cd ~/minecraft/plugins
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.12.212 Safari/537.36" -o worldguard.jar https://dev.bukkit.org/projects/worldguard/files/latest
sudo systemctl restart minecraft

The reason the middle line is so long is that “robots” (roughly anything that isn’t a web browser being used by a user in this context) including scripts and utilities are blocked by the Bukkit server. The extra parameters we’re including in this line will add the location (-L) flag as well as a user agent and an identity / language header which will allow us to fetch the files without getting a 403 forbidden error.

Make sure to change “-o worldguard.jar” (second to last parameter) and the URL (very last parameter) to match the project you want to download.

The server will restart and the plugin will be installed. It’s that simple! To use the plugin refer to the documentation on the plugin download page to find out which commands you use to configure/interact with it.

Warning: be advised that plugins are the #1 issue for performance degradation on Minecraft servers. This isn’t because all plugins are bad. Some plugins are coded very inefficiently or perform features that require a lot of hooks in the code.

You should be careful about what plugins you install on the server and if you start having bad performance disable your plugins one by one until you find the culprit!

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 25565. The type of connection is TCP if your router asks. 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!

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.

Upgrading

PLEASE BACK UP YOUR SERVER FIRST! The server makes automated backups by default for you in the backups folder but I recommend you back up the entire server folder yourself (basically the entire minecraft folder) any time you attempt to upgrade or downgrade. If you need to roll back to older versions it won’t work without a backup from that version or older!

The easiest way to upgrade an installation is to download the latest SetupMinecraft.sh and run it. This will automatically upgrade you to the latest version.

Upgrading and downgrading to versions that aren’t the default the script chooses is pretty simple. Simply change the Version line at the top in the SetupMinecraft.sh script:

#!/bin/bash
# Minecraft Server Installation Script - James A. Chambers - https://jamesachambers.com
# More information at https://jamesachambers.com/raspberry-pi-minecraft-server-script-with-startup-service/
# GitHub Repository: https://github.com/TheRemote/RaspberryPiMinecraft

# Minecraft server version
Version="1.16.1"

Edit this file in your favorite text editor (you can use nano or vi on the Pi like nano SetupMinecraft.sh) and change the Minecraft version to what you want.

Downgrading

PLEASE RESTORE USING A BACK UP FROM THE VERSION YOU ARE DOWNGRADING TO

If you are having problems on a newer version of Minecraft and want to downgrade you can do so using a complete backup of your server before you ran it on a newer version.

The reason you can’t take server data that has been touched by a version such as 1.17 and go back to 1.16 is that the new version adds all sorts of new data types/structures for the new content into your server data files. If you try to roll back the old versions of the Minecraft server will not understand these data types since they didn’t exist in that version and will crash.

As long as you use a backup for your server files from that version (or older) it’s as simple as changing the version in SetupMinecraft.sh just like I show in the “Upgrading” section.

You can upgrade any old version of Minecraft to any version, but again make sure you have a backup first as it is a one way street and you will need that backup if you want to roll back!

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.

Version History

To view the version history check out the GitHub README here:

Update History – RaspberryPiMinecraft – Official GitHub Page

Other Resources

If you’re trying to set up SSD / USB storage booting check out my Raspberry Pi USB booting setup guide

For benchmarks and recommendations on the fastest storage drives/adapters for the Raspberry Pi check out my 2021 Storage Roundup

If you’re having firmware issues and need to update/restore your firmware check out my Raspberry Pi firmware guide here

Subscribe
Notify of
guest

1.1K Comments
Inline Feedbacks
View all comments
Carl Engelhardt
Carl Engelhardt
2 years ago

Hi is it possible to run this skript on a x64 ubuntu disto

Carl Engelhardt
Carl Engelhardt
2 years ago

nice thank you

(great skript had it on my raspi and would it extend to an old but more powerfull pc )

CardinalFang36
CardinalFang36
2 years ago

James,

My server did not start last night. Manually attempting to run the java command line, I get:

Unsupported Java detected (62.0). Only up to Java 17 is supported.

My Mac informed me that it was installing a new version of Java today, so I am suspecting the same happened with my RPi.

Tom

CardinalFang36
CardinalFang36
2 years ago

James,

The Mac has nothing to do with this…just a coincidence that it (and every other machine I own) wanted to update Java today. The error message was from my Raspberry Pi (running the Minecraft server and your script)

CardinalFang36
CardinalFang36
2 years ago
Reply to  CardinalFang36

I reran curl https://raw.githubusercontent.com/TheRemote/RaspberryPiMinecraft/master/SetupMinecraft.sh | bash and then did start.sh and it is up and running again.

It seems Setup loads the custom OpenJDK. I wonder how the JDK was altered? Does start.sh do that as well?

CardinalFang36
CardinalFang36
2 years ago

Yesterday (or whenever the server stopped), my start.sh didn’t have the fully qualified path to the custom Java binary. But now it does. I suspect that was fixed when I re-ran SetupMinecraft.sh.

Gruntzilla
Gruntzilla
2 years ago

(In my best GeorgeNotFound voice: “Jaaaaaaaaaaaaaaaaaaaaaaaaaaaaaames…”)
Back again, the children are bored of SMP and Bedrock’s world downloads / command mods are not cutting the mustard! (The Bedrock SMP on oracle runs flawless since the ip change / firewall thing, but I sometimes think that 1gb RAM is a problem too.)

The ssh / server startup works great, looks fine on the server itself, but sure enough, “Unable to connect to world”… so here’s the back-story and a few refreshers, in case you can help, (or in case me spelling it out points me at some more comment threads below all over again!)
I’m catering to a bunch of 6 year olds with ipads and a couple laptops, so, clients are going to be bedrock.

I got really brave, and used this guide to set myself up 1 (of 2 to come?) Ampere/ARM 2 core / 12GB RAM oracle cloud servers using this guide (for the oracle config, not the java/minecraft setup.) I also chose Ubuntu 20.04 instead of their suggestion, because I remembered from your last guide. Unfortunately it only allows 64 bit, (but, since your guide says 32bit is mostly due to 1gb RAM performance, I selectively decided to trudge forward.
I used the Oracle Developer Blog guide.

I created my own users like you recommended from the bedrock server guide, (maybe something changed, but this time around it was behaving odd and automatically asked for password after the first command, and the next 2 lines failed with ‘already created’ and started asking for passwords instead of SSH, but I sorted all that out and it’s working fine anyway.

sudo adduser minecraft
sudo mkdir /home/minecraft
sudo usermod -d /home/minecraft minecraft

I tried using that account without being in sudoers, but it seems like this script depends on the extra permissions? correct me if I’m wrong, I can go back and try again and get the errors, but promoting the account seems to have created a perfect install anyway.

So, once promoted, I ran the install script flawlessly, everything looked perfect server runs great. (Coming back to this step later, I realized it doesn’t connect here either though.)

Used this (pi/java) guide for plugins to fire up some Bedrock connectivity, installing GeyserMC, and Floodgate for MS/xbox auth. those command lines (pasted in full below) also worked flawlessly
Navigated to minecraft/plugins and and ran these 2 lines,then fired up the server again.

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.12.212 Safari/537.36" -o floodgate-Spigot.jar https://ci.opencollab.dev/job/GeyserMC/job/Floodgate/job/master/lastSuccessfulBuild/artifact/spigot/target/floodgate-spigot.jar
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.12.212 Safari/537.36" -o Geyser-Spigot.jar https://ci.opencollab.dev/job/GeyserMC/job/Geyser/job/master/lastSuccessfulBuild/artifact/bootstrap/spigot/target/Geyser-Spigot.jar

Amidst the firewall changes below, I also updated the same ports in server.properties and Geyser-Spigot/config.yml
(I tried setting an IP in both of those too, but they seemed to suggest blank/auto worked better in the comments, and taking them out

burned a few hours trying iptables commands but I noticed they didn’t seem to do anything, so I switched to UFW
Added the same Ingress rules to Oracle (UDP+TCP), and again in UFW allow in for each of the entries below (spread across a horrible amount of attempts to add reboot open/connect/fail/close minecraft.)

25565/tcp ALLOW IN Anywhere (java default?)
25565/udp ALLOW IN Anywhere
22333/tcp ALLOW IN Anywhere
22333/udp ALLOW IN Anywhere
19132/tcp ALLOW IN Anywhere Geyser seems to default to taking over 19132 by default, but I managed to change that (to no advantage.)
19132/udp ALLOW IN Anywhere
19133/tcp ALLOW IN Anywhere
19133/udp ALLOW IN Anywhere
19888/tcp ALLOW IN Anywhere
19888/udp ALLOW IN Anywhere (19888 is actually the port I chose to make the actual oracle/bedrock server finally work last time, but no joy)

(Geyser is some kind of magical bedrock > Java client command translating proxy, and floodgate apparently handles the MS/xbox live account client authorization for java servers)

just for reference, I’m going to paste the console output for the paper/geyser/floodgate startup just because it pointed me at a few port settings even though it didn’t work.

the 0.0.0.0 near the end is just default, and changing it tanks server startup with pages of weird java packag/zip errors that I won’t get into. (The comments in the file say ‘leave it’ anyway.)
Starting org.bukkit.craftbukkit.Main
System Info: Java 17 (OpenJDK 64-Bit Server VM 17.0.2+8) Host: Linux 5.13.0-1025-oracle (aarch64)
Loading libraries, please wait...
[01:59:36 INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[01:59:38 INFO]: Loaded 7 recipes
[01:59:40 INFO]: Starting minecraft server version 1.18.2
[01:59:40 INFO]: Loading properties
[01:59:40 INFO]: This server is running Paper version git-Paper-284 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT) (Git: e42d683)
[01:59:40 INFO]: Server Ping Player Sample Count: 12
[01:59:40 INFO]: Using 4 threads for Netty based IO
[01:59:40 INFO]: Default game type: SURVIVAL
[01:59:40 INFO]: Generating keypair
[01:59:40 INFO]: Starting Minecraft server on *:25565
[01:59:40 INFO]: Using epoll channel type
[01:59:40 INFO]: Paper: Using libdeflate (Linux aarch64) compression from Velocity.
[01:59:40 INFO]: Paper: Using OpenSSL (Linux aarch64) cipher from Velocity.
[01:59:40 INFO]: [floodgate] Loading floodgate v2.1.0-SNAPSHOT
***** This warn is a known (and non-) issue ******** [01:59:41 WARN]: [floodgate] en_ is not a supported Floodgate language.
[01:59:41 INFO]: [floodgate] Took 543ms to boot Floodgate
[01:59:41 INFO]: [Geyser-Spigot] Loading Geyser-Spigot v2.0.2-SNAPSHOT
[01:59:41 INFO]: Server permissions file permissions.yml is empty, ignoring it
[01:59:41 INFO]: Preparing level "world"
[01:59:47 INFO]: [floodgate] Enabling floodgate v2.1.0-SNAPSHOT
[01:59:48 INFO]: [Geyser-Spigot] Enabling Geyser-Spigot v2.0.2-SNAPSHOT
[01:59:48 INFO]: [Geyser-Spigot] Auto-loaded Floodgate key
[01:59:48 INFO]: [Geyser-Spigot] ******************************************
[01:59:48 INFO]: [Geyser-Spigot]
[01:59:48 INFO]: [Geyser-Spigot] Loading Geyser version 2.0.2-SNAPSHOT (git-master-0803c5d)
[01:59:48 INFO]: [Geyser-Spigot]
[01:59:48 INFO]: [Geyser-Spigot] ******************************************
[01:59:51 INFO]: [Geyser-Spigot] Loaded Floodgate key!
[01:59:51 INFO]: [Geyser-Spigot] Started Geyser on 0.0.0.0:19888
[01:59:51 INFO]: [Geyser-Spigot] Done (3.007s)! Run /geyser help for help!
[01:59:51 INFO]: Running delayed init tasks
[01:59:51 INFO]: Done (11.871s)! For help, type "help"
[01:59:51 INFO]: Timings Reset

Running out of night owl-hours, so I thought summing it up for myself for a restart point was a great chance to get a second opinion anyway, would love it if you spotted anything I clearly just missed.
I think tomorrow I’ll see if I can replicate the firewall swap last time and maybe uninstall UFW to install firewalld (though I swear I did the opposite last time). So far getting of 19132 to 19888 wasn’t the perfect fix I hoped, (but since there are more ports in play now, I wonder if I didn’t put the right variants in the right places.

Thanks for your amazing guides anyway, Starting to feel amateur-hour ‘comfortable’ with committing Ubuntu command line stuff to memory as a side benefit!!!

James A
James A
2 years ago

@James – Have you looked at Purpur ( purpurmc.org ) – instead of paper? drop-in replacement form of paper?

James A
James A
2 years ago

Nothing in particular, it appears to be a pretty popular replacement for paper so the performance will be similar to that of paper, and may be better. Given the limited resources of an rPI that seemed like a good idea.
I may end up switching off of rPI onto another machine to run Forge though. My kids keep asking for specific Forge mods they’ve seen online, and there are quite a few that are only Forge and dont work as a bukkit/spigot/paper plugin.

kevin
kevin
2 years ago

Hi,

about one week ago my server suddenly stopped working after running fine for about 5 months (last updated the minecraft-version when 1.18 was released). I first thought it was about the new jdk which was released few time ago, but after updating it my server still doesn´t start. I already reinstalled but still nothing changed. When i try using the start.sh i get an error which is like “tail: ” cannot be opened for reading: file not found” (which is translated from german, i don´t know how the original translation would look like…). I ran out of ideas how to fix my issue and i hope you can help me.

Thanks.

Kevin
Kevin
2 years ago

Hi James,

you were right. It was about the JDK version. I had JDK 18 installed, so i manually installed JDK 17. The server was still not starting so looked into the start.sh file and guessed that it was about your JDK installation. I edited the “/home/…/java” to “java” in the last line so the script uses my installation now. After doing this the server immediately started and is running fine.
Thanks for your help.

Kevin
Kevin
2 years ago

Hi,

I´m pretty aware of the security issues and I´m also still not very happy with my solution. I´m running Raspbian (Linux version 5.10.103-v8+ (aarch64-linux-gnu-gcc-8 (Ubuntu/Linar o 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34)) on a RPI 4B with 4GB RAM.
The thing with other applications using this installation of JDK is not a problem because this RasPi is only being used for the Minecraft Server and has a Samba Client running in background.
As you´ve said I will just leave it as it is, because the server is currently running fine without any problems, but if I´ll run into any problems I guess I´ll come back to you.

Kevin
Kevin
2 years ago

Just another thin I thought about: is it maybe possible I have to unzip the jre? And I just tried to start the server manually with a .sh file I created and it says for the java file “file not found”. As a path I put “/home/…/minecraft/jre/bin/java”. I don´t get an error for the paperclip.jar (could be because the error with the java occurs first). Maybe you have another idea.

Kevin
Kevin
2 years ago

Hey,

so I just reinstalled the server. I ran SetupMinecraft.sh and after giving it a closer look while installing i noticed a few errors. The whole log with me installing it:

pi@piserver:~ $ curl https://raw.githubusercontent.com/TheRemote/RaspberryPiMinecraft/master/SetupMinecraft.sh | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 16173 100 16173 0 0 48133 0 --:--:-- --:--:-- --:--:-- 47991
Minecraft Server installation script by James A. Chambers - https://jamesachambers.com/
Version 1.18.2 will be installed. To change this, open SetupMinecraft.sh and change the "Version" variable to the version you want to install.
Latest version is always available at https://github.com/TheRemote/RaspberryPiMinecraft
Don't forget to set up port forwarding on your router! The default port is 25565
Installing screen, sudo, net-tools, curl...
OK:1 http://archive.raspberrypi.org/debian buster InRelease
OK:2 http://raspbian.raspberrypi.org/raspbian buster InRelease
Holen:3 http://giteduberger.fr rpimonitor/ InRelease [1.933 B]
Es wurden 1.933 B in 1 s geholt (2.208 B/s).
Update rpimonitor Packages Status
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
curl ist schon die neueste Version (7.64.0-4+deb10u2).
screen ist schon die neueste Version (4.6.2-3+deb10u1).
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
net-tools ist schon die neueste Version (1.60+git20180626.aebd88e-1).
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Enter root directory path to install Minecraft server. Almost nobody should change this unless you're installing to a different disk altogether. (default ~):
Directory Path:
Directory Path : /home/pi -- accept (y/n)?y
Directory Path: /home/pi
Creating minecraft server directory...
Installing OpenJDK...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 691 100 691 0 0 1808 0 --:--:-- --:--:-- --:--:-- 1813
100 42.5M 100 42.5M 0 0 1673k 0 0:00:26 0:00:26 --:--:-- 2045k
main: Zeile 220: [[: main: Zeile 219: /home/pi/minecraft/jre/bin/java: Datei oder Verzeichnis nicht gefunden: Syntaxfehler im Ausdruck. (Fehlerverursachendes Zeichen ist \": Zeile 219: /home/pi/minecraft/jre/bin/java: Datei oder Verzeichnis nicht gefunden\").
main: Zeile 220: [[: main: Zeile 219: /home/pi/minecraft/jre/bin/java: Datei oder Verzeichnis nicht gefunden: Syntaxfehler im Ausdruck. (Fehlerverursachendes Zeichen ist \": Zeile 219: /home/pi/minecraft/jre/bin/java: Datei oder Verzeichnis nicht gefunden\").
OpenJDK installation completed.
Getting total system memory...
Total memory: 3845 - Available Memory: 3659
Total memory: 3845 - Available Memory: 3659
Please enter the amount of memory you want to dedicate to the server. A minimum of 700MB is recommended.
You must leave enough left over memory for the operating system to run background processes.
If all memory is exhausted the Minecraft server will either crash or force background processes into the paging file (very slow).
INFO: You are running a 64-bit architecture, which means you can use more than 2700MB of RAM for the Minecraft server.
Enter amount of memory in megabytes to dedicate to the Minecraft server (recommended: 3359): 3359
Amount of memory for Minecraft server selected: 3359 MB
Getting latest Paper Minecraft server...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 323 100 323 0 0 1736 0 --:--:-- --:--:-- --:--:-- 1736
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 33.1M 100 33.1M 0 0 1204k 0 0:00:28 0:00:28 --:--:-- 1378k
Building the Minecraft server...
bash: Zeile 343: jre/bin/java: Datei oder Verzeichnis nicht gefunden
Accepting the EULA...
Grabbing start.sh from repository...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 11366 100 11366 0 0 34338 0 --:--:-- --:--:-- --:--:-- 34234
Grabbing stop.sh from repository...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1631 100 1631 0 0 4839 0 --:--:-- --:--:-- --:--:-- 4839
Grabbing restart.sh from repository...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2205 100 2205 0 0 4418 0 --:--:-- --:--:-- --:--:-- 4410
Grabbing fixpermissions.sh from repository...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1579 100 1579 0 0 4799 0 --:--:-- --:--:-- --:--:-- 4799
Grabbing update.sh from repository...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 607 100 607 0 0 1914 0 --:--:-- --:--:-- --:--:-- 1914
Enter a name for your server...
Server Name: PiServer
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 311 100 311 0 0 977 0 --:--:-- --:--:-- --:--:-- 981
Minecraft can automatically start at boot if you wish.
Start Minecraft server at startup automatically (y/n)?y
Your time zone is currently set to Europe/Berlin. Current system time: Mi 6. Apr 18:58:40 CEST 2022
You can adjust/remove the selected reboot time later by typing crontab -e
Automatically reboot Pi and update server at 4am daily (y/n)?y
Daily reboot scheduled. To change time or remove automatic reboot type crontab -e
Setting server file permissions...
tail: '' kann nicht zum Lesen geöffnet werden: Datei oder Verzeichnis nicht gefunden
Setup is complete. Starting Minecraft server...
Server has failed to start after 30 seconds.

To translate the german parts for you:
"Datei oder Verzeichnis nicht gefunden" (like at the installation of the JDK or after 'Building Minecraft Server') - "File or directory not found"
"Zeile" - line
"Syntaxfehler im Ausdruck" - "Syntax error in expression"

As you can maybe see I am using something called rpimonitor, which is just a little tool I use to see the status of my server. It is headless and so I can easier see how my Pi is doing wthout SSH into it.

The errors seem kind of interesting and I can´t really explain to me where it comes from.
I hope you do and maybe it helps you to find the problem I have..

Kevin
Kevin
2 years ago

I downloaded again, but the errors I got were the same. The jre file contain everything it needs to (as far as I know).
Here are some excerpts of what I´ve got:

pi@piserver:~ $ ls minecraft/jre
bin conf legal lib NOTICE release
pi@piserver:~ $ ls minecraft/jre/bin
java jfr jrunscript keytool rmiregistry

Looking at this the error “file not found” error doesn´t make any sense to me. I will test out tomorrow if my locale is the problem by changing system language. When I get any results I will tell you.
Till then, have a good one.

AgentSmithJR
AgentSmithJR
2 years ago

For a while my server was running *ok*.
It’s on an old 3B+ i think, basically the only way it would work was if i dropped the render distance down to like 1 chunk.
It stopped randomly, errored when i tried to run start.sh again.
Now I’ve been trying to reinstall the script, but it’s telling me there’s a minimum value=600 for the memory?
Can this be changed?

AgentSmithJR
AgentSmithJR
2 years ago
Reply to  AgentSmithJR

I think I found the problem, but I also found a workaround for the 600mb issue.
I used a text editor to change the ./start.sh file, towards the end of the file the xm600 -> lower.
The actual issue in the logs was that the render distance had to be between 2-32, when mine was 1.
Must have been a Java update which changed that recently.
But I changed the server.properties file to 2 and its back up and running.

Markus
Markus
2 years ago

After an update (supposedly an apt-update last evening) today my minecraft server wasn’t starting anymore. “systemctl status minecraft” just gave a blant “failed_error” with no further hints.
My kids want to stay on version 1.18.1, so I could not update right away.
The solution was to list all “openjdk” versions installed on the system using this command:
snap list openjdk –all
This gave a table with version 17.0.2+8 (Rev 817) and versio n 18+36 (Rev 841). So I remembered the revision of version 17 and set this revision to active:
sudo snap revert openjdk –revision 817
After this was finished I was able to start the minecraft server service just as before.
I’m leaving this here for documentary purposes.
Great work, you gave my kids a great time und made me a very happy father (and now also a hero)!

1 39 40 41 42 43 48