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

1,112 thoughts on “Raspberry Pi Minecraft Server Setup Script w/ Startup Service”

  1. Avatar for Sergio

    Hey, my server has been working for 2 months or so. Three days ago, the server didnt start after the reboot at 04:00 AM. I tried to boot it directly from start.sh but didnt work, and i dont get any error message. The only info i found is this photo:

    Failed to Start Minecraft Service

    Thanks

    1. Avatar for James A. Chambers

      Hey Sergio,

      It looks like it’s timing out during the startup operation. This can happen if it’s an extra slow SD card or a extra large server for sure. How long did you wait when using start.sh? That one shouldn’t time out and should actually sit forever theoretically (if you type screen -r you should see the backup process underway which in your log was also underway and then looked like it was cut off by the timeout) if something weird is going on.

      Did it used to start in like < 30 seconds like average and then this just happened? If that's the case the SD card or partition tables might be corrupted. It might also just be the server itself is corrupted. You could try restoring a backup and see if that runs normally. I'd definitely make sure you save some of your backups out of the backup folder because if it got corrupted (commonly for Pi if it lost power during a write for example) you may need to go back before it started in some cases. In other cases it just needs a reinstall of Raspberry Pi OS if it's the whole partition that is having trouble. I would definitely try restoring some backups first though and see if that eliminates the problem (just be careful and make sure you save the backups out of the folder before trying anything, it only keeps the most 10 recent). You could force it to do a fsck upon the next reboot on the main partition like this: sudo touch /forcefsck
      sudo reboot

      This will check the disk integrity and can often fix a lot of problems like this if it’s really minor damage. If the damage was your actual Minecraft server itself when fsck fixes the filesystem it’s pretty common for it to break the server and need a backup restored. After fsck has fixed/corrected the partition table though restoring a backup will work if all of the damage was able to be repaired. We honestly haven’t had a ton of luck with fsck lately and almost everyone ended up being better off doing a reinstall using the latest fresh copy of the OS they were using. Then when they restored a backup on the freshly imaged OS it ended up working better than ever before in almost all cases (the only exceptions ended up being really weird bugs in Minecraft itself).

      If this does happen to be a really large server you probably just want to change the timeout value in /etc/systemd/system/yourserver.service and then do a sudo systemctl daemon-reload afterward as the really big servers will need more time to complete the backups.

      Let’s see what you find from those suggestions and then we can zero on it a little bit more!

      1. Avatar for Sergio

        Finally, we had a plugin called Dynmap, bassically its a lot of images for a web with our server map. I just deleted it jajaj. Now all is working normally. Tyyy <3

  2. Avatar for Cameron

    Im getting this error when i launch my server:

    [00:51:05 ERROR]: Could not load 'plugins/worldguard.jar' in folder 'plugins'
    org.bukkit.plugin.UnknownDependencyException: Unknown/missing dependency plugins: [WorldEdit]. Please download and install these plugins to run 'WorldGuard'.
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:290) ~[paper-api-1.18.1-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_18_R1.CraftServer.loadPlugins(CraftServer.java:422) ~[paper-1.18.1.jar:git-Paper-187]
    at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:285) ~[paper-1.18.1.jar:git-Paper-187]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1202) ~[paper-1.18.1.jar:git-Paper-187]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:317) ~[paper-1.18.1.jar:git-Paper-187]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]

    Any idea how to solve it?

    1. Avatar for James A. Chambers

      Hey Cameron,

      That looks like the plugin from the example guide. I would remove the WorldGuard plugin if you are not trying to use it. It looks like it downloaded incorrectly so you could either download it again or just remove Worldguard.jar. Hopefully that helps!

      1. Avatar for Cameron Brouwer

        Thanks James!
        Is there someway to access a sort of desktop on the pi with a monitor connected, to actually see the files and go into the plugins folder?
        I’m not too good with doing all this stuff from the terminal

        1. Avatar for James A. Chambers

          Hey Cameron,

          There’s a bunch of ways to do that for sure. You can connect a monitor with HDMI and you will have a desktop you can log into. That’s probably the easiest option, you just usually need the cable that goes from mini HDMI to regular HDMI (which comes with most starter kits).

          It’s also possible to set up remote desktop (xrdp) or VNC. I highly recommend the VNC because it’s officially supported on the Pi and they even give you some premium VNC features. They give the instructions to turn it on from the command line as well but if connecting a monitor sounds easier/preferable you can absolutely do that.

          Afterwards you would just download the RealVNC client / viewer for your OS you are connecting to the Pi from. This basically gives you full remote desktop capabilities and I think they even throw in the cloud-enabled access for Raspberry Pis (normally costs money / is a premium feature). They have had some sort of big agreement with the Raspberry Pi foundation for many years. You can use other things but it’s a great option for beginners and way easier to configure than some of the other ones can be like xrdp.

          It definitely will help while you get more familiar with Linux. I definitely started with purely GUI and couldn’t do anything on the CLI. The GUI stuff mostly feels familiar to Windows (or familiar enough to work with). Now I actually prefer to do everything on the command line because it’s so much faster (if you have the commands handy) but for learning I did the same thing.

          Definitely let me know if you have any more questions / run into any problems!

  3. Avatar for David Artiss

    Hi James,
    Thanks so much for your article – they’ve been great. I now have a Pi MC server set up, all as you’ve documented. But… I cannot work out how to define an initial Operator – all the instructions I can find assume an Ops is already set-up. Modifying ops.json is not recommended, so I wonder what I should be doing? Any help will be appreciated.

    1. Avatar for James A. Chambers

      Hey David,

      No worries! The easiest way is to pull up the Minecraft console by typing the command:

      screen -r

      This will bring up the Minecraft server console. Now type:

      op yourplayername

      or

      op "your player"

      and that should take care of it!

  4. Avatar for JerryOckwig

    Hello James,
    Your script works flawlessly, I’m having issues setting up administrator, I went and edited the ops.json file per internet examples, stopped/started server. tried /command and also without / nothing is working ie.. /op playername 2, any idea why this is?
    Thanks Jerry

    1. Avatar for JerryOckwig

      Sorry James,
      I emailed a little premature, it was the ops.json file, it seems like it did not save when I edited, working fine now
      as well as console commands. Thanks again for providing a great script. I have another question, I have a raspberry pi 4 b with 4 mb ram and a 256mb sd card run most 6 players at a time. Do you think I can load some
      Plug-ins or do you think the server would crash?
      Thanks,
      Jerry

      1. Avatar for James A. Chambers

        Hey Jerry,

        Sorry I didn’t get to yours fast enough and you figured it out! I think I can help with the second question for sure. You should definitely have some breathing room to install some plugins on 4GB!

        I have some instructions on how to do it or if you already have some plugins in mind it’s totally safe and you have enough resources for sure. Hopefully that helps!

  5. Avatar for Julian

    Hello James,
    im trying to install the Minecraft Server but as soon as i try to start it i get this
    pi@raspberrypi:~/minecraft $ ./start.sh
    tail: cannot open '' for reading: No such file or directory
    Updating to most recent paperclip version ...
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 507 100 507 0 0 431 0 0:00:01 0:00:01 --:--:-- 431
    Latest paperclip build found: 187
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 32.9M 100 32.9M 0 0 1059k 0 0:00:31 0:00:31 --:--:-- 1468k
    Starting Minecraft server. To view window type screen -r minecraft.
    To minimize the window and let the server run in the background, press Ctrl+A then Ctrl+D

    Dont know what to do :/

    1. Avatar for James A. Chambers

      Hey Julian,

      No worries, I think I can help! It looks like the character ‘”’ has made it into the files somehow. That looks like a web safe quote to me (it’s possible my site did this to your comment and it’s a normal quote, I think it might if it’s not within a ‘code’ tag). Whichever type of quote it is though it’s basically breaking the script at that point. This is actually how a lot of web vulnerabilities work as if a web site was submitting data a user controlled (like their username for example) and they put a quote in there and the developer didn’t check for it they could basically write their own code after that point.

      Now how did it get in there? There’s two ways that I can think of that they could get in there so let’s start there. One way is that either your server name or the folder specified to the server has a quote in it / was quoted when it was typed in. If you tried to type in a server name with a space and put it as “My Server” this could happen for example.

      I’ve seen this a couple of times before and it’s an understandable mistake because that is exactly how you would type a command in the Minecraft server console if it had a space like /kick “Player Name”. The best way to fix this would be to run SetupMinecraft again and don’t use any quotes or spaces when entering the input. Definitely let me know if this is how they got in there as it would be partially my fault for not validating the input and making sure that character isn’t allowed (just like the web developers who didn’t check their username for quotes for example). I don’t remember if it checks for this or not off the top of my head but it should.

      There’s another way it could have happened as well though. If you have copy/pasted any of the script from your web browser that is commonly where those browser safe left-leaning and right-leaning quotes come from. It’s supposed to make it safer as the quote will break a ton of different languages in a similar way so it’s a security mechanism to replace them with these types of quotes that aren’t meant to be interpreted as the ” character. In that case you can usually download it “raw” from GitHub or on the CLI to bypass the browser replacing these quotes.

      Definitely try SetupMinecraft.sh again here though and if it’s still having difficulty we can definitely dig into some log files here!

  6. Avatar for James A

    anyone (james or otherwise) have experience running Geyser / Floodgate so Bedrock players can join your Java rpi server? wondering if it works, and well, before I go tinker.

    1. Avatar for James A. Chambers

      Hey James,

      I actually had not heard of this before! I did some checking and it actually looks like it should work with it just fine.

      Floodgate is a hybrid mode plugin that allows Minecraft: Bedrock Accounts to join Minecraft: Java Edition servers without needing a Minecraft: Java Edition account. This is something you install in addition to Geyser. Unlike Geyser, Floodgate can only be installed as a plugin on Spigot (including Paper and forks), Bungeecord, and Velocity, and can only be utilized on servers that have it installed.

      Yep, this checks out! The underlying server the scripts use is the Paper Minecraft server meaning we meet the requirements for this. It actually looks pretty easy too:

      Download the Floodgate plugin from here and add it to your plugins folder on your frontend server.
      floodgate-spigot.jar for Spigot, Paper, etc

      That looks like just installing another plugin. Then I checked the Geyser requirement next and it looks like it’s also just a plugin.

      These are both just .jar drop-in files. It looks like there’s some basic configuration but nothing too crazy or that would be unexpected. I think this absolutely should work! It’s a really cool idea and would actually help out of a lot of people who maybe want to run a Bedrock-capable server on the Pi (but it’s slow) while since Java runs on ARM at full speed the Java one works great!

      Definitely let us know if you try this as I think you would be the first (that I’ve heard of at least)!

  7. Avatar for DarthPhaethon

    I’m very new to working in the command line, and am having trouble finding out how to move/copy a previously-built world into this setup. I had been running Vanilla via the pi400 default setup (graphical), but wanted to move to the headless version for performance reasons. Now, I can’t for the life of me figure out how to copy the backup I have on a USB flash into the new setup. Any help from anyone would be amazing.!
    And, thank you James for this script, and blog.!

    1. Avatar for James A. Chambers

      Hey DarthPhaethon,

      I originally wrote you a reply for how to do it with Bedrock and then I looked at the article title and realized it was Java! It should be pretty easy.

      Here’s what I would do. Go ahead and install just a blank new server on the new headless Pi. Once it starts up close it. Now extract your old zip file over the top of it. The zip file contents should overwrite the blank setup (which has nothing anyway). Once that is done restart the server and it should be good to go!

      Also check out the “Automatic Backups” section of this article as this has the handy CLI steps which will make this much easier on your headless device (easy). They look like this:

      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

      You will be extracting a backup you’ve already saved so the only thing you’ll change is you will specify the path to your backup (maybe something like ~/yourbackup.tar.gz if it was in your home folder or absolute paths are even better) instead of the “backups/2019.02.15.22.06.30.tar.gz” that is used above.

      Hopefully that gets it for you but let me know if you have any trouble with them!

      1. Avatar for DarthPhaethon

        Hey James,
        Thanks for the reply. What I had had been copied onto a USB flash in an uncompressed format. So, I was having the worst time trying to find some simple (but with explanation) command line opperations to ID/mount the USB, and then copy the folder over. I believe the route is with a recursive cp, but after several hours of trying to filter out info I just decided to start over with the lightest version of pi with the desktop (which of course made the copy/move part super easy). This is on a pi 400, which comes with a bunch of pre-installed stuff, so I just got a new microSD, and just made a totally new boot, etc.

        But, it’s working now.! And, running well. I like the Geasy editor that that build comes with. After years of early years coding with nothing but the most basic of editors, I became spoiled with color-coded editors. 😀 I’m not exactly new to Unix/Linux, but it’s been a good couple of decades…college days 😉 I never did get much into coding other than Basic, and then HTML-related…I was always the UI guy. 😉

        Anyway…I did have another thought, and maybe I’m still just too noob to the environment, but when the machine does it’s reboot/restart, I notice that it doesn’t being up the consol. Now, I recocognize that this is probably ideal given the overhead, but is there a way to turn that back on without manually stoping/restarting the server.? …if I were to need to get into it to do something.

        Most appreciated.! And, again Thank you.!

        1. Avatar for James A. Chambers

          Hey DarthPhaethon,

          Absolutely! So you can bring the console back up by just typing:

          screen -r minecraft

          into a new terminal. This brings up the screen which runs in the background. You can also send it to the background again by pressing Ctrl+A followed by Ctrl+D.

          Hopefully that helps and I understood your question correctly, if not let me know!

Leave a Comment

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

Type here..

Exit mobile version