Stacey Campbell

Running CraftBukkit on a Raspberry Pi 2 Model B

24 Feb 2015

Jump to Updates

My young son has been running a CraftBukkit server on our power–hungry and noisy Windows 7 PC for about a year. He sometimes has up to 4 or so of his friends on the whitelisted server. With the availability of a $35 Raspberry Pi Model B, I got interested in the idea of moving the CraftBukkit server onto the much smaller RPi platform and turning off the PC.

CraftBukkit, based on Minecraft, is a floating point intensive java application, so for adequate performance hardware floating point support on an otherwise low–horsepower platform is a strong requirement.

Here's the hardware I assembled:

  • Raspberry Pi Model B Rev 2
  • Transcend 16GB Class 10 SDHC Flash Memory Card
  • SB Raspberry Pi case (clear)
  • Motorola USB mobile phone charger with micro-USB cable
  • Belkin powered USB hub
  • 1TB Western Digital Elements external USB hard drive

Installation went thusly:

  1. At the time of installation, the only popular RPi Linux distribution that supported the hardware floating point unit on the ARM CPU of the RPi was Raspbian wheezy. I downloaded and installed this on the SD card by following the instructions on Raspberry Pi Foundation's download page.
  2. Using raspi-config I enabled dynamic overclocking up to 900MHz and reduced graphics DDR2 use to 32MB. I'm running the system headless most of the time (i.e. via Ethernet and ssh).
  3. I created a single large EXT4 partition on the WD external drive and added a 1GB swap file using dphys-swapfile (see the man page). This thread at convinced me that the swap file needed to be on an external hard drive.
  4. Swappiness was increased to 10.
  5. Likewise I relocated my /home partition to the external drive. With auto-save CraftBukkit does a fair bit of hard drive writing. I want that activity off the SD card to hopefully maintain a reasonable lifetime for the card.
  6. Java is available as an install-able package. Next I downloaded and installed the hard-float version of JDK 8 for ARM (Early Access) following the instructions at
  7. Finally I copied over the entire CraftBukkit installation (including quite a few plugins) from my home PC.
  8. I rewrote the launch script from MS-DOS to bash and fired up CraftBukkit. The first thing I noticed is that CPU and physical memory utilization went to 100% and java grabbed about 10% of swap too. Getting even one client connected for any period of time was problematic. I downloaded most of the active plugins to help CraftBukkit deal with lag, but alas, nothing made much difference.
  9. Stumped, I finally decided to delete all the low-lag CraftBukkit extensions and simply reduce the view-distance to 4 in (all of the spawn options are true).
Everything seems to be running fine, at the cost of reduced Minecraft view distance. The Raspberry Pi runs a bit warmer, but never above about 62C. When clients connect CPU use kicks up to about 90% (900MHz), and when nobody is connected CPU drops back down to about 25% (700MHz) and memory utilization drops to about 60%.

Update 1: I added the anti-lag plugin PTweaks and now the server appears to be even more responsive to clients.

Update 2: Very large editing operations using WorldEdit can basically kill the server. I modified plugins/WorldEdit/config.yml to put some limits on the number of blocks that can be modified in one operation. I may tweak this a bit if it's too restrictive.

    allow-extra-data-values: false
        default: 250
        maximum: 500
        default: -1
        maximum: 20
    max-radius: 4
    max-super-pickaxe-size: 4
    max-brush-radius: 4
        default: -1
        maximum: -1
    disallowed-blocks: [6, 7, 14, 15, 16, 26, 27, 28,
29, 39, 31, 32, 33, 34, 36, 37, 38, 39, 40, 46, 50, 51,
56, 59, 69, 73, 74, 75, 76, 77, 81, 83]

Update 3: I had to put a speed limit on player movement. Very rapid player movement can bring the server to its knees. In plugins/Essentials/config.yml:

max-fly-speed: 0.2
Note: this does not appear to stop ops from setting their speed to 10 and crashing the server by triggering the generation of massive amounts of terrain.

Update 4: As an experiment I selected Turbo under the raspi-config overclock menu. The system ran briefly at 1GHz but was clearly unstable. As soon as a load was put on the system — e.g. bukkit — java and other programs on the system coredumped.

I reverted back to 900MHz and no permanent harm was done.

Update 5: craftbukkit.jar has been replaced with Spigot, with PTweaks removed from plugins, Performance with 4 or more users is remarkable compared to the previous configuration.

Update 6: Okay, recent spigot versions have been experiencing some sort of exploding memory problem through the end of June and start of July where all of RAM and all of swap gets consumed, effectively killing the server, so I'm back to CraftBukkit and PTweaks (supporting the 1.6.1 minecraft update) until things stabilize with spigot.

Update 7: As of October 2013, Java with hardware-float support is now available to install with apt-get.

Update 8: It looks like Craftbukkit is in legal limbo or worse. Oh well.

Update 9: Performance on a Raspberry Pi 2 Model B is (not unexpectedly) excellent.