java and minecraft on alpine linux
alpine linux is a fantastic little linux distribution based on the musl libc implementation. the only "problem" that i have had with it is with pre-compiled software that depends on glibc. one such example of that is java's jre. in this little chain of thought i'm going to explain how i got java and the minecraft server working with alpine linux.
first off, we're kind of lucky. the 64 bit version of alpine uses /lib for it's libraries instead of /lib64. this allows us to easily borrow libraries from any distribution that builds packages based on /lib64 without conflicting with our alpine libraries.
so let's try to get java working. in this example we'll use a virtualbox vm running slackware to do our research / library donation. once you have slackware installed and running, fetch a recent copy of the java jre and extract it to the vm's home directory.
the first step you might be thinking is to start running ldd on every binary in the "jre1.8.0_161/bin" folder. then you'll copy the missing libraries over to your alpine linux machine's new /lib64 folder. one by one you'll copy them and try to run the minecraft server until it works. now, suddenly it's running, it goes through it's initial setup, building the world etc. neat! but... you'll notice you aren't able to connect! are the mojang verification servers down AGAIN??
nope, you're still missing libraries. so let's try going about this a different way.
in our next attempt, we'll run the minecraft server on our slackware vm. since
we know it has all the libraries java needs, it should load perfectly the first
time. next, in a separate terminal, let's use 'ps ax' to find the PID of the
currently running java process and then run
'lsof -F -p PID_HERE | grep lib64'
to list the files java currently has open. would ya look at that! all those .so files from /lib64 that we totally missed! better get to copying them to your alpine machine!
after you copy those files over (and created the symlinks that point to them.. you should study the lib64 folder a bit) the minecraft server works perfectly and is very stable.
hopefully this little writeup was useful, or at least interesting. and if it helped you get your minecraft server up and running, awesome!
(c) 2018 Alexander Grotewohl