Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

How to install MineOS-node in a jail (alternative to using the MineOS plugin)

cygnus

Member
Joined
Mar 20, 2012
Messages
70
I tested on a brand new jail, and it works fine for me. After you download a download a profile/jar and you select that profile in your server, the corresponding "runnable jar" becomes automatically available.

You can use the command id mcserver to see the groups associated with user mcserver.
Code:
root@mineos_2:/ # id mcserver
uid=1006(mcserver) gid=1006(mcserver) groups=1006(mcserver),13(games)


The /var/log/mineos.log file may give you pointers to any problems. If all else fails, it may be faster & easier to scrap your jail and start again, than to try to find what's wrong.
Decided your probably right but found still could not then adduser - but ran pwd_mkdb /etc/master.passwd and this then allowed user to work. restarted jail and downloaded package now to see if can get working. thanks again
 

Pheran

Senior Member
Joined
Jul 14, 2015
Messages
276
Thanks for this guide, it was helpful. Unfortunately after following the guide mineos isn't working quite right - it keeps dying right after starting, so supervisord keeps restarting it. Oddly enough, I got the same error from this fresh jail install (FreeNAS 9.10.2-U4) as I did after trying to upgrade my plugin install to the latest node version. I'm starting to wonder if there's something wrong in the current git repo. I'll ask about this on the main MineOS site as well, but in case anyone has any ideas here's the error messages from mineos.log.

Code:
{"level":"info","message":"Starting up server, using commit: f9b1207 added dockerfile\n","timestamp":"2017-06-10T14:41:56.469Z"}
{"date":"Sat Jun 10 2017 10:41:57 GMT-0400 (EDT)","process":{"pid":70985,"uid":0,"gid":0,"cwd":"/usr/local/games/minecraft","execPath":"/usr/local/bin/node","version":"v7.10.0","argv":["/usr/local/bin/node","/usr/local/games/minecraft/webui.js"],"memoryUsage":{"rss":55263232,"heapTotal":33484800,"heapUsed":13766104,"external":356679}},"os":{"loadavg":[0.32470703125,0.263671875,0.189453125],"uptime":1119581},"trace":[{"column":29,"file":"/usr/local/games/minecraft/server.js","function":null,"line":96,"method":null,"native":false},{"column":16,"file":"/usr/local/games/minecraft/node_modules/async/lib/async.js","function":null,"line":52,"method":null,"native":false},{"column":30,"file":"/usr/local/games/minecraft/node_modules/async/lib/async.js","function":null,"line":1209,"method":null,"native":false},{"column":20,"file":"/usr/local/games/minecraft/node_modules/procfs-stats/index.js","function":"ReadFileContext.callback","line":215,"method":"callback","native":false},{"column":13,"file":"fs.js","function":"FSReqWrap.readFileAfterOpen [as oncomplete]","line":359,"method":"readFileAfterOpen [as oncomplete]","native":false}],"stack":["TypeError: Cannot read property 'MemAvailable' of undefined","  at /usr/local/games/minecraft/server.js:96:29","  at /usr/local/games/minecraft/node_modules/async/lib/async.js:52:16","  at /usr/local/games/minecraft/node_modules/async/lib/async.js:1209:30","  at ReadFileContext.callback (/usr/local/games/minecraft/node_modules/procfs-stats/index.js:215:20)","  at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:359:13)"],"level":"error","message":"uncaughtException: Cannot read property 'MemAvailable' of undefined","timestamp":"2017-06-10T14:41:57.466Z"}
 

Jurgen Segaert

Senior Member
Joined
Jul 10, 2016
Messages
358
Hi Pheran. Glad to hear you find this guide helpful. :smile:

You are correct, I can reproduce this issue when I download the latest version from the mineos-node repo. I suspect this started with commit 878043b
I'll file a bug report.
 

Pheran

Senior Member
Joined
Jul 14, 2015
Messages
276

Jurgen Segaert

Senior Member
Joined
Jul 10, 2016
Messages
358
If you didn't make a snapshot of your jail, and your install is now completely hosed, you can try the workaround below to rollback the file server.js to the version that works.
Logon to your jail, execute the following commands, and restart your jail.

Code:
cd /usr/local/games/minecraft
git show "878043b~1":server.js > server.js
echo "CXX=c++ npm install" | sh
 

Pheran

Senior Member
Joined
Jul 14, 2015
Messages
276
Running the current version of MineOS (the previous bug relating to 'MemAvailable' has been fixed), I'm seeing the MineOS jail hit all of my disks with 50-100 kB/sec of continuous I/O, even when no one is connected to any of the Minecraft severs. This is kind of obnoxious - is anyone else seeing this?
 

Hazimil

Member
Joined
May 26, 2014
Messages
172
Hi, a great walkthough. Needed this to keep my kids happy :)

If I follow the guide it works perfectly, however....

I wanted to keep the /var/games/minecraft in another dataset for easy backups (without having to worry about backing up the whole Jail). So after I create the Jail, I then Add Storage:

/mnt/tank/Sysadmin/MineOSData -> /var/games/minecraft with read-only unticked, and create directory ticked. Then within the jail I change the group of the folder from wheel to games chgrp games /var/games/minecraft, and then followed the rest of the guide to install MineOS.

Everything install and works and I can create a new server, BUT (and there had to be a but!) when I press Start the right-hand corner states:

upload_2017-9-8_11-49-38.png


The log file states:

Code:
{"level":"info","message":"[Jonathans] eula.txt detected: ACCEPTED (eula=true)","timestamp":"2017-09-08T10:47:21.443Z"}			
{"level":"info","message":"[Jonathans] 192.168.0.12 issued command : \"start\"","timestamp":"2017-09-08T10:48:06.860Z"}			
{"level":"info","message":"[Jonathans] received request \"start\"","timestamp":"2017-09-08T10:48:06.860Z"}						
{"command":"start","uuid":"3298f0c0-9483-11e7-bb98-036289c2da07","time_initiated":1504867686860,"success":false,"err":23,"time_resol
ved":1504867687073,"level":"error","message":"[Jonathans] command \"start\" errored out:","timestamp":"2017-09-08T10:48:07.073Z"}


Any idea what I'm doing wrong? It must be a permissions issue, but I just can't see it.

Thanks.

Jonathan
 

Jurgen Segaert

Senior Member
Joined
Jul 10, 2016
Messages
358
LOL... "for the kids", sure! I tell my wife the same thing.

I'm actually running the same setup; I keep my Minecraft data on my main pool and use the Add storage to mount that dataset into /var/games/minecraft

My permissions are as follows:
Code:
root@mineos_3:/var/games/minecraft # ls -al
total 44
drwxr-xr-x  7  root  games  7 Aug 24  2016 .
drwxrwxr-x  3  root  games  3 May 20 15:54 ..
drwxrwxr-x  25 root  games  25 Jul 26 14:21 archive
drwxrwxr-x  25 root  games  25 Jul 26 14:21 backup
drwxrwxrwx  2  root  games  2 Aug 24  2016 import
drwxrwxr-x  11 root  games  11 Jun 23 08:05 profiles
drwxrwxr-x  17 mcserver  games  17 Jul 26 14:21 servers
root@mineos_3:/var/games/minecraft #


Some other notes:
  • I had issues when trying to share my mc dataset via SMB, as the windows ACL seemed to break things. I now use WinSCP to drop in mods etc...
  • I created a user mcserver in the FreeNAS gui with the same UID/GID as in the jail, mostly for consistency, security and to make it look clean.
 

Hazimil

Member
Joined
May 26, 2014
Messages
172
I created a user mcserver in the FreeNAS gui with the same UID/GID as in the jail, mostly for consistency, security and to make it look clean.
I've done this now, and also put the user in the "games" group on the FreeNAS server.

However, I'm still getting the same issue. I notice that I does allow me to Create a new archive, but fails to create a restore point (with this message: Uh oh!! Restore point attempt failed a minute ago.).

Code:
{"command":"start","uuid":"6bf57f30-94b2-11e7-a0b3-e7d23f22a7c2","time_initiated":1504887969443,"success":false,"err":23,"time_resol
ved":1504887969651,"level":"error","message":"[Adams] command \"start\" errored out:","timestamp":"2017-09-08T16:26:09.652Z"}  
{"level":"info","message":"[Adams] 192.168.0.12 issued command : \"modify_sc\"","timestamp":"2017-09-08T16:26:11.565Z"}			
{"level":"info","message":"[Adams] received request \"modify_sc\"","timestamp":"2017-09-08T16:26:11.565Z"}						
{"level":"info","message":"[Adams] 192.168.0.12 issued command : \"backup\"","timestamp":"2017-09-08T16:26:13.126Z"}				
{"level":"info","message":"[Adams] received request \"backup\"","timestamp":"2017-09-08T16:26:13.127Z"}							
{"command":"backup","uuid":"6e277a60-94b2-11e7-a0b3-e7d23f22a7c2","time_initiated":1504887973126,"success":false,"err":1,"time_resol
ved":1504887973185,"level":"error","message":"[Adams] command \"backup\" errored out:","timestamp":"2017-09-08T16:26:13.186Z"}	
{"level":"info","message":"[Adams] 192.168.0.12 issued command : \"backup\"","timestamp":"2017-09-08T16:26:16.994Z"}				
{"level":"info","message":"[Adams] received request \"backup\"","timestamp":"2017-09-08T16:26:16.994Z"}							
{"command":"backup","uuid":"7075b020-94b2-11e7-a0b3-e7d23f22a7c2","time_initiated":1504887976994,"success":false,"err":1,"time_resol
ved":1504887977051,"level":"error","message":"[Adams] command \"backup\" errored out:","timestamp":"2017-09-08T16:26:17.051Z"}	
{"level":"info","message":"[Adams] 192.168.0.12 issued command : \"start\"","timestamp":"2017-09-08T16:28:49.617Z"}				
{"level":"info","message":"[Adams] received request \"start\"","timestamp":"2017-09-08T16:28:49.618Z"}							
{"command":"start","uuid":"cb6e4320-94b2-11e7-a0b3-e7d23f22a7c2","time_initiated":1504888129618,"success":false,"err":23,"time_resol
ved":1504888129832,"level":"error","message":"[Adams] command \"start\" errored out:","timestamp":"2017-09-08T16:28:49.833Z"}	  
{"level":"info","message":"[Adams] 192.168.0.12 issued command : \"archive\"","timestamp":"2017-09-08T16:28:52.192Z"}			  
{"level":"info","message":"[Adams] received request \"archive\"","timestamp":"2017-09-08T16:28:52.192Z"}							
{"level":"info","message":"[Adams] 192.168.0.12 issued command : \"backup\"","timestamp":"2017-09-08T16:28:56.092Z"}				
{"level":"info","message":"[Adams] received request \"backup\"","timestamp":"2017-09-08T16:28:56.093Z"}							
{"command":"backup","uuid":"cf4a1dc0-94b2-11e7-a0b3-e7d23f22a7c2","time_initiated":1504888136092,"success":false,"err":1,"time_resol
ved":1504888136146,"level":"error","message":"[Adams] command \"backup\" errored out:","timestamp":"2017-09-08T16:28:56.147Z"} 


A confused user...

J.
 

Hazimil

Member
Joined
May 26, 2014
Messages
172
I have also ensure the group mcserver has the same GID on both freenas and within the Jail, but still fails to work... Might just have to keep it as normal and just use a script to copy the files :(

Jonathan
 

badogski29

Junior Member
Joined
Nov 4, 2016
Messages
15
Hi just a question, how would I update MineOS with this guide? Also tried what Hazimil did with having a seperate dataset for the servers but I was not succesful. Would love to set it up that way though
 
Last edited:

Jurgen Segaert

Senior Member
Joined
Jul 10, 2016
Messages
358
To update the MineOS webgui to the latest version, you can logon to your jail and execute the following commands:
Code:
service mineos stop
cd /usr/local/games/minecraft
git fetch
git reset --hard origin/master
rm -rf node_modules
echo "CXX=c++ npm install" | sh
service mineos start

To update the other packages you can run: pkg update && pkg upgrade -y

To move your files to a dataset outside of your jails, try this:
  • Stop mineos jail
  • From the FreeNAS UI, create a new dataset called e.g. minecraftdata, owned by root/games and the following permissions:
upload_2017-10-3_20-28-1.png

  • move the data from your jail folder to the new dataset (my jail is called mineos):
    Code:
    mv /mnt/tank/jails/mineos/var/games/minecraft/* /mnt/tank/minecraftdata
  • Add the new dataset to the "storage" of your jail
    upload_2017-10-3_20-32-19.png
  • Start your jail again
Note that as I was trying this in a VM, it unmounted linprocfs. If this happens to you, you can just stop the jail, run the mount command, and start again, as in the initial post.
 

DawnTreader

Neophyte
Joined
Mar 21, 2017
Messages
10
Hello All

First, I am a capable computer user, I have been working with freenas for almost a year, but at a very "follow the instructions" level. Meaning i really copy and paste a lot. So forgive me when I ask questions that you may feel people in this forum should know the answer to or that it is "simple" that I shouldn't be asking. Honestly my OS of choice is windows.

Now that I have gotten that out of the way I wanted to ask if someone can give me the commands necessary to fix this:

root@mineos_jail:/usr/local/games/minecraft # echo "CXX=c++ npm install" | sh
npm WARN npm npm does not support Node.js v9.1.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
WARNING: You are likely using a version of node-tar or npm that is incompatible with this version of Node.js.r/local/games/minecraf
Please use either the version of npm that is bundled with Node.js, or a version of npm (> 5.5.1 or < 5.4.0) or node-tar (> 4.0.1) th
at is compatible with Node.js 9 and above.
/usr/local/bin/node[22114]: ../src/node_zlib.cc:437:static void node::(anonymous namespace)::ZCtx::Init(const FunctionCallbackInfo<v
8::Value> &): Assertion `args.Length() == 7 && "init(windowBits, level, memLevel, strategy, writeResult, writeCallback," " dictionar
y)"' failed.
1: node::Abort(void) [/usr/local/bin/node]
2: node::Assert(char const* const[4]*) [/usr/local/bin/node]
3: _ZNSt3__16vectorIPN4node14SigintWatchdogENS_9allocatorIS3_EEE21__push_back_slow_pathIRKS3_EEvOT_ [/usr/local/bin/node]
4: v8::internal::FunctionCallbackArguments::Call(void(*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/local/bin/node]
5: v8::internal::Isolate*<v8::internal::Object> v8::internal::Builtins::InvokeApiFunction(v8::internal::Isolate*, bool, v8::interna
l::Handle<v8::internal::HeapObject>(int, v8::internal::Object*, v8::internal::HeapObject) [/usr/local/bin/node]
6: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/local/bin/node]
Abort trap
root@mineos_jail:/usr/local/games/minecraft # service mineos stop
mineos does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d), or is not executable

I understand that it is telling me that the version of NodeJS is too new for the version of NPM but I have no idea how to specify what version of NodeJS I want to install or how to roll it back a version. I have been trying for about a week to get my mineOS plugin working again and make it so the boys and I can have our MineCraft servers back. Once I get this fixed I will also need to restore our server from the files that I copied from the share.

Please help, my boys and I miss our server. :(
 

Jurgen Segaert

Senior Member
Joined
Jul 10, 2016
Messages
358
Hi DawnTreader and welcome to the forums!

Hmmmm... this is interesting. I managed to reproduce this issue. It seems that for some reason the latest version of npm is indeed not compatible with the latest version of node.
Anyway, to fix: logon to your mineos jail and downgrade to node4...

Code:
pkg delete -y npm
pkg install -y npm4
cd /usr/local/games/minecraft/
echo "CXX=c++ npm install" | sh


I'm not sure if you were upgrading, or creating a new mineos jail from scratch, so then continue with the next steps in the tutorial, if that's still relevant to you.
 

DawnTreader

Neophyte
Joined
Mar 21, 2017
Messages
10
So... your commands helped immensely! Thanks!

I was creating a new mineOS jail from scratch because the plugin is broken. Although I think your commands might help in the plugin as well.

I completed the whole process and got a server up an running. How do I get my server back to the state it was in before the mess? I didn't have a backup or archive or anything other than a copy of the folders that I made through windows.

Through all the reading here I assume that permissions are going to be messed up by windows. How do I copy the files over and change the permissions to the correct ones? Will setting permissions recursively in the UI over the dataset work? Whats the best way of going about getting my old server back working?
 

Jurgen Segaert

Senior Member
Joined
Jul 10, 2016
Messages
358
If you still have your old plugin jail around, it's probably easiest to copy your data files from there to your new jail, to avoid any issues with the permissions. The data files are located in /var/games/minecraft/. To copy data from one jail to another, from the FreeNAS command line, the copy command would look something the below. Adjust for the name of your pool and jails:

Code:
cp -a /mnt/tank/jails/mineos_1/var/games/minecraft /mnt/tank/jails/mineos_jail/var/games/


If your only backup is on Windows, I would use a tool such as WinSCP to copy the files in /var/games/minecraft/. Configure the transfer setting to "Automatic" and check the remove EOF markers, just in case Windows added it's own.

What the permissions concerns, mine look as follows:
  • The folders within /var/games/minecraft/ are owned by root:games . The first time you start the mineOS service, it should have created these already.
  • The contents within folder /var/games/minecraft/profiles are owned by root:games
  • The contents within folder /var/games/minecraft/servers are owned by mcserver:games or mcserver:mcserver You can toggle between the two from the MineOS admin screen
Hope this helps you restore your data. :smile: I keep my minecraft data in a separate dataset in my main pool, see a few posts above.
 

DawnTreader

Neophyte
Joined
Mar 21, 2017
Messages
10
Yeah, I have to admit, I am a pretty useless newbie when it comes to this stuff. Unfortunately I did not have another dataset available as I had to start everything from scratch again due to hardware and user error. I am planning on a few things to stop this from happening again but at the moment I am stuck with a copy of the files from the previous freenas install on a drive on my windows computer that I had manually copied.

So at the moment I have to use the WinSCP method to get the files back to the way they are supposed to be. I am going to need a walk through on that as well. I downloaded and installed that tool on my windows machine, is that where I should be using it? I already tried to connect to the mineos jail through the IP address, 192.168.1.4 but it told me that it didn't like SFTP and so I changed to FTP and that told me the connection was refused.

If I were to put the files in a folder on a separate dataset and copy them into the mineOS dataset would the permissions change to the correct ones and drop all the crap that windows puts on?
 

Jurgen Segaert

Senior Member
Joined
Jul 10, 2016
Messages
358
OK, let me try to walk you through this...
If you run WinSCP, logon using sftp with root to the IP of your FreeNAS box, not the one of your jail; the same as if you would logon to the FreeNAS UI. If it won't let you, make sure you have the SSH service running and the "Login as Root with password" option checked. Follow the instructions from the manual if needed. You can uncheck the box when you're done when you have any security concerns.

In WinSCP, use the Transfer Settings dropdown to select "Configure" and then click "edit..." The settings should look something like this:

upload_2017-11-19_14-42-34.png


Drag & drop the proper files from your windows folder into /mnt/tank/jails/mineos_jail/var/games/minecraft folder. When done, right-click on the minecraft folder (the one on the FreeNAS side) and change the owner & group recursively to root:games like this:
upload_2017-11-19_14-53-39.png


Once this is done, log on to your jail and change the ownership of the server files to mcserver:games
Code:
cd /var/games/minecraft/servers/
chown -R mcserver:games *
 
Last edited:

DawnTreader

Neophyte
Joined
Mar 21, 2017
Messages
10
WinSCP is a great tool once you get it working with the freeNAS. I can look all around at the files and folders for everything.

So I have been hacking away at this most of my day and I get the feeling that something still isn't right. I don't have any screenshots of early attempts but I am uncertain why but I am not getting the EOF checkmark, just BOF. When I use WinSCP to transfer should the jail be stopped?

When I first setup the connection to the FreeNAS with WinSCP I get these dialogs:

upload_2017-11-19_22-51-24.png


When I click the advanced button I get a transfer rule setup choice and get this:
upload_2017-11-19_22-50-16.png


I set the settings the same and gave it a title. I then hit save on the first dialog and then login. I get a dialog that asks for my password, then it shows the folders that I want to navigate. I get them setup and i try a Drag and Drop and get this:
upload_2017-11-19_22-58-23.png


If I click ok the transfer starts and the files get over, but the first time I tried it the whole MineOS jail became unresponsive. I nuked it and tried again. So I just did the transfer again. This time I just tried the files and folders inside of the TonnFamily folder. I was hoping to not disturb any of the other folders under the MineCraft folder other than the stuff inside the servers folder. And again the MineOS web interface is now screwed.

Would there be any incompatibilities between the plugin servers and the standard jail setup? These files are after all from a plugin MineOS install rather than a standard jail setup.

Here is a screen of the transfer settings when I try to do it after logging on to the FreeNAS FTP:
upload_2017-11-19_23-54-31.png


Notice how the BOM and EOF are now just BOM and the ignore is greyed out as well.
 

Attachments

Top