[FreeNAS 9 Plugin] - MineOS

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
@Joshua Parker Ruehlig: You might want to update the first post with a note about manually updating mineOS via "service mineos update" as, at present, manually updating it breaks the web GUI authentication process for mineOS. I don't know enough to comment as to why that is, but the update process spits out a huge amount of errors related to node/posix/npm stuff and then after that you can no longer authenticate.

@Everyone else: I'm leaving a note here as a breadcrumb for anyone else who has run into the same frustrating issue I have. If you run a Minecraft server with the Dynmap plugin (a fantastic little plugin that essentially rubs a web server for you that allows for Google Earth style browsing of your Minecraft world) and you've run into a mysterious issue where mineOS seems to have crapped the bed, Dynmap is to blame. I don't know *why* exactly, but both I (and several people who have posted on the mineOS discourse page) seem to have stumbled on an issue with mineOS and running a server with Dynmap where, at some point after installing the plugin (and seemingly related to the large number of files Dynmap generates) it crashes mineOS. Why that happens is beyond me, but at the moment the solution seems to be simply abandoning Dynmap.
good point, I'll cross it out. Yeah, updates haven't been working for a while since mineos now relies on node4, which I don't believe works on the freebsd 9 bases plugin jail. I'll revisit this again in a few months and see if I can get this working, or maybe by then I'll need to repackage this anyway for FreeNAS10
 

rafadavidc

Dabbler
Joined
Mar 26, 2016
Messages
38
Hi, Joshua. Add me to the list of people eagerly awaiting the 9.10-compatible (bhyve) version of MineOS. Please let me know if there's anything I can contribute.
 

rafadavidc

Dabbler
Joined
Mar 26, 2016
Messages
38
I wanted to update this thread.

I've gotten standard MineOS running inside a VirtualBox jail. It's not quite as easy as a plugin, and you have to edit the jail's rc.conf to get MineOS to run on boot, but otherwise, it's straightforward, just much longer.
 

paradoxiom

Patron
Joined
Jun 16, 2015
Messages
239
I wanted to update this thread.

I've gotten standard MineOS running inside a VirtualBox jail. It's not quite as easy as a plugin, and you have to edit the jail's rc.conf to get MineOS to run on boot, but otherwise, it's straightforward, just much longer.

Hey,

I hate having to ak to be spoon-fed like this, but I struggle with trying to create jails of things without plugins - I got my Plex jail setup without the plugin about 2 years ago and pretty much forgot how I did it and so am just hoping it never breaks at this point.

Anyway, I don't suppose you could give a rough outline of how you got MineOS running fine in a manually setup jail? would really appreciate it.

Thanks,
para
 

rafadavidc

Dabbler
Joined
Mar 26, 2016
Messages
38
MineOS is its own Linux distribution. You install it as an OS and ta-da, you have a Minecraft server ready to configure.

So all you need to do is get a virtualBox jail ready to receive that OS. I don't remember what core MineOS is based on (Fedora, Red Hat, whatever, but it says on their page), but that core is what you choose when setting up the VM in vB. The rest is just setting up a VM in a host.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
if you want better performance for your Minecraft servers you should install it on standard freebsd jail vs a Linux jail.
the port I made is here...
https://github.com/josh4trunks/freenas-plugins/tree/master/ports/games/mineos

installing this in a standard jail would not have the update problems that the plugin has since the jails are freebsd 10 based.
ill eventually see if I can get the plugin working updated again, but if not I can document the steps to install from the port.
 

rafadavidc

Dabbler
Joined
Mar 26, 2016
Messages
38
Can you tell us the difference between what I described and putting your port in a jail? Is it a custom jail? I ask because vB is the only template as of 9.10.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
Can you tell us the difference between what I described and putting your port in a jail? Is it a custom jail? I ask because vB is the only template as of 9.10.
a standard jail is the option ---, or something like that. its a freebsd jail, so no extra layers just a different userland, and uses the freenas kernel.

virtual box is a virtual machine, virtual OS has its own kernel interacting with virtual hardware. I'm not very familiar with freenas' implementation though.
 

Apatharas

Cadet
Joined
Jul 5, 2016
Messages
3
I would also be very interested in either an updated plugin or the steps to using the port you listed above.. Thank you so much for your hard work on this
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I'm going to give up on updating this plugin for FreeNAS 9.10. But here are manual the steps to update it to the latest mineos-node...

Code:
service mineos onestop

pkg install -y npm
sed -i '' -e 's|^\(command="\).*\("\)$|\1/usr/local/bin/node\2|' /usr/local/etc/rc.d/mineos
sed -i '' -e 's|^\(start_precmd="\).*\("\)$|\1export PATH=$PATH:/usr/local/bin:/usr/pbi/mineos-amd64/bin\2|' /usr/local/etc/rc.d/mineos
sed -i '' -e 's|^\([[:space:]]*\)/.*/npm\([[:space:]].*\)$|\1CXX=c++ /usr/local/bin/npm\2|' /usr/local/etc/rc.d/mineos

service mineos oneupdate
service mineos start


Also if you did the above, this would allow you to use the latest java
Code:
pkg install -y openjdk8
 
Last edited:
Joined
Jul 10, 2016
Messages
521

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I posted a "How-To guide" on how to setup MineOS in a standard jail, i.e. without using the plugin.

https://forums.freenas.org/index.ph...alternative-to-using-the-mineos-plugin.44686/
Nice looks good, simlar to the wiki entry. If you want to avoid py-supervisor and start mineos directly like the plugin here is an init script modified from the plugin; haven't tested it with your setup so it may need more changes.

Code:
install /dev/null /usr/local/etc/rc.d/mineos
syscr mineos_enable="YES"


Code:
#!/bin/sh
#
# PROVIDE: mineos
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# mineos_enable (bool): Set to NO by default.
# Set it to YES to enable it.

. /etc/rc.subr
name="mineos"
rcvar="${name}_enable"
load_rc_config $name

: ${mineos_enable:="NO"}

pidfile="/var/run/mineos.pid"
command="/usr/local/bin/node"
procname="mineos"

start_precmd="export PATH=$PATH:/usr/local/bin"
command_args="/usr/local/games/minecraft/service.js start"

extra_commands="update"
update_cmd="mineos_update"
mineos_update() {
    /usr/local/bin/git --git-dir=/usr/local/games/minecraft/.git --work-tree=/usr/local/games/minecraft pull
    ${start_precmd}
    CXX=c++ /usr/local/bin/npm --prefix /usr/local/games/minecraft update --python=/usr/local/bin/python2.7
}

run_rc_command "$1"
 

thefox13

Dabbler
Joined
Sep 15, 2014
Messages
21
I'm going to give up on updating this plugin for FreeNAS 9.10. But here are manual the steps to update it to the latest mineos-node...

Code:
service mineos onestop

pkg install -y npm
sed -i '' -e 's|^\(command="\).*\("\)$|\1/usr/local/bin/node\2|' /usr/local/etc/rc.d/mineos
sed -i '' -e 's|^\(start_precmd="\).*\("\)$|\1export PATH=$PATH:/usr/local/bin:/usr/pbi/mineos-amd64/bin\2|' /usr/local/etc/rc.d/mineos
sed -i '' -e 's|^\([[:space:]]*\)/.*/npm\([[:space:]].*\)$|\1CXX=c++ /usr/local/bin/npm\2|' /usr/local/etc/rc.d/mineos

service mineos oneupdate
service mineos start


Also if you did the above, this would allow you to use the latest java
Code:
pkg install -y openjdk8
Josh, I tried the above and the server works but I cannot login via https://192.168.45.91:8443/admin/login.html, the standard username and password (mcserver) does not seem to work. I went to /usr/pbi and chown -R mcserver:mcserver /mineos-amd64 to see if it was a privileged error of which it does not seem to be. Any thoughts?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
you shouldn't have done that chmod command. mineos runs differently then other programs, it runs as root and manages permissions permissions only on its server/world files, app file permission shouldn't ever be a problem.

I'd check /var/log to see if the mineos logs in there have any clues. maybe one of the steps I gave didn't apply fully.

I'd also confirm you can login to mcsevrer on the commandline with that password.
chsh -s /bin/sh mcserver
su mcserver
 

thefox13

Dabbler
Joined
Sep 15, 2014
Messages
21
you shouldn't have done that chmod command. mineos runs differently then other programs, it runs as root and manages permissions permissions only on its server/world files, app file permission shouldn't ever be a problem.

I'd check /var/log to see if the mineos logs in there have any clues. maybe one of the steps I gave didn't apply fully.

I'd also confirm you can login to mcsevrer on the commandline with that password.
chsh -s /bin/sh mcserver
su mcserver

Here is the dump from the service mineos update:
gmake: Entering directory '/usr/pbi/mineos-amd64/share/mineos/mineos-node/node_modules/posix/build'
CXX(target) Release/obj.target/posix/src/posix.o
cc1plus: error: unrecognized command line option "-std=gnu++0x"
gmake: *** [posix.target.mk:88: Release/obj.target/posix/src/posix.o] Error 1
gmake: Leaving directory '/usr/pbi/mineos-amd64/share/mineos/mineos-node/node_modules/posix/build'
gyp ERR! build error
gyp ERR! stack Error: `gmake` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System FreeBSD 10.3-STABLE
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/pbi/mineos-amd64/share/mineos/mineos-node/node_modules/posix
gyp ERR! node -v v6.3.1
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! FreeBSD 10.3-STABLE
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "--prefix" "/usr/pbi/mineos-amd64/share/mineos/mineos-node" "update" "--python=/usr/pbi/mineos-amd64/bin/python2.7"
npm ERR! node v6.3.1
npm ERR! npm v3.9.2
npm ERR! code ELIFECYCLE

npm ERR! posix@4.0.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the posix@4.0.2 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the posix package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs posix
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls posix
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /npm-debug.log
 

thefox13

Dabbler
Joined
Sep 15, 2014
Messages
21
Josh,

I can also log in with the standard username and password.

The mineos.auth.log states
"failure from: 192.168.45.36 user: mcserver" acting like the credentials cannot be validated. It has to be related to the compiling error above from npm.
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
@thefox13 the error you get during the update steps makes me think you are installing a version of node built for FreeBSD 9. Maybe you can double check what your /usr/local/etc/pkg.conf has. If that is trying to get FreeBSD 9 packages, you could delete that file, then reinstall node and npm.
 

thefox13

Dabbler
Joined
Sep 15, 2014
Messages
21
@thefox13 the error you get during the update steps makes me think you are installing a version of node built for FreeBSD 9. Maybe you can double check what your /usr/local/etc/pkg.conf has. If that is trying to get FreeBSD 9 packages, you could delete that file, then reinstall node and npm.
I renamed the file and reinstalled node/npm:
Code:
pkg install node
pkg install -y npm

That did not fix the problem. I do agree it must be an old version issue since this jail is old and imported before FreeNAS 10 was released. Perhaps easier to install mineos from scratch, import saves/servers to new jail, remove old plugin jail?
 

Joshua Parker Ruehlig

Hall of Famer
Joined
Dec 5, 2011
Messages
5,949
I renamed the file and reinstalled node/npm:
Code:
pkg install node
pkg install -y npm

That did not fix the problem. I do agree it must be an old version issue since this jail is old and imported before FreeNAS 10 was released. Perhaps easier to install mineos from scratch, import saves/servers to new jail, remove old plugin jail?
Hmm, maybe the old jail is the issue like you said.
Yes, you don't even need to got through an import. Just set the same settings in the FreeNAS WebUI (left panel) > Plugins > MineOS. and have the same Base Direcory of files available. I personally have these stored on a mounted dataset so I can easily snapshot/back them up.
 
Top