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 William

    How do I open the minecraft lancher when I’ve downloaded it? It also seems as though the server never launches for me.

    1. Avatar for James A. Chambers

      Hey William,

      You can use screen -r to resume the console and there’s also a “logs” directory if there are no screens logging that you can open the text file to get the error output! We can definitely help if you let us know what you’re seeing.

  2. Avatar for Chuck

    Having an odd problem. I got this running very quickly. Great tutorial. But…..port 25565 doesn’t appear to be open even though the mc server is running.

    I am on the same LAN so to eliminate port forwarding misconfigurations. I specified the IP of the wired interface in server.properties to keep it from trying to use the wifi.

    I telnet to port 25565 and get a connection refused and the MAC mc client times out as well. I don’t think iptables is the problem.

    1. Avatar for James A. Chambers

      Hey Chuck,

      Are you able to pull up the server console with screen -r? Does it look like everything is running normally?

      Are you running regular Raspberry Pi OS or are you running a different distro? Some of them have firewalls enabled but if you are on Raspberry Pi OS then unless you installed UFW it’s not likely.

      You’ve ran some pretty good initial diagnostics. Not being able to make a connection on the port even with telnet tells us something is wrong.

      One other thing to watch out for is that if you fail to make a connection to a server once in the Minecraft client it will fail to connect forever until you restart it even if the server comes back up. I just wanted to mention this because as you’re testing make sure you are closing the Minecraft client completely out and then relaunching it from scratch before attempting to connect again.

      Are you able to the ping the IP address of the server?

      1. Avatar for Chuck

        Hello….so I can SSH into it remotely and ping so I have that connectivity. I wasn’t aware of that little quirk with the client because I was NOT restarting it after a failure. Even with doing so, no luck.

        Running Raspberry Pi OS:

        uname -a
        Linux raspberrypi 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux

        Update: Finally gave up on this at about 2a today and issued a reboot when I did it. It does seem that the server takes an inordinate amount of time to come up presumably being on a Pi3? I can now telnet to 25565 after waiting longer but, on a Mac and Windows 10 v1.16.4 of the client cannot connect.

        This is what screen -r minecraft shows and nothing seems amiss:
        System Info: Java 1.8 (OpenJDK Zero VM 25.40-b08) Host: Linux 4.9.35-v7+ (arm)
        Loading libraries, please wait...
        [04:20:20 INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
        [04:20:24 INFO]: Found new data pack file/bukkit, loading it automatically
        [04:20:31 INFO]: Reloading ResourceManager: Default, bukkit
        [04:20:50 INFO]: Loaded 7 recipes
        [04:23:50 INFO]: Starting minecraft server version 1.16.4
        [04:23:50 INFO]: Loading properties
        [04:23:51 INFO]: This server is running Paper version git-Paper-354 (MC: 1.16.4) (Implementing API version 1.16.4-R0.1-SNAPSHOT)
        [04:23:52 INFO]: Server Ping Player Sample Count: 12
        [04:23:52 INFO]: Using 4 threads for Netty based IO
        [04:23:52 INFO]: Debug logging is disabled
        [04:23:53 INFO]: Default game type: SURVIVAL
        [04:23:53 INFO]: Generating keypair
        [04:24:06 INFO]: Starting Minecraft server on 192.168.1.158:25565
        [04:24:07 INFO]: Using default channel type
        [04:24:08 INFO]: Server permissions file permissions.yml is empty, ignoring it
        [04:24:08 INFO]: Preparing level "world"

        1. Avatar for James A. Chambers

          Hey Chuck,

          You’re right. It’s going really slow here. It took almost 3 minutes to load the data packs and get to starting the server! It also still wasn’t finished loading yet when you took that picture. It was right in the middle of loading the “world” or the map basically.

          How much memory did you give it when you set it up? The memory requirements are rising with each version. I haven’t ran it on a Pi 3 for a while, but you are going to want to set it to as close to max as you can get away with without it crashing!

          If it’s a 1GB you’d want to kill any background processes and preferably be running the lite version of Raspberry Pi OS or Ubuntu Server and see if you can get it to close to like 800MB allocated if you’re lucky. I haven’t done it for a while on a 1GB, so it may not be possible to give it even close to this much anymore, but I was able to hit this amount routinely a year or two ago.

          How much you can give will depend on how many background processes you can/can’t get rid of. If it’s a 512MB of RAM model it’s going to be tough these days. If it is one of those it would still help a lot to upgrade to a SSD! If this is a model with 512MB of RAM then running a server-only OS is going to be an absolute requirement. You’ll also want to set gpu_mem=16 in the /boot/config.txt file to only allocate 16MB of memory for video operations (the minimum).

          What storage device are you using? This is another common bottleneck. If you have a slower SD card it can definitely cause this. Have you ran my storage benchmark at Pi Benchmarks? This is just a hunch after seeing these for a while. It’s taking a long time to load *everything* basically, even the stuff that shouldn’t which means the storage is likely bottlenecked here.

          1. Avatar for Chuck

            Got tied up on some other stuff over the weekend. Well I decided after your comments, looking at other things in the server and my own research that I just needed new hardware.

            Got a Pi 4B with 8GB RAM and 128GB SD card. Benchmark scored it at 1373 so we’ll see how that goes.

            Also using JDK v11.

            So now we do some testing and let my son and daughter beat on it for a while.

            1. Avatar for James A. Chambers

              Congratulations Chuck! I think the 8GB Pi is a worthwhile upgrade.

              By getting USB 3.0 and much faster RAM clocks it’s a much bigger jump than the previous Pis were. You can also go 64 bit with 8GB of RAM!

              I’m sure the testing will go well! You could attempt a SSD upgrade if you’re not happy with where it’s at.

              I recently played with friends over a month or two on the SD card and didn’t have much trouble than right after reboots it would be slower to load back up and lag for the first minute or two then be fine.

              Definitely have fun and enjoy!

              1. Avatar for Chuck

                So far been working well … i tweaked some of the start up settings. The server seemed to have a tendency to crash and after looking through logs Java was running out of memory. Was running v11 and didn’t want to downgrade as that seemed counterintuitive. The recommended setting for memory was 2700MB. I backed it off to 2000MB and it seemed to have stabilized. Going to have fun taking this to the next level as I dig through your setup. This was really straightforward to setup once I got the right equipment. I don’t play minecraft but my kids and their friends do and now I get to teach them a little about a Linux operating system.

  3. Avatar for Tim

    Is there a way to enables cheats that will allow you teleport and change the game difficulty form easy to peaceful while playing?

    1. Avatar for James A. Chambers

      Hey Tim,

      Absolutely! Open the server console with screen -r and you can “OP” yourself which will make you an admin like this:

      op "your name"

      and then press enter. It should say the player was opped. At this point you’ll see you have a whole lot more commands available in your /help! You can change the difficulty with:

      /difficulty #

      with 0 being peaceful and the higher you go the more difficult it gets with 3 being hard. There’s soome other useful ones like controlling the weather, etc. but once you get “opped” from the server console the help menus are pretty helpful about what you can do. You can also just start typing / to see what commands are available!

      1. Avatar for Tim

        Thanks for the help.

        Also, your instructions to setup a Minecraft server and your scrip have been very helpful. Thanks for all your hard work

  4. Avatar for crockins

    Hey, first these scripts are fantastic. Thank you for sharing this! I’ve set up multiple servers to play on with my family using them with no problems and a lot less headaches than the servers I set up before using other guides. We’re setting up a new server and we’re wanting to run mods. I’m just wondering if you have done (or thought of doing) a version of your scripts to set up a forge server instead of paper?

  5. Avatar for Roci

    Hi there!
    Thank you for the great tutorial my server is running great on a stable 20 tps now 🙂
    The only issue I seem to be having is when people start moving around alot the tps will go down.. I’ve even tried pre-generating all of the terrain.
    I’m thinking this might be because the server is running on a microSD. I’m using debian buster and was wondering if you know a way of putting the sdhost controller to 100hz again.

    1. Avatar for James A. Chambers

      Hey Roci,

      I suspect you’re right that the storage is having trouble keeping up when a lot of people are moving around in this case. This will be especially noticeable in areas nobody has explored before (new chunks) but even just reading tons of chunks at once is hard on the storage.

      I also think that changing your SD overclock could help. Depending on how many people we’re talking about it it may not be enough to give you perfect 20 TPS performance without going to a SSD but it should be an improvement and it might be good enough.

      Debian Buster should have a /boot/config.txt where you can still overclock the SD card. You can add dt_param=sd_overclock=100 to this file the same way as Raspbian once you find it. On Ubuntu sometimes it will be in /boot/firmware/config.txt for example, but from what I’ve all seen this same config file is located somewhere. I see some references even to overclocking here so I think you should be able to try this!

  6. Avatar for Maddie

    Hey mate! I’ve been using this since 1.14 and just want to say it’s brilliant! Out of curiosity, is there anywhere I can find a list of differenced between this and true vanilla, given your changes + the paper/spigot changes?

  7. Avatar for Michael

    Great instructions. Thanks for the update. I have 2 questions….

    1. Should I run wb world fill…is there added benefit from this?
    2. Whenever there is 1 person in the world and they disconnect the server shutdown. Any thoughts why?

    1. Avatar for James A. Chambers

      Hey Michael,

      These days on a modern Pi I usually don’t bother pregenerating with a world fill anymore. Like on a good Raspberry Pi 4 (like a 4-8 GB one) it can keep up well enough to not have to pregenerate. The exception is if you are planning on having more than a few people playing at once or if your Pi / storage is on the older side. Then pregenerating will take a *lot* of load off if there’s going to be more than a few people.

      Your second question is a bit curious. Have you installed any plugins or changed anything from the default configuration? Because I don’t think there’s any such functionality actually built in. Have you tried keeping the server window opened and logging out to see if there’s any red text or messages? It almost sounds like an error to me when someone logs out, like maybe when it’s trying to save their data, are they in the same spot they logged out at when they log back in after the server is restarted?

      Did you happen to install the WorldBorder plugin? Because I think that the creator stopped working on that one so if you installed that plugin it might be too old of a version and be crashing the server. If you did install it go ahead and remove WorldBorder.jar from the plugins folder as that would almost certainly be why. I’ll add an update in that WorldBorder isn’t being updated again as I could definitely see this causing some trouble!

      1. Avatar for Pawel

        Hi James, Michael,

        I have the same issue with my server as well. I’ve been testing it fo a while now and every time I quit the game the whole server shuts down. It’s a vanilla server installation, no mods, plugins etc. There’s no message on Minecraft ssh screen whatsoever, it just quits and takes me back to main rpi ssh. I’m running my RPI with standard microsd boot with additional ssd storage connected via usb – both have a lot of space available so I guess that’s not the issue here. I guess I’ll try the good old “format and try again” trick.

        1. Avatar for Mike

          I have the same problem. I did 3 times the “format and try again” trick but server will stop after few minutes of playing.
          I don’t have any plugins or mods (default settings).
          My setup is done exactly by the guide (memory 2700), RPI 4 8Gb/SSD

          1. Avatar for James A. Chambers

            I’d like to try to help if I can. I haven’t experienced this in my testing and it definitely doesn’t appear to be everyone, but something is definitely up and there’s some places we can have you guys check to gather some more information.

            If you go to your ~/minecraft folder you will see a “logs” folder. The newest log file will be called “latest.log”. Look toward the very end of the file (this would be before the server shuts down).

            A normal stop (like if you did a screen -r minecraft to pull up the server console and typed ‘stop’) will look like this:

            [16:49:20] [Server thread/INFO]: Stopping the server
            [16:49:20] [Server thread/INFO]: Stopping server
            [16:49:20] [Server thread/INFO]: [CustomTime] Disabling CustomTime v2.0
            [16:49:20] [Server thread/INFO]: Saving players
            [16:49:20] [Server thread/INFO]: Saving worlds
            [16:49:20] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world]'/minecraft:overworld
            [16:49:20] [Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved
            [16:49:20] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world_nether]'/minecraft:the_nether
            [16:49:20] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
            [16:49:20] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world_the_end]'/minecraft:the_end
            [16:49:20] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
            [16:49:20] [Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved
            [16:49:20] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
            [16:49:20] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
            [16:49:20] [Server thread/INFO]: Flushing Chunk IO
            [16:49:20] [Server thread/INFO]: Closing Thread Pool
            [16:49:20] [Server thread/INFO]: Closing Server

            Let’s have you guys look in yours and see what you see. Ideally it will give us an error telling us what is going on and why the server closed, but seeing what your guys looks like will actually narrow things down a little bit here.

            I had a suspicion it could have something to do with the service. The service has a startup timeout of 10 minutes. This doesn’t seem to line up with the times you guys are giving here (I seem to mostly be seeing around 5 minutes). The log files will give us some timestamps too that will tell us roughly how long the server was running from the message timestamps and when the last activity it was before it went poof.

            There’s one other thing I’d like you guys to check. Let’s see what the service status is when this happens by typing sudo systemctl status minecraft. Here’s an example of mine:

            pi@raspberrypi:~/minecraft/logs $ sudo systemctl status minecraft
            ● minecraft.service - minecraft server service
            Loaded: loaded (/etc/systemd/system/minecraft.service; enabled; vendor preset: enabled)
            Active: failed (Result: exit-code) since Fri 2020-10-30 16:49:20 MDT; 3min 39s ago
            Process: 361 ExecStart=/bin/bash /home/pi/minecraft/start.sh (code=exited, status=0/SUCCESS)
            Process: 1543 ExecStop=/bin/bash /home/pi/minecraft/stop.sh (code=exited, status=1/FAILURE)

            Oct 30 04:01:29 raspberrypi bash[361]: 45650K .......... .......... .......... .......... .......... 99% 24.7M 0s
            Oct 30 04:01:29 raspberrypi bash[361]: 45700K .......... .......... .......... .......... .......... 99% 25.0M 0s
            Oct 30 04:01:29 raspberrypi bash[361]: 45750K ....... 100% 21.5M=2.2s
            Oct 30 04:01:29 raspberrypi bash[361]: 2020-10-30 04:01:29 (20.4 MB/s) - ‘paperclip.jar’ saved [46855630/46855630]
            Oct 30 04:01:30 raspberrypi bash[361]: Starting Minecraft server. To view window type screen -r minecraft.
            Oct 30 04:01:30 raspberrypi bash[361]: To minimize the window and let the server run in the background, press Ctrl+A then Ctrl+D
            Oct 30 04:01:30 raspberrypi systemd[1]: Started minecraft server service.
            Oct 30 16:49:20 raspberrypi bash[1543]: Server is not currently running!
            Oct 30 16:49:20 raspberrypi systemd[1]: minecraft.service: Control process exited, code=exited, status=1/FAILURE
            Oct 30 16:49:20 raspberrypi systemd[1]: minecraft.service: Failed with result 'exit-code'.

            Definitely feel free to post your own ~/minecraft/logs or systemctl status minecraft command output here on the site. Web storage is cheap these days and it’s incredibly helpful!

            1. Avatar for Michael

              Sorry for the delay, I didn’t receive an email that you responded. But thanks for responding, btw!

              So, I did have WorldBorder installed so I decided to start over (this is a newer project for my brother). I did a fresh install of raspbian and followed your instructions for installing the server. Still getting the same issue whenever someone logs and then leaves, the server will just shutdown. I am running a Raspberry Pi 4 with 8 GB RAM.

              I noticed during the initial setup that it was saying “Unable to find spawn biome”.

              I jumped into the world played for a bit and then when I disconnect the server immediately crashes.

              This is the status via sudo systemctl status minecraft:
              ● minecraft.service - minecraft server service
              Loaded: loaded (/etc/systemd/system/minecraft.service; enabled; vendor preset: enabled)
              Active: failed (Result: exit-code) since Wed 2020-11-04 19:56:02 EST; 9s ago
              Process: 348 ExecStart=/bin/bash /home/pi/minecraft/start.sh (code=exited, status=0/SUCCESS)
              Process: 863 ExecStop=/bin/bash /home/pi/minecraft/stop.sh (code=exited, status=1/FAILURE)

              Nov 04 19:51:06 Ore-Server bash[348]: 45650K .......... .......... .......... .......... .......... 99% 9.47M 0s
              Nov 04 19:51:06 Ore-Server bash[348]: 45700K .......... .......... .......... .......... .......... 99% 8.86M 0s
              Nov 04 19:51:06 Ore-Server bash[348]: 45750K ........ 100% 64.5M=4.2s
              Nov 04 19:51:06 Ore-Server bash[348]: 2020-11-04 19:51:06 (10.7 MB/s) - ‘paperclip.jar’ saved [46856246/46856246]
              Nov 04 19:51:06 Ore-Server bash[348]: Starting Minecraft server. To view window type screen -r minecraft.
              Nov 04 19:51:06 Ore-Server bash[348]: To minimize the window and let the server run in the background, press Ctrl+A then Ctrl+D
              Nov 04 19:51:07 Ore-Server systemd[1]: Started minecraft server service.
              Nov 04 19:56:02 Ore-Server bash[863]: Server is not currently running!
              Nov 04 19:56:02 Ore-Server systemd[1]: minecraft.service: Control process exited, code=exited, status=1/FAILURE
              Nov 04 19:56:02 Ore-Server systemd[1]: minecraft.service: Failed with result 'exit-code'.

              If I try to restart the server (without restarting the Pi) then i get this error:

              ManagerFactory [org.apache.logging.log4j.core.appender.rolling.RollingRandomAccessFileManager$RollingRandomAccessFileManagerFactory@1c53a33] unable to create manager for [logs/latest.log] with data [org.apache.logging.log4j.core.appender.rolling.RollingRandomAccessFileManager$FactoryData@1b7f657]
              at org.apache.logging.log4j.core.appender.AbstractManager.getManager(AbstractManager.java:114)
              at org.apache.logging.log4j.core.appender.OutputStreamManager.getManager(OutputStreamManager.java:114)
              at org.apache.logging.log4j.core.appender.rolling.RollingRandomAccessFileManager.getRollingRandomAccessFileManager(RollingRandomAccessFileManager.java:87)
              at org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender$Builder.build(RollingRandomAccessFileAppender.java:115)
              at org.apache.logging.log4j.core.appender.RollingRandomAccessFileAppender$Builder.build(RollingRandomAccessFileAppender.java:52)
              at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:122)
              at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:952)
              at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:892)
              at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:884)
              at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:508)
              at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:232)
              at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:244)
              at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
              at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:617)
              at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:634)
              at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:229)
              at org.apache.logging.log4j.core.async.AsyncLoggerContext.start(AsyncLoggerContext.java:76)
              at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152)
              at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
              at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
              at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:551)
              at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:537)
              at net.minecraft.server.v1_16_R2.Main.(Main.java:27)
              at org.bukkit.craftbukkit.Main.main(Main.java:276)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.base/java.lang.reflect.Method.invoke(Method.java:566)
              at io.papermc.paperclip.Paperclip.main(Paperclip.java:58)

              If I restart the Pi, then it will start the server just fine, until someone d/c and then the whole thing shuts down. It does seem to be saving itself and in the logs it’s saying that the stop.sh file was

              [19:50:27] [Server thread/INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
              [19:50:27] [Server thread/INFO]: View Distance: 10
              [19:50:27] [Server thread/INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
              [19:50:27] [Server thread/INFO]: Item Despawn Rate: 6000
              [19:50:27] [Server thread/WARN]: Unable to find spawn biome
              [19:50:27] [Server thread/INFO]: Running delayed init tasks
              [19:50:27] [Server thread/INFO]: Done (25.951s)! For help, type "help"
              [19:50:27] [Server thread/INFO]: Timings Reset
              [19:50:35] [Server thread/INFO]: [Server] Closing server (stop.sh called)...
              [19:50:35] [Server thread/INFO]: Stopping the server
              [19:50:35] [Server thread/INFO]: Stopping server
              [19:50:35] [Server thread/INFO]: Saving players

              Please help! HAHA, thanks in advance.
              Michael

            2. Avatar for Michael

              Have a little more info….I ran the server for longer this time and right at 10 minutes, it shutdown and this was in the logs.

              [20:09:29] [Server thread/INFO]: GullibleMrPi joined the game
              [20:09:29] [Server thread/INFO]: GullibleMrPi[/192.168.1.1:63351] logged in with entity id 1 at ([world]102.10588693722158, 85.0, -254.72431609065944)
              [20:19:30] [Server console handler/ERROR]: Caught previously unhandled exception :
              java.io.IOError: java.io.IOException: Error executing 'stty -a': stty: 'standard input': Input/output error
              at org.jline.terminal.impl.AbstractPosixTerminal.setAttributes(AbstractPosixTerminal.java:54) ~[patched_1.16.3.jar:git-Paper-253]
              at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:650) ~[patched_1.16.3.jar:git-Paper-253]
              at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:418) ~[patched_1.16.3.jar:git-Paper-253]
              at net.minecrell.terminalconsole.SimpleTerminalConsole.readCommands(SimpleTerminalConsole.java:158) ~[patched_1.16.3.jar:git-Paper-253]
              at net.minecrell.terminalconsole.SimpleTerminalConsole.start(SimpleTerminalConsole.java:141) ~[patched_1.16.3.jar:git-Paper-253]
              at net.minecraft.server.v1_16_R2.DedicatedServer$1.run(DedicatedServer.java:64) ~[patched_1.16.3.jar:git-Paper-253]
              Caused by: java.io.IOException: Error executing 'stty -a': stty: 'standard input': Input/output error
              at org.jline.utils.ExecHelper.exec(ExecHelper.java:42) ~[patched_1.16.3.jar:git-Paper-253]
              at org.jline.terminal.impl.ExecPty.doGetConfig(ExecPty.java:175) ~[patched_1.16.3.jar:git-Paper-253]
              at org.jline.terminal.impl.ExecPty.getAttr(ExecPty.java:87) ~[patched_1.16.3.jar:git-Paper-253]
              at org.jline.terminal.impl.ExecPty.doSetAttr(ExecPty.java:93) ~[patched_1.16.3.jar:git-Paper-253]
              at org.jline.terminal.impl.AbstractPty.setAttr(AbstractPty.java:29) ~[patched_1.16.3.jar:git-Paper-253]
              at org.jline.terminal.impl.AbstractPosixTerminal.setAttributes(AbstractPosixTerminal.java:52) ~[patched_1.16.3.jar:git-Paper-253]
              ... 5 more
              [20:19:30] [SIGCONT handler/WARN]: Exception in thread "SIGCONT handler" java.io.IOError: java.io.IOException: Error executing 'stty -a': stty: 'standard input': Input/output error
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.terminal.impl.AbstractPosixTerminal.getAttributes(AbstractPosixTerminal.java:46)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.terminal.impl.AbstractTerminal.enterRawMode(AbstractTerminal.java:117)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.reader.impl.LineReaderImpl.handleSignal(LineReaderImpl.java:1043)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.terminal.impl.AbstractTerminal.raise(AbstractTerminal.java:81)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.terminal.impl.PosixSysTerminal.lambda$handle$1(PosixSysTerminal.java:65)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.utils.Signals.lambda$register$1(Signals.java:52)
              [20:19:30] [SIGCONT handler/WARN]: at com.sun.proxy.$Proxy18.handle(Unknown Source)
              [20:19:30] [SIGCONT handler/WARN]: at jdk.unsupported/sun.misc.Signal$InternalMiscHandler.handle(Signal.java:198)
              [20:19:30] [SIGCONT handler/WARN]: at java.base/jdk.internal.misc.Signal$1.run(Signal.java:220)
              [20:19:30] [SIGCONT handler/WARN]: at java.base/java.lang.Thread.run(Thread.java:834)
              [20:19:30] [SIGCONT handler/WARN]: Caused by: java.io.IOException: Error executing 'stty -a': stty: 'standard input': Input/output error
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.utils.ExecHelper.exec(ExecHelper.java:42)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.terminal.impl.ExecPty.doGetConfig(ExecPty.java:175)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.terminal.impl.ExecPty.getAttr(ExecPty.java:87)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.terminal.impl.AbstractPosixTerminal.getAttributes(AbstractPosixTerminal.java:44)
              [20:19:30] [SIGCONT handler/WARN]: ... 9 more
              [20:19:30] [SIGCONT handler/WARN]: Exception in thread "SIGCONT handler" java.io.IOError: java.io.IOException: Error executing 'stty -a': stty: 'standard input': Input/output error
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.terminal.impl.AbstractPosixTerminal.getAttributes(AbstractPosixTerminal.java:46)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.terminal.impl.AbstractTerminal.enterRawMode(AbstractTerminal.java:117)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.reader.impl.LineReaderImpl.handleSignal(LineReaderImpl.java:1043)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.terminal.impl.AbstractTerminal.raise(AbstractTerminal.java:81)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.terminal.impl.PosixSysTerminal.lambda$handle$1(PosixSysTerminal.java:65)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.utils.Signals.lambda$register$1(Signals.java:52)
              [20:19:30] [SIGCONT handler/WARN]: at com.sun.proxy.$Proxy18.handle(Unknown Source)
              [20:19:30] [SIGCONT handler/WARN]: at jdk.unsupported/sun.misc.Signal$InternalMiscHandler.handle(Signal.java:198)
              [20:19:30] [SIGCONT handler/WARN]: at java.base/jdk.internal.misc.Signal$1.run(Signal.java:220)
              [20:19:30] [SIGCONT handler/WARN]: at java.base/java.lang.Thread.run(Thread.java:834)
              [20:19:30] [SIGCONT handler/WARN]: Caused by: java.io.IOException: Error executing 'stty -a': stty: 'standard input': Input/output error
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.utils.ExecHelper.exec(ExecHelper.java:42)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.terminal.impl.ExecPty.doGetConfig(ExecPty.java:175)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.terminal.impl.ExecPty.getAttr(ExecPty.java:87)
              [20:19:30] [SIGCONT handler/WARN]: at org.jline.terminal.impl.AbstractPosixTerminal.getAttributes(AbstractPosixTerminal.java:44)
              [20:19:30] [SIGCONT handler/WARN]: ... 9 more
              [20:19:30] [Server thread/INFO]: Stopping server
              [20:19:30] [Server thread/INFO]: Saving players
              [20:19:30] [Server thread/INFO]: GullibleMrPi lost connection: Server closed
              [20:19:30] [Server thread/INFO]: GullibleMrPi left the game
              [20:19:30] [Server thread/INFO]: Saving worlds
              [20:19:30] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world]'/minecraft:overworld
              [20:19:33] [Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved
              [20:19:33] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world_nether]'/minecraft:the_nether
              [20:19:33] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
              [20:19:33] [Server thread/INFO]: Saving chunks for level 'ServerLevel[world_the_end]'/minecraft:the_end
              [20:19:33] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
              [20:19:33] [Server thread/INFO]: ThreadedAnvilChunkStorage (world): All chunks are saved
              [20:19:34] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
              [20:19:34] [Server thread/INFO]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
              [20:19:34] [Server thread/INFO]: Flushing Chunk IO
              [20:19:34] [Server thread/INFO]: Closing Thread Pool
              [20:19:34] [Server thread/INFO]: Closing Server

            3. Avatar for Michael

              After further digging, I found this in a separate log file. I’m unsure how to resolve this. I’m running a Raspberry Pi 4 8GB with Raspbian Lite 32 bit. Any thoughts how I can fix this?

              #
              # There is insufficient memory for the Java Runtime Environment to continue.
              # Native memory allocation (malloc) failed to allocate 1213544 bytes for Chunk::new
              # Possible reasons:
              # The system is out of physical RAM or swap space
              # In 32 bit mode, the process size limit was hit
              # Possible solutions:
              # Reduce memory load on the system
              # Increase physical memory or swap space
              # Check if swap backing store is full
              # Use 64 bit Java on a 64 bit OS
              # Decrease Java heap size (-Xmx/-Xms)
              # Decrease number of Java threads
              # Decrease Java thread stack sizes (-Xss)
              # Set larger code cache with -XX:ReservedCodeCacheSize=
              # This output file may be truncated or incomplete.
              #
              # Out of Memory Error (arena.cpp:197), pid=920, tid=1078
              #
              # JRE version: OpenJDK Runtime Environment (11.0.9+11) (build 11.0.9+11-post-Raspbian-1deb10u1)
              # Java VM: OpenJDK Server VM (11.0.9+11-post-Raspbian-1deb10u1, mixed mode, g1 gc, linux-)
              # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
              #

              --------------- S U M M A R Y ------------

              Command Line: -Xms400M -Xmx2700M /home/pi/minecraft/paperclip.jar

              Host: rev 3 (v7l), 4 cores, 7G, Raspbian GNU/Linux 10 (buster)
              Time: Wed Nov 4 22:47:31 2020 EST elapsed time: 441.587734 seconds (0d 0h 7m 21s)

              1. Avatar for James A. Chambers

                Hey Michael,

                It looks like you’re getting out of memory errors. How much memory did you allocate to the server?

                If I am reading these lines right you gave it 7G. Can you try lowering it to 6G? I think the operating system is getting choked out (all of your other processes combined are using more than 1GB) so it is killing the Minecraft server to get enough memory to prevent the system from crashing.

                If you lower your memory usage down (just run SetupMinecraft.sh again and it will let you choose the memory limits) see if that eliminates the problem!

              2. Avatar for Michael

                I allocated 2700M as that was the max and recommended amount during setup. You think I should back that down? I didn’t think 2700M was much since it’s an 8GB PI.

                Thanks for the response!

              3. Avatar for James A. Chambers

                Hey Michael,

                In that case, let’s try increasing it. Try 5-6GB just as a test here. Basically we can see from that log that Java doesn’t have enough memory to do what it’s trying to do. Let’s try it at 5-6GB from the setup. If that works I’ll definitely update the script to recommend higher when it’s available!

              4. Avatar for Michael

                Out of curiosity I changed the allocated memory to 2000 during the setup process and it’s been running all day. Any clue why it was failing when memory was set to 2700? It’s an 8GB PI…

                Very strange.

              5. Avatar for James A. Chambers

                There are some limitations around 3GB or so for Java processes if you are running a 32bit OS. Are you running 32 bit Raspbian or 64 bit? If you are running the 64 bit version you can use up a lot more memory for each process so I definitely recommend that one if you’re on a 32 bit!

                I’m glad you narrowed it down! All I had to go off was that memory error message so I’m glad you were able to piece the rest of it together and at least get it to stop closing. I’m sure this will help others as well.

                Can you tell us exactly what OS and whether it’s 32 or 64 bit? For reference I have just been using the 64-bit Raspbian preview from May available but I imagine most people are using 32 bit that are having this problem.

              6. Avatar for Michael

                I’m running Raspbian 32-Bit on Raspberry Pi 4 8GB. I have the memory set to 2000M and it seems to be running fine with 2 people online…..I haven’t tested with more people yet.

Leave a Comment

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

Type here..

Exit mobile version