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,105 thoughts on “Raspberry Pi Minecraft Server Setup Script w/ Startup Service”

  1. Avatar for Xavi Banús

    Greetings!

    I’m running it on a Rpi 2 and oh boy I had problems, I’ve been trying to run th the latest 19 version for 2 days without any luck until I tried the 17.1

    And now it works flawlessly! Thanks a lot for your work.

    I have a question, how can I acces the server command line? I can see the service runs a SCREEN process, but I cannot figure out how can I access it to type commands on the server.

    Thanks a bunch!

  2. Avatar for Rael

    Hi James,

    Less of a technical question here but Is there any way to get the server running with forge and mods?
    Or am I approaching this wrong by trying to install forge onto the server created by your script?

    Cheers,
    Rael

    1. Avatar for James A. Chambers

      Hey Rael,

      Welcome! So Forge is typically a separate system. There used to be Spigot / Forge mods combined but I think they are for like Minecraft 1.12 or some ancient version that nobody would realistically want to run anymore.

      It sounds like there are some other “hybrid” servers out there mentioned in that reddit thread but none of that is definitely what this project uses. I’d have to make a separate Forge container which I’ve considered doing but there are like dozens of these different mod projects. I’d have to sift through all the projects and figure out which Forge versions are actually popular, updated quickly, and not a huge pain to support.

      The reason I’ve never been very interested in Forge is because it’s basically a heavy client-side mod scene. These scenes always annoy me where I have to install some separate launcher and 20 separate mods to connect to someone’s modded server. Valheim has the exact same subset within it’s community that are more than willing to do this (but they’re a minority just like in Minecraft).

      But why? You can use resources packs and literally give clients new artwork without them having to mod it. There’s Spigot versions of almost every Forge mod. I guess the exception would be the really, really strange client-side modding stuff that literally just doesn’t exist at all in Minecraft. I suppose if you want mods like this then Forge would probably be the way to go.

      Supporting an ecosystem like this is probably a lot more of an undertaking than I’d be willing to commit to. I’ve got 2 standalone versions and 4 containers to maintain and I know I would never personally use the Forge version. I tried it probably 5-6 years ago or so and it was exactly as I described. It’s a whole bunch of extra junk to install and it’s all stuff I know how to do other ways via Spigot (without requiring my players to lift a finger). Perhaps someone would like to fork one of these to a Forge version someday (that would be totally okay with me).

      Hopefully that helps!

      1. Avatar for Rael

        Hi James!
        Yeah I can absolutely see your point. I can imagine that it’s a lot of work and you’ve got plenty on your hands already anyways. Thank you for taking the time to reply to my question though 🙂
        Cheers

        1. Avatar for James A. Chambers

          Hey Rael,

          No problem at all! I should also mention that I said the same thing about having a Docker version for years. I now have 4 Docker flavors of various Minecraft servers. The community was right about the Docker version (it’s better, and I insisted years ago it wouldn’t be, then I finally tried it and it was).

          The usage of these projects is growing. I think I got 4-5 tips this last update throughout the various projects. That’s the most ever. It used to be maybe 1-2 per Minecraft update. This is not something I ask people to do. It’s organic so the fact that it has grown so much so fast tells me there are just a lot more people using it now statistically.

          If usage of all my existing projects continues to grow like that I would be able to do things like a Forge container even if I know it’s not one I personally would use. At that point I suppose I’ve reached having enough resources to support it despite not using it personally. There’s nothing wrong with Forge or using client side mods even though it’s not my preference for sure.

          In fact the reason I made the Purpur version (downstream from Paper) of the Docker container is someone donated $100 to make it (through GitHub which doubles contributions every month up to $1000 so I ended up getting $200). I pay $60 a year for a Docker Hub subscription that gives me slots for 5 containers so it made sense to me to make this even though I’d never tried Purpur before.

          Obviously if you tried to hire a developer to make a custom project for you it would cost thousands of dollars (at a minimum). That wasn’t the calculation I was making. He was still asking me to make it but he was essentially putting up the money to host it for it’s entire lifetime. That was why I said yes for sure on that project as then I get to add another project to my catalog which will bring in new users and more attention (which further benefits the projects). It was a win-win for both of us and my projects were small enough at the time that growing the catalog was worth it to me to put up my own time for it.

          They basically paid for more than 3 years of the Docker Hub subscription I have to pay for benefiting all the containers / projects and taking a bunch of pressure off my financial wallet that would normally make me hesitate from taking on requests like this. I knew making the container itself wouldn’t be too hard as I kind of have a “system” going here where I could easily swap out Paper for Purpur (or Forge or another server flavor). It would be similar for Forge if I knew the best offering to put together if that makes sense.

          I still have 1 slot left on my Docker account before I’d have to upgrade to a much more expensive Business/Enterprise level account. I haven’t decided how this is going to be used yet. Forge is a possibility. I’ve looked into SpongeForge before as an example. For the moment I’ve just been focusing on growing the existing projects and trying to gauge what might be the best use of that last slot (and be useful to the most people/servers). Perhaps someone will offer to sponsor another flavor. I consider that a pretty good gauge of interest if someone is willing to put their money where their mouth is and it worked out well for the Purpur version.

          I’ve learned to never say never though. I was wrong about Docker and whether it would be worth it to make Docker versions and I’m probably wrong about Forge too (but am leaving the door completely open if there’s enough interest in the projects to justify it). Even if I don’t do any new projects and they continue growing at the rate they have been the growth is giving me some new opportunities to make things that I would not have previously imagined.

          Enjoy and take care!

  3. Avatar for Icesword

    Hey James,
    I have a question regarding the multithreading performance on the raspberry pi 4. I noticed that in the paper-global file it is using -1 value in the Io-threads and -1 in the worker thread as follows in the “chunk -system”

    ( chunk-system:
    gen-parallelism: default
    io-threads: -1
    worker-threads: -1
    )

    I tried changing it to 4 for both values and i noticed the chunk generation is a bit faster for any unexplored area on the server than it was previously while monitoring the CPU usage on ‘htop’ command. Is it possible if you can Confirm that theory?
    Btw, Your blog is a work of art and it has helped me in learning many new topics. Much appreciated!!!

    This is the file directory:
    /home/pi/minecraft/config/paper-global.yml

    Iam using Raspberry pi4 with raspian os 64 bit latest “clean installation” and A400 kingston SSD to usb 3.0

    1. Avatar for James A. Chambers

      Hey Icesword,

      That’s a great question. I hadn’t really seen this option much before and it doesn’t sound like it is very old. I did find a reference here that talks about it (Ctrl+F and then “io-threads”).

      It says:

      With the introduction of chunk rewrite patch, these options are provided for server owners to fine tune the new chunk system to their needs.

      Please note that default value is likely going to be the most optimal option for majority of servers. It is crucial to not overalocate workers as it may negetatively impact server performance.

      I wonder what it is choosing by default exactly. It makes sense why this would help honestly. The Raspberry Pi struggles the most with chunk generation and loading/saving over anything else. I’m not sure if 4 is the right amount of threads though since the Pi 4 only has a quad core processor. That’s a thread for each processor core (although maybe that’s what you were going for). I wonder though if something like 2-3 might give you the same benefits while reducing any “downsides” they are warning about here of setting it too high.

      They say it is provided to help fine tune for sure. It makes sense that the server wouldn’t be tuned with a Pi 4 in mind (and it never has been). I would say if it’s helping this is absolutely worth it and a very interesting setting. It sounds like they did a major rewrite of this system within the past couple of major Minecraft versions (judging from their GitHub which is linked in the article). I’d be interested to see if you get relatively the same benefits setting it to 2 or 3. Hopefully that helps!

      1. Avatar for Icesword

        Hey James,
        Thank you so much for the attached reference. When I tried running it in the default value it displayed in the terminal as 1 Io thread and 1 worker thread.
        When i changed it to 4 I tried pushing the raspberry pi 4 to the limit by going to any unexplored area with 3 people on the server. It seems that if i put the setting to 4 it causes a delay for people on the server when I to generate new chunks although the opposite happens when I change it to 2. It seems that all the resources goes to the Chunk system leaving the server lagging when the Setting was set to 4 during generation of new chunks.
        i will leave it at 2 for the moment and try to generate new chunks using Chunky plugin when no one is online.
        again, Thank you for your time and help.

        1. Avatar for James A. Chambers

          Hey Icesword,

          Thanks so much for testing those, I was really curious. That sounds completely right to me too. If you are giving it 4 threads it is going to let it swamp all 4 CPU cores with chunk I/O at the expense of everything else that needs to be done by the server. This is likely what they’re warning about with setting it too high and “negatively impacting performance” and it does make sense.

          It does sound like it is worth setting it potentially to 2 though. That would be half your CPU cores and seems reasonable. Thanks for testing and sharing, enjoy and have fun!

  4. Avatar for Mertrogg

    Hi! I’m back once again and updated to 1.19. However, now the server just won’t start.
    I read through this section here to find out if someone else has similar issues and I tried this command “sudo systemctl status Minecraft”
    That’s what I’m getting:

    Loaded: loaded (/etc/systemd/system/minecraft.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Thu 2022-11-17 17:48:16 CET; 18min ago

    Nov 17 17:48:03 raspberrypi bash[739]: Latest paperclip build found: 271
    Nov 17 17:48:03 raspberrypi bash[739]: % Total % Received % Xferd Average Speed Time Time Time Current
    Nov 17 17:48:03 raspberrypi bash[739]: Dload Upload Total Spent Left Speed
    Nov 17 17:48:06 raspberrypi bash[739]: [395B blob data]
    Nov 17 17:48:12 raspberrypi bash[739]: Starting Minecraft server. To view window type screen -r minecraft.
    Nov 17 17:48:12 raspberrypi bash[739]: To minimize the window and let the server run in the background, press Ctrl+A then Ctrl+D
    Nov 17 17:48:16 raspberrypi systemd[1]: Started Minecraft Server Service.
    Nov 17 17:48:16 raspberrypi bash[1495]: Server is not currently running!
    Nov 17 17:48:16 raspberrypi systemd[1]: minecraft.service: Control process exited, code=exited, status=1/FAILURE
    Nov 17 17:48:16 raspberrypi systemd[1]: minecraft.service: Failed with result 'exit-code'.

    Any ideas how to fix this? Whenever I start the start script it downloads the latest version of paper but after that, nothing.

    Thank you!!

    1. Avatar for James A. Chambers

      Hey Mertrogg,

      Welcome back! So we actually need to look at the log files. Those are located in the “logs” folder in your ~/minecraft folder and these should tell us what is going wrong.

      Can you take a look at those and we should be able to see what is going wrong here!

      1. Avatar for Mertrogg

        Thanks for the superfast reply! So there are no recent log files generated. Does that mean that the server can’t execute java properly?

        1. Avatar for James A. Chambers

          Hey Mertrogg,

          Yes, that is usually what it means. It might be something different in this case though. I’m seeing this:

          Nov 17 17:48:03 raspberrypi bash[739]: % Total % Received % Xferd Average Speed Time Time Time Current
          Nov 17 17:48:03 raspberrypi bash[739]: Dload Upload Total Spent Left Speed
          Nov 17 17:48:06 raspberrypi bash[739]: [395B blob data]

          It says you only downloaded 395 bytes for the paperclip.jar file. This seems wrong. Have you rebooted the server machine recently? Things seem… strange.

          Can you try running the server manually by going to the Minecraft server folder and just running:

          java -jar paperclip.jar

          You may need to use something like:

          /home/youruser/minecraft/jre/bin/java -jar paperclip.jar

          You might not even have a paperclip.jar though if it’s only downloading 395 bytes. That’s probably something to check. What is the file size of paperclip.jar? It seems like it’s maybe having network/download issues. Rebooting your router might help too as it seems like strange/flaky behavior for sure (the kind that is hard to explain and goes away when you restart the device)!

          You might also want to run fixpermissions.sh. Maybe it can’t save the file properly although we should see some kind of error message I’d think but fixpermissions.sh may be in order since you did just upgrade.

          I suppose it’s also possible your original JDK download failed and you have a corrupt OpenJDK. If this is the case then running SetupMinecraft.sh again will fix it (it will always refresh the JDK when you run SetupMinecraft.sh so if something went wrong this will retry it and it should succeed). This may be worth a try for this one as well!

          1. Avatar for Mertrogg

            So I checked the paperclip.jar file. It’s 38mb big so that should be okay. I also ran the command and the server eventually started!
            "Downloading mojang_1.19.2.jar
            Applying patches
            Starting org.bukkit.craftbukkit.Main
            System Info: Java 18 (OpenJDK Server VM 18.0.2.1+1) Host: Linux 5.10.103-v7l+ (arm)
            Loading libraries, please wait...
            [19:14:22 INFO]: Building unoptimized datafixer
            [19:14:27 INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionse rver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'


            Is my script weird cause it cannot start the server but the single java command does?

            1. Avatar for James A. Chambers

              Hey Mertrogg,

              Great testing, you’ve definitely narrowed it down. It definitely sounds like the downloaded Java is broken. You can fix this by running SetupMinecraft.sh again as it means your original Java download failed.

              You are using the system Java now which the script doesn’t actually use. The script uses it’s own JDK. Running SetupMinecraft.sh again should take care of this for you here!

              1. Avatar for Mertrogg

                Perfect, I’ll do that. Should I delete the jre folder to be safe? Also, where’s the setupminecraft.sh located? I can’t find it.
                Thanks again and have a beautiful rest of your day.

              2. Avatar for Mertrogg

                So I updated minecraft with your script and configured everything. It said JDK has been successfully installed. But the same problem occurs. It just won’t take the java provided with your package. Any ideas?

              3. Avatar for James A. Chambers

                Hey Mertrogg,

                It’s hard to say. It’s just the ARM OpenJDK Adoptium binary package. You can try running it with:

                /home/youruser/minecraft/jre/bin/java -version

                Did you set your memory limit way too high or something? That isn’t included when you run it manually so if you set too high of a memory limit you wouldn’t see this unless you used the exact command from start.sh. Maybe we should have you try this. Go into start.sh and try running the exact command from start.sh on the command line so you can see what happens. You can try it with both the system Java and you can try it with the packaged Java. I really think this is one of the only things that could explain this.

                If I’m right you’ll get some kind of heap error and you’ll need to lower the amount of memory by running SetupMinecraft.sh again and choosing a lower value. This will stop any heap errors. If you used the exact same memory limit as you always have that is likely the problem as the requirements seem to rise every single new OpenJDK release (and Minecraft release) so you may need to leave more room for OpenJDK (by lowering the memory allocation, not raising it).

                I’d be curious if you can run the included Java and what happens when you manually run the command from start.sh. I don’t see any reason why you wouldn’t be able to unless the download didn’t work or you configured a memory limit that it can’t take (which won’t apply when you run it manually, there’s no preallocated RAM when you run it that way and if that is the problem it would explain it)!

              4. Avatar for Mertrogg

                So there is no jre folder in my pi directory. Also when I run “screen -dmS minecraft /home/pi/minecraft/jre/bin/java -DPaper.IgnoreJavaVersion=true -jar -Xms400M -Xmx2100M /home/pi/minecraft/paperclip.jar” nothing happens. As if there is no java which can be executed. I checked the size of the “jre” folder in home/pi/minecraft and it’s something around 120mb of size. Is that correct?
                I set the memory limit at 2100 so that should be fine I think. I got a raspberry pi 4 with 4 gigs of ram.

              5. Avatar for James A. Chambers

                Hey Mertrogg,

                Try:

                cd /home/pi/minecraft
                /home/pi/minecraft/jre/bin/java -DPaper.IgnoreJavaVersion=true -jar -Xms400M -Xmx2100M paperclip.jar

                You don’t want the screen stuff as that will just detach it. We want to see what is actually happening. Can you give that a try here?

                If there is no Java there then it should say that. The folder size sounds right though. My guess is that if you type the “free” command that you don’t actually have 2.1GB of free memory. You have to leave room for all the other applications and the operating system itself which will not show up as “available” memory in the “free” command. You should be able to tweak the memory parameters just like that until you figure out which ones will launch with your current configuration.

              6. Avatar for Mertrogg

                So this is what I’m getting as output:

                Error occurred during initialization of VM
                Can not represent all cards in the heap with card region/card within region. Hea p 2202009600B (4294967295 bits) Remembered set covers 53 bits.: Decrease heap size.

                It looks like you were right about the size. How do I set it right? I think we’re getting close to fixing the problem it seems!! 😀

              7. Avatar for James A. Chambers

                Hey Mertrogg,

                Great work! That’s such a hard error to find/see and so I’m glad we did a manual launch. So what I would do for this one is just start gradually turning it down.

                The parameter you will change is the -Xmx2100M. Try dropping it to 2000M, 1900M, etc. and see where it will launch. When you find it I would actually go a step lower to give it some “breathing room”. Maybe an extra 100MB-200MB or so?

                You definitely want some breathing room because if you set it razor thin then it will just crash when a system background task like updates runs and spikes the memory usage. That is how I would find the sweet spot for this one!

                Once you’ve found it you can either modify start.sh or you can just run SetupMinecraft.sh again and give it the updated memory amount and it will safely update everything for you (and should start launching normally again). I’m guessing the changes in OpenJDK 18 and Minecraft 1.19 and them just requiring more memory in general is what is causing you some pain here.

                It’s a weird balancing act because even though I am saying they are requiring more memory what I mean is that they are taking up more memory for themselves and squeezing everything else. Because of this we counterintuitively have to turn the memory allocation *down* because the actual issue is that it’s squeezing everything else too tight to the point where it can’t fit what you are asking into memory (when you take everything else into account) which is what the heap error is telling us. In other words because Minecraft and OpenJDK are using more memory for themselves we have to lower how much we give the server overall to take that overhead into account.

                Once we tweak the numbers for 1.19 you should have uninterrupted server operation again!

  5. Avatar for Florian

    Hello James,
    I have a problem with the server for some reason tnt duping does not work on the server. Can you help me?

    1. Avatar for James A. Chambers

      Hey Florian,

      No problem, I think I can help! These settings are in paper.yml that control this. Here are the settings related to this:

      • If you want to dupe TNT, carpets, and other items: allow-piston-duplication: true
      • If you want to break bedrock, portal frames, and other unbreakable blocks: allow-perm-block-break-exploits: true
      • If you want to create headless pistons or have exploits that require them: allow-headless-pistons: true
      • If you want to enable usernames with special characters: perform-username-validation: false

      Essentially these are all controlled by settings. You should be able to enable the behavior with those. Hopefully that helps!

  6. Avatar for Ulli

    Hi James,

    I use a Raspberry 4 with 8GB and the 32-bit-Raspbian OS.

    When using your script I receive the following error:

    ● minecraft.service - Minecraft Server Service
    Loaded: loaded (/etc/systemd/system/minecraft.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Sun 2022-09-11 14:24:08 CEST; 14s ago
    Process: 3999 ExecStart=/bin/bash /home/pi/minecraft/start.sh (code=exited, status=0/SUCCESS)
    Process: 4093 ExecStop=/bin/bash /home/pi/minecraft/stop.sh (code=exited, status=1/FAILURE)
    CPU: 3.002s

    Sep 11 14:22:29 raspberrypi bash[4048]: % Total % Received % Xferd Average Speed Time Time Time Current
    Sep 11 14:22:29 raspberrypi bash[4048]: Dload Upload Total Spent Left Speed
    Sep 11 14:24:07 raspberrypi bash[4048]: [7.7K blob data]
    Sep 11 14:24:07 raspberrypi bash[3999]: Starting Minecraft server. To view window type screen -r minecraft.
    Sep 11 14:24:07 raspberrypi bash[3999]: To minimize the window and let the server run in the background, press Ctrl+A then Ctrl+D
    Sep 11 14:24:07 raspberrypi systemd[1]: Started Minecraft Server Service.
    Sep 11 14:24:08 raspberrypi bash[4093]: Server is not currently running!
    Sep 11 14:24:08 raspberrypi systemd[1]: minecraft.service: Control process exited, code=exited, status=1/FAILURE
    Sep 11 14:24:08 raspberrypi systemd[1]: minecraft.service: Failed with result 'exit-code'.
    Sep 11 14:24:08 raspberrypi systemd[1]: minecraft.service: Consumed 3.002s CPU time.

    Any idea how to fix this?
    What means “code=exited, status=1/FAILURE”?

      1. Avatar for Ulli

        Hi James,

        first of all: thank you for your quick reply!
        I did use your script previously and it worked always very well.

        The log file folder is empty.

        Here is the complete installation from your script. Maybe this helps?

        pi@raspberrypi:~ $ curl https://raw.githubusercontent.com/TheRemote/RaspberryPiMinecraft/master/SetupMinecraft.sh | bash
        % Total % Received % Xferd Average Speed Time Time Time Current
        Dload Upload Total Spent Left Speed
        100 18226 100 18226 0 0 66761 0 --:--:-- --:--:-- --:--:-- 67007
        Minecraft Server installation script by James A. Chambers - https://jamesachambers.com/
        Version 1.19.2 will be installed. To change this, open SetupMinecraft.sh and change the "Version" variable to the version you want to install.
        Latest version is always available at https://github.com/TheRemote/RaspberryPiMinecraft
        Don't forget to set up port forwarding on your router! The default port is 25565
        Installing screen, sudo, net-tools, curl...
        OK:1 http://archive.raspberrypi.org/debian bullseye InRelease
        OK:2 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
        Paketlisten werden gelesen… Fertig
        Paketlisten werden gelesen… Fertig
        Abhängigkeitsbaum wird aufgebaut… Fertig
        Statusinformationen werden eingelesen… Fertig
        net-tools ist schon die neueste Version (1.60+git20181103.0eebece-1).
        Das folgende Paket wurde automatisch installiert und wird nicht mehr benötigt:
        libfuse2
        Verwenden Sie »sudo apt autoremove«, um es zu entfernen.
        0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
        Paketlisten werden gelesen… Fertig
        Abhängigkeitsbaum wird aufgebaut… Fertig
        Statusinformationen werden eingelesen… Fertig
        Das folgende Paket wurde automatisch installiert und wird nicht mehr benötigt:
        libfuse2
        Verwenden Sie »sudo apt autoremove«, um es zu entfernen.
        Die folgenden zusätzlichen Pakete werden installiert:
        libutempter0
        Vorgeschlagene Pakete:
        byobu | screenie | iselect
        Die folgenden NEUEN Pakete werden installiert:
        libutempter0 screen
        0 aktualisiert, 2 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
        Es müssen 560 kB an Archiven heruntergeladen werden.
        Nach dieser Operation werden 983 kB Plattenplatz zusätzlich benutzt.
        Holen:1 http://mirror.netzwerge.de/raspbian/raspbian bullseye/main armhf libutempter0 armhf 1.2.1-2 [8.596 B]
        Holen:2 http://mirror.netzwerge.de/raspbian/raspbian bullseye/main armhf screen armhf 4.8.0-6 [551 kB]
        Es wurden 560 kB in 1 s geholt (968 kB/s).
        Vormals nicht ausgewähltes Paket libutempter0:armhf wird gewählt.
        (Lese Datenbank ... 106154 Dateien und Verzeichnisse sind derzeit installiert.)
        Vorbereitung zum Entpacken von .../libutempter0_1.2.1-2_armhf.deb ...
        Entpacken von libutempter0:armhf (1.2.1-2) ...
        Vormals nicht ausgewähltes Paket screen wird gewählt.
        Vorbereitung zum Entpacken von .../screen_4.8.0-6_armhf.deb ...
        Entpacken von screen (4.8.0-6) ...
        libutempter0:armhf (1.2.1-2) wird eingerichtet ...
        screen (4.8.0-6) wird eingerichtet ...
        Trigger für install-info (6.7.0.dfsg.2-6) werden verarbeitet ...
        Trigger für libc-bin (2.31-13+rpt2+rpi1+deb11u4) werden verarbeitet ...
        Trigger für man-db (2.9.4-2) werden verarbeitet ...
        Creating minecraft server directory...
        Installing OpenJDK...
        % Total % Received % Xferd Average Speed Time Time Time Current
        Dload Upload Total Spent Left Speed
        0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
        100 41.3M 100 41.3M 0 0 3713k 0 0:00:11 0:00:11 --:--:-- 4850k
        OpenJDK installation completed.
        Getting total system memory...
        Total memory: 7899 - Available Memory: 7078
        Warning: You are running a 32 bit operating system which has a hard limit of 3 GB of memory per process
        You must also leave behind some room for the Java VM process overhead. It is not recommended to exceed 2700 and if you experience crashes you may need to reduce it further.
        You can remove this limit by using a 64 bit Raspberry Pi Linux distribution (aarch64/arm64) like Ubuntu, Debian, etc.
        Total memory: 7899 - Available Memory: 2700
        Please enter the amount of memory you want to dedicate to the server. A minimum of 700MB is recommended.
        You must leave enough left over memory for the operating system to run background processes.
        If all memory is exhausted the Minecraft server will either crash or force background processes into the paging file (very slow).
        Enter amount of memory in megabytes to dedicate to the Minecraft server (recommended: 2400): 2400
        Amount of memory for Minecraft server selected: 2400 MB
        Getting latest Paper Minecraft server...
        % Total % Received % Xferd Average Speed Time Time Time Current
        Dload Upload Total Spent Left Speed
        100 195 100 195 0 0 135 0 0:00:01 0:00:01 --:--:-- 135
        % Total % Received % Xferd Average Speed Time Time Time Current
        Dload Upload Total Spent Left Speed
        100 36.4M 100 36.4M 0 0 323k 0 0:01:55 0:01:55 --:--:-- 315k
        Building the Minecraft server...
        Error occurred during initialization of VM
        Can not represent all cards in the heap with card region/card within region. Heap 2516582400B (4294967295 bits) Remembered set covers 53 bits.: Decrease heap size.
        Accepting the EULA...
        Grabbing start.sh from repository...
        % Total % Received % Xferd Average Speed Time Time Time Current
        Dload Upload Total Spent Left Speed
        100 12095 100 12095 0 0 47806 0 --:--:-- --:--:-- --:--:-- 47996
        Grabbing stop.sh from repository...
        % Total % Received % Xferd Average Speed Time Time Time Current
        Dload Upload Total Spent Left Speed
        100 1631 100 1631 0 0 6970 0 --:--:-- --:--:-- --:--:-- 6970
        Grabbing restart.sh from repository...
        % Total % Received % Xferd Average Speed Time Time Time Current
        Dload Upload Total Spent Left Speed
        100 2207 100 2207 0 0 8757 0 --:--:-- --:--:-- --:--:-- 8723
        Grabbing fixpermissions.sh from repository...
        % Total % Received % Xferd Average Speed Time Time Time Current
        Dload Upload Total Spent Left Speed
        100 826 100 826 0 0 2858 0 --:--:-- --:--:-- --:--:-- 2868
        Grabbing update.sh from repository...
        % Total % Received % Xferd Average Speed Time Time Time Current
        Dload Upload Total Spent Left Speed
        100 853 100 853 0 0 2872 0 --:--:-- --:--:-- --:--:-- 2872
        Enter a name for your server...
        Server Name: Aioli
        % Total % Received % Xferd Average Speed Time Time Time Current
        Dload Upload Total Spent Left Speed
        100 312 100 312 0 0 1094 0 --:--:-- --:--:-- --:--:-- 1094
        Minecraft can automatically start at boot if you wish.
        Start Minecraft server at startup automatically (y/n)?y
        Created symlink /etc/systemd/system/multi-user.target.wants/minecraft.service → /etc/systemd/system/minecraft.service.
        Your time zone is currently set to Europe/Berlin. Current system time: So 11. Sep 19:06:56 CEST 2022
        You can adjust/remove the selected reboot time later by typing crontab -e
        Automatically reboot Pi and update server at 4am daily (y/n)?y
        no crontab for pi
        Daily reboot scheduled. To change time or remove automatic reboot type crontab -e
        Setting server file permissions...
        Setup is complete. Starting Minecraft server...
        Must be connected to a terminal.
        Must be connected to a terminal.
        pi@raspberrypi:~ $

        1. Avatar for James A. Chambers

          Hey Ulli,

          Fascinating. I do see something here I haven’t encountered before:

          Error occurred during initialization of VM
          Can not represent all cards in the heap with card region/card within region. Heap 2516582400B (4294967295 bits) Remembered set covers 53 bits.: Decrease heap size.

          Thanks for checking the log files location as well. The fact that it is empty tells us that this strange heap error is in fact preventing it from running the server it looks like here. I take it this is also Raspberry Pi OS judging by the username being pi.

          Can you decrease the amount of memory you are allocating for the server? I know it seems counter-intuitive but these errors typically mean there isn’t enough memory available for it to use as much as we’re telling it to (while most people read them as it doesn’t have enough memory allocated to the server and will often try to increase it when it needs to actually be decreased).

          I definitely do highly recommend using a 64 bit OS instead (there is a 64 bit version of Raspberry Pi OS available). It looks like that is a 8 GB Pi. If you were using a 64 bit OS you could allocate a lot more memory to the server than 2400M but on 32 bit you might have to decrease it for it to even run since 32 bit has some significant per-process memory limitations (and room needs to be left for Java itself to run).

          Can you try with something like 2000M for the memory amount instead of 2400M? If this works I may need to lower the memory recommendation to leave room for other processes because it failed you in that case going with the recommended amount which is definitely my fault (or at least something within my control / that I can fix). Can you give that a try and let’s see if it changes here!

            1. Avatar for James A. Chambers

              Hey Ulli,

              Thanks for confirming! I will adjust this as what has happened is that I set that memory limit several years ago and it has not been updated since then. Java has changed a lot though in the mean time and we are all the way on OpenJDK 18 (and these recommendations are probably from the early teens). It looks like my recommendation just needs to be updated to take changes into account.

              Enjoy and take care!

              1. Avatar for James A. Chambers

                Hey Ulli,

                Thank you so much! I saw you sent that. I can’t tell you how much of a difference that made for me that day as I had just got back from a trip and was feeling really overwhelmed and honestly a little like what I was doing wasn’t making a difference.

                It was one of those things that it was just right at the right moment (but you couldn’t have known that). Thank you again!

              2. Avatar for Michael

                Hi James,
                Just an FYI. I had this same issue today when updating to Minecraft v1.19.2. I used the recommended 2100M for memory (even though I know I used 2300M previously). But Java failed to start with the same “decrease heap size” error. I lowered it to 2000M and it’s working again. I thought you might want to know that 2100M still might be too high. I’m using a Raspberry Pi 4 with 4GB RAM and 32-bit Raspbian. I wanted to wait to update to 64-bit once I can get my hands on another Pi but unfortunately, that doesn’t seem like that will happen any time soon.

                Thanks,
                Michael

              3. Avatar for James A. Chambers

                Hey Michael,

                Thanks for leaving this, that actually does help me! I will adjust it down a little bit more even. I’m not surprised the newer versions are using a little bit more.

                Thanks for checking in, I hope you continue to enjoy it!

Leave a Comment

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

Type here..

Exit mobile version