NetBSD can also run a Minecraft server


Last Monday I wrote this about our FreeBSD Minecraft server:

Clara and I run Minecraft on our home FreeBSD server in a jail, which keeps Java and other dependencies contained in one isolated place. Theoretically you can run the server anywhere that supports Java, including Linux and possibly even NetBSD, though I haven’t tested the latter.

Well, I decided I couldn’t leave it at that! The good news is, yes, you can run a Minecraft server on my other favourite OS too. This post explores how I went about it, though I’m sure there are other ways.

Getting Java installed

Once you’ve installed NetBSD, configured networking, and enabled pkgin, you need to get an OpenJDK to run Minecraft.

Minecraft 1.17 onwards requires OpenJDK 17, but OpenJDK 16 is the latest in the most recent snapshot as of July 2022. You can search to confirm if this is still the case:

# pkgin search openjdk

If it’s still 16, you can pull current packages by opening your repo file:

# vi /usr/pkg/etc/pkgin/repositories.conf

And changing the repo URI, in my case from 9.0 to 9.0_current:$arch/9.0_current/All

Thank you so much to the ryoon@ for working on this. He does so much great work for the NetBSD community, I feel like I owe him at least a coffee or a beer next time I’m able to go to Japan. 🙇

Now we can install, along with a few other useful tools:

# pkgin install -v openjdk17 fetch tmux

Running Minecraft

From here, running Minecraft is basically the same as any Java-enabled server. I put all my files in one place:

# mkdir -p /opt/minecraft
# chown $YOUR_LOCAL_USER /opt/minecraft

Then log in as my local user and start:

$ cd /opt/minecraft

Now we can start!

$ openjdk17-java -jar minecraft.jar

You’ll notice Java will throw a system not supported exception, which those of us on NetBSD know all too well. From my testing, you can safely ignore it:

[ServerMain/WARN]: Failed retrieving info for group hardware
java.lang .UnsupportedOperationException: Operating system
	not supported: NetBSD
	at oshi.SystemInfo.createHardware(

And don’t forget to accept the EULA after you run the server the first time:

$ sed -i '' 's/eula=false/eula=true/' ./eula.txt

Creating a launch script

I like to symlink the latest version of the server to minecraft.jar:

$ ln -s /opt/minecraft/minecraft_server.1.19.jar minecraft.jar

Then reference it in with tmux to persist the server after disconnecting. I like to give Minecraft more memory too:

tmux new -s minecraft \
	openjdk17-java -Xmx4096M -Xms4096m -jar minecraft.jar

Now we’re good to go!

$ chmod +x
$ ./


My next step would be creating a proper chroot environment for Java and Minecraft, similar to what I do with FreeBSD jails. I’ve had a proper NetBSD chroot exploration post in the works for years; I’ll tidy up and post it soon.

In the meantime, you can also install all the same extensions and third-party servers I referenced in my FreeBSD Minecraft post last week.

I’m chuffed this works! 🧡

Author bio and support


Ruben Schade is a technical writer and IaaS engineer in Sydney, Australia who refers to himself in the third person in bios. Wait, not BIOS… my brain should be EFI by now.

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or buy some silly merch. Thanks!