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:
- The Docker version that has Geyser + Floodgate installed (allowing people running Minecraft Bedrock Edition such as on iOS, Android, and console to connect)
- The Docker version that runs the Purpur Minecraft server with Geyser + Floodgate installed (allowing people running Minecraft Bedrock Edition to connect)
- The Docker version that only includes the Paper Minecraft server (the same as this standalone version)
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
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*
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*
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*
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:
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:
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
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
Fix for updating to 1.17.1
Usually it is sufficient to update the SetupMinecraft.sh, update the version line and then run setup. For whatever reason this seems broken for 1.17.1 – at least it did not work in my case. In order to fix this, go into the Minecraft folder, nano start.sh and change the version link towards the bottom of the file from 1.17 to 1.17.1 – this should fix it. I am no script pro but that seems to also survive a reboot
You are quick, thanks! The only thing that is different now is you need to set the AllowLocalCopy=”0″ line below the version to AllowLocalCopy=”1″. Otherwise it will ignore your changes and run the online version! It’s basically just a flag to make sure people really actually want to run that local version as 95% of the time people were trying to reuse an old version and they didn’t realize that SetupMinecraft.sh itself had been updated to fix the problems they were having.
I’ve updated the main script here and committed it to GitHub as well, thanks again!
I was not aware of the full meaning of AllowLocalCopy, especially as when you change the version line the Script tells you it will setup 1.17.1
Another thing that nearly threw me of: the new question on install directory might need a little bit of a hint that you usually can leave it empty
With kids and a pandemic, Minecraft becomes essential. It is funny that you thank me when you are the one that makes so many people happy. Thanks! Also in the name of 3 Minecraft Servers. The only thing I now need is an official version of Raspberry 64 bit so that all can make use of the 4gb ram – tried Ubuntu with your guide but was not able to do simple things like making it shut down on and start up on button press with one simple line change with adding this line to the boot/config.txt
dtoverlay=gpio-shutdown,gpio_pin=17,active_low=1,gpio_pull=up,debounce=1000
If you want to add this to your script as a question (do you want to create a shutdown button, which pin, how long to press to avoid accidental shutdown (that is the denounce value here set to 1sec to avoid accidental button press) you will become my all time hero 🙂
Hey Briesenpap,
No worries, I updated the documentation both here and GitHub to explain it better (as well as added a comment right above the AllowLocalCopy line, it was uncommented before). It’s brand new for sure!
The 64 bit is a worthy upgrade for sure. I hate to toot my own horn but I have a guide especially for this (including where to get the latest 64 bit image)!
I think the 64 bit should be just what you need to get it going! I haven’t tried with a shutdown button but I would totally be open to investigating it. Thanks for the kind words and have fun!
same thing damit
pi@raspberrypi:~ $ cd ~/minecraft
pi@raspberrypi:~/minecraft $ ./start.sh
Updating to most recent paperclip version ...
--2021-07-08 15:35:45-- https://papermc.io/api/v1/paper/1.17/latest/download
Resolving papermc.io (papermc.io)... 2606:4700:20::681a:c8a, 2606:4700:20::ac43:48c6, 2606:4700:20::681a:d8a, ...
Connecting to papermc.io (papermc.io)|2606:4700:20::681a:c8a|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 60391784 (58M) [application/java-archive]
Saving to: ‘paperclip.jar’
paperclip.jar 100%[==================================>] 57.59M 771KB/s in 2m 17s
2021-07-08 15:38:02 (431 KB/s) - ‘paperclip.jar’ saved [60391784/60391784]
Starting Minecraft server. To view window type screen -r minecraft.
To minimize the window and let the server run in the background, press Ctrl+A then Ctrl+D
Cannot make directory '/run/screen': Permission denied
pi@raspberrypi:~/minecraft $
Hey liam,
That means your system is broken. It can’t create /run/screen which is a public folder. There’s nothing with the scripts I can do to fix your partitions basically. Your files on your SD card are corrupted. It can’t write to things that it should be able to write to. You might even have to buy a new SD card. They fail all the time for the Pi. It’s quite common.
I would honestly create the SD card again from scratch using the Raspberry Pi imager. You can try to do a fsck repair on the system but if the system is that new I would image your SD card again brand new! If that doesn’t work then this SD card has failed and needs to be warrantied/replaced.
but i have installed quite a few servers on here but whats even weirder is i can start “a” server with this command line(java -Xmx500M -Xms500M -jar server.jar nogui)
but let me know if there is anything might need to change in order to do this?
like i said in the previous post i have vnc server so just let me know if you have some free time to help me do that:)
Hi James,
I’ve been running my server with the help of your script on my raspberry pi running ubuntu for about half a year now. I’ve been planning on keeping the server at its current version (1.16.4) until the full cave update. Recently though, I thought of loading a custom made survival map onto the server with the help of the multiverse plugin, to let some of the more bored players have a new experience. This map is made for version 1.16.5 so I had to update the server for the server to be able to load the map. Sadly I can’t find any way to only update my server from 1.16.4 to 1.16.5. I tried running a self written SetupMinecraft.sh script modified to ignore the SetupMinecraft.sh check and edited to update to 1.16.5, sadly any script run form the pi itself fails on line 30 and 35. I even tried making an own github script for private uses to test if that changed anything (I have no idea what I’m doing) but that just failed on line 1. Another strange occurence, is that when I run your older versions of the SetupMinecraft.sh script, it works, but my pi ignores any inputs I have to give, which also means it allocates 0MB of RAM. >ou might be able to tell that I barely know what I’m doing, I’m having a blast learning a lot of new stuff but I just cant seem to get it working. Is there any way or will I have to do with 1.17?
Cheers,
Felix
Hey Felix,
Let’s try it this way:
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 and then ‘y’ to exit nano and save.
chmod +x SetupMinecraft.sh
./SetupMinecraft.sh
Now leave the home directory as the default (~) and it should update the scripts! Mine loaded right up after this so I’m guessing changes made elsewhere to the script isn’t necessary. I have the AllowLocalCopy switch to prevent from having to do that.
I’ve also updated the changing versions section of the article to reflect this. Sorry for not updating it for you earlier!
Let me know if that gets it for you!
Good Morning James,
It worked out perfectly! I think my problem was that I didnt make the File executable or something in that direction, by running the chmod command.
Now it’s all up and running though and I could even load the custom world onto my server.
I’m really thankful for your help!!!
Cheers,
Felix
Hey Felix,
No problem, thanks for asking this as I put my answer right into the instructions (that change was made within the past couple of weeks). Thanks again and enjoy!
BST
You can adjust/remove the selected reboot time later by typing crontab -e
Automatically reboot Pi and update server at 4am daily (y/n)?y
Daily reboot scheduled. To change time or remove automatic reboot type crontab -e
Setup is complete. Starting Minecraft server…
Failed to start minecraft.service: Unit minecraft.service is masked.
Hey liam,
You have all sorts of crazy permissions errors going on here. It’s not resolving names either which is usually a DNS/networking error:
Resolving papermc.io (papermc.io)… failed: Temporary failure in name resolution.
This is also weird:
Failed to start minecraft.service: Unit minecraft.service is masked.
The service shouldn’t be masked. You can enable it by typing:
sudo systemctl enable minecraft
although I won’t be surprised if you get an error enabling the service saying it’s corrupted or something like that.
This error is even more concerning:
Jul 07 13:32:12 raspberrypi bash[3108]: Cannot make directory ‘/run/screen’: Permission denied
That should not happen. Ever. This disk/image/partition is corrupted. You may be able to run the fsck tool on the drive to fix the partitions if it’s just partition errors. It’s very likely that the partition is mounted in read-only mode because it’s damaged meaning you can’t write any files and most of your system services have gone haywire (it’s probably why your DNS/name resolution isn’t working either, the service wouldn’t be able to update /etc/resolv.conf since it’s read-only).
It also says you only have 212mb of available memory and that is what you picked in SetupMinecraft.sh. Unless this is a Raspberry Pi 1 there are no Pis that should have that little of memory. Is there anything else running on the Pi using all the resources?
But I’m seeing so many other errors I’m thinking that this is a failing SD card or needs a reimage!
i have a rasperry pi 4 but at that time i was on your website so it took a lot of my ram but its the 1gb ram version so what do i do then? and could you be able to help me set the server from scratch?. becouse i have been on multiple websites to try and your one is by far the best and most detailed one. so good job its a realy good tutorial. but is there a way to re-do it with just code in the terminal? or do i have to use a different computer becouse my main pc dosnt have a sd card slot and i have no adapters so thats a problem i have vnc server on my pi would you be able at any point to take control and help me at some point?
i am new-ish to a rasperry pi but i know coding but the code a rasperry pi uses kinda confuses me but i understand a bit and i would love if it took like 5 mins to set up but i dunno why its doing this so if you have any plans or anything to do just get in touch.
i am also now updating everything i will see how that goes.
also do i have to have a admin account or do i have to make myself admin somehow?
how do i change the version to 1.17?
because i dont know were to find setup.sh
Hey liam,
You don’t need to do any of that fortunately. Go ahead and run:
curl https://raw.githubusercontent.com/TheRemote/RaspberryPiMinecraft/master/SetupMinecraft.sh | bash
to upgrade to the latest version! When it asks you which folder to put in just leave it as the default (~) to use your existing server as the old version didn’t let you choose the directory. That should be it!
how do i also use less ram on the server becouse it only lets me use 600+mb
and dose it update the world to 1.17
also how do i send my friends the ip?
Hey liam,
On the 1 GB Pi I usually recommend using the lite version that doesn’t come with a desktop included. This isn’t required though and I think it will still work. It sounds like it was working for you before as well but it looks like your SD card has failed / got corrupted. Once you fix that I am sure everything will work again!
Hi, so I updated to 1.17 and the server cannot be accessed anymore. I can see the dynmap but ingame it says the minecraft server is offline!
Also, after 5 minutes, I get the message from java “# There is insufficient memory for the Java Runtime Environment to continue.”
I hope there is a solution 🙁 Thank you
Hey Mertrogg,
Can you try running SetupMinecraft.sh and pick a lower number for your total memory limit? It sounds like it might have picked too high of a number and isn’t leaving enough memory for the rest of the system. After that it should boot up!
I am also having accessing the server after updated to 1.17.
pi@PIr8-Craft:~ $ sudo systemctl start Minecraft
Failed to start Minecraft.service: Unit Minecraft.service not found.
pi@PIr8-Craft:~ $ 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 Mon 2021-07-05 21:12:02 EDT; 35min ago
Jul 05 21:12:02 PIr8-Craft systemd[1]: Starting Minecraft Server Service...
Jul 05 21:12:02 PIr8-Craft bash[3093]: /bin/bash: /home/pi/minecraft/start.sh: No such file or directory
Jul 05 21:12:02 PIr8-Craft systemd[1]: minecraft.service: Control process exited, code=exited, status=127/n/a
Jul 05 21:12:02 PIr8-Craft systemd[1]: minecraft.service: Failed with result 'exit-code'.
Jul 05 21:12:02 PIr8-Craft systemd[1]: Failed to start Minecraft Server Service.
Additionally, the Start, Restart and Stop SH files are being created in the home/pi directory instead of the Minecraft one. Also, the script failed to generate a SetupMinecraft.sh file. Mine was an attempted upgrade from 1.16.5 tp 1.17.0. When it failed the first couple of time I removed all files from the pie an attempted a clean install. Still no luck.
I entered thru the choose a directory questions in an attempt to go with default.
Enter directory path to install Minecraft server (default ~):
Directory Path:
Directory Path : /home/pi -- accept (y/n)?y
Directory Path: /home/pi
Directory minecraft already exists! Updating scripts and configuring service ...
Getting total system memory...
Total memory: 3794 - Available Memory: 3595
Total memory: 3794 - Available Memory: 3595
Please enter the amount of memory you want to dedicate to the server. A minimum of 700MB is recommended.
You must leave enough left over memory for the operating system to run background processes.
If all memory is exhausted the Minecraft server will either crash or force background processes into the paging file (very slow).
INFO: You are running a 64-bit architecture, which means you can use more than 2700MB of RAM for the Minecraft server.
Enter amount of memory in megabytes to dedicate to the Minecraft server (recommended: 3395): 3395
Amount of memory for Minecraft server selected: 3395 MB
Grabbing start.sh from repository...
--2021-07-05 21:41:23-- https://raw.githubusercontent.com/TheRemote/RaspberryPiMinecraft/master/start.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.110.133, 185.199.109.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9816 (9.6K) [text/plain]
Saving to: ‘start.sh’
start.sh 100%[==================================================================================================================>] 9.59K --.-KB/s in 0.001s
2021-07-05 21:41:24 (12.9 MB/s) - ‘start.sh’ saved [9816/9816]
Grabbing stop.sh from repository...
--2021-07-05 21:41:24-- https://raw.githubusercontent.com/TheRemote/RaspberryPiMinecraft/master/stop.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.111.133, 185.199.110.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1182 (1.2K) [text/plain]
Saving to: ‘stop.sh’
stop.sh 100%[==================================================================================================================>] 1.15K --.-KB/s in 0s
2021-07-05 21:41:24 (15.8 MB/s) - ‘stop.sh’ saved [1182/1182]
Grabbing restart.sh from repository...
--2021-07-05 21:41:24-- https://raw.githubusercontent.com/TheRemote/RaspberryPiMinecraft/master/restart.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.109.133, 185.199.108.133, 185.199.111.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.109.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1738 (1.7K) [text/plain]
Saving to: ‘restart.sh’
restart.sh 100%[==================================================================================================================>] 1.70K --.-KB/s in 0s
2021-07-05 21:41:24 (7.78 MB/s) - ‘restart.sh’ saved [1738/1738]
Grabbing fixpermissions.sh from repository...
--2021-07-05 21:41:24-- https://raw.githubusercontent.com/TheRemote/RaspberryPiMinecraft/master/fixpermissions.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.110.133, 185.199.109.133, 185.199.108.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.110.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 527 [text/plain]
Saving to: ‘fixpermissions.sh’
fixpermissions.sh 100%[==================================================================================================================>] 527 --.-KB/s in 0s
2021-07-05 21:41:24 (9.94 MB/s) - ‘fixpermissions.sh’ saved [527/527]
--2021-07-05 21:41:24-- https://raw.githubusercontent.com/TheRemote/RaspberryPiMinecraft/master/minecraft.service
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.110.133, 185.199.109.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 367 [text/plain]
Saving to: ‘/etc/systemd/system/minecraft.service’
/etc/systemd/system/minecraft.service 100%[==================================================================================================================>] 367 --.-KB/s in 0s
2021-07-05 21:41:24 (7.12 MB/s) - ‘/etc/systemd/system/minecraft.service’ saved [367/367]
Minecraft can automatically start at boot if you wish.
Start Minecraft server at startup automatically (y/n)?y
Your time zone is currently set to America/New_York. Current system time: Mon 05 Jul 2021 09:41:29 PM EDT
You can adjust/remove the selected reboot time later by typing crontab -e
Automatically reboot Pi and update server at 4am daily (y/n)?y
Daily reboot scheduled. To change time or remove automatic reboot type crontab -e
Minecraft installation scripts have been updated to the latest version!
Hey Ryan,
Thanks for reporting this. The script not wanting to save itself is normal but you can override it by removing the check in the script if you’re trying to install a custom version. Saved copies of SetupMinecraft.sh have been causing nothing but trouble for a long time and if you look through this post about 50% of the comments are me telling people to delete their SetupMinecraft.sh and update to the latest script. That’s not their fault, it’s my fault for setting it up that way, so I changed it to always run the live version. I should probably add a “update.sh” utility script that just calls the live version!
I definitely found the path issue. It was only for updating scripts and not for new installations. I have committed this fix to GitHub. Can you give it a try and let me know if it’s working. Thanks again!
Reran the script this morning. The Start, restart and stop files are being created under the Minecraft folder now. There is a new file named 1 being created in the home/pi directory (this occurred before and I forgot to mention it.) I had noticed issues around the SetupMinecraft.sh file during previous version updates. I have always rename that file so that it wouldn’t conflict during the running of your update script. Like last time, the script never created the SetupMinecraft.sh file. I did notice you instructing others to copy this file from GetHub on the Bedrock thread. I will attempt that fix now.
When viewed thru Notepad++ the file named 1 says “E: No packages found”
Used wget to get the Setupminecraft.sh file back onto the PI and then reran the script. The script removed the old setupminecraft.sh file without leaving a replacement. I did notice that the script never askes for the server’s name. If I remember correctly it did so with previous versions of the script.
Hey Ryan,
It actually intentionally deletes it unless you remove the check in SetupMinecraft.sh. When you run it you’ll see lines that say “SetupMinecraft.sh detected, running online version” at which point it will delete the saved copy of SetupMinecraft.sh and exit so you’re actually seeing the live online version run even if you save it with wget (unless you comment out the check which is pretty easy once you know what to look for). It never actually runs the local copy anymore unless you take out the check. The only reason anyone should do that is to override the version basically like if you want to stay on an older version like 1.16.5 etc.
I changed it because the vast vast vast vast vast majority of people will try to update by running the one that they already have. Initially I tried making it update itself but it was clunky and never really worked that well. I then realized that almost everyone else (including my pibenchmarks.com) project no longer is running their scripts this way and just always use the live version so I’ve moved to that. Sorry for the confusion, I did it for both this one and Minecraft Bedrock to try to eliminate the #1 issue people have when running the script.
The 1 issue is strange. I was not aware of that one! I’ll look into that and see if I can recreate that on my end!
Thank you for the response. Now I just have to deal with the battle happen between my kids and their friends. During the install “issues” I backed up and then purged all the data from the PI in an effort to isolate possible causes. Then end result is that some love the 17 map and some want to have their years worth of building back. Got any solutions to that problem? Blahahaha
Hey Ryan,
Haha, I definitely can relate to losing years to the game! I’m very glad you got this one working, and thanks you reporting those issues as there were several bugs fixed along the way thanks to you letting me know so thank you for sticking with it. Enjoy and have fun!
i am having that same sort of issue did you fix it?
if so can you help me becouse it says
sudo systemctl start minecraft
Job for minecraft.service failed because the control process exited with error code.
See “systemctl status minecraft.service” and “journalctl -xe” for details.
I redownloaded the latest SetupMinecraft.sh as you said and reinstalled everything, now it works like a charm! Love your script and your support here! Thank you so much 🙂
Hey Mertrogg,
Thanks for confirming and the kind words, enjoy and have fun!