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

Joined
Jul 10, 2016
Messages
521
This tutorial is intended to be a simple cookbook for FreeNAS users that would like to set up MineOS in a jail without using the MineOS plugin.

EDIT: The original post was created on FreeNAS-9.10-STABLE; currently FreeNAS uses iocage as the jail manager, and this post has been updated to reflect this. Tested using FreeNAS 11.3-U5

1. Create a jail.
For this exercise, I named the jail mineos-jail. You can use the WebUI to create the jail, but below it is done via the command line. Any network options should work. If you use the webUI, be sure to check the mount_procfs and mount_linprocfs checkboxes in the Custom Properties section. In this example, I'm using NAT so it's also forwarding the proper ports via the nat_forwards property.
Code:
iocage create -n mineos-jail -r 11.4-RELEASE nat=1 vnet=1
iocage set mount_procfs=1 mount_linprocfs=1 boot=on allow_raw_sockets=1 mineos-jail
iocage set nat_forwards="tcp(8443:8443),tcp(25565:25565),tcp(25566:25566),tcp(25567:25567),tcp(25568:25568),tcp(25569:25569),tcp(25570:25570)" mineos-jail
iocage start mineos-jail


2. Shell into your jail & install the necessary packages
Login as root to your jail and run the following commands:
Code:
pkg update
pkg upgrade -y
pkg install -y py38-rdiff-backup rsync gmake screen git-lite python38 py38-supervisor node npm openjdk16 wget bash


[note: I added bash & wget, as I needed these to run/instal specific Minecraft servers and scripts related to Spigot and RaspberryJuice]

3. Install MineOS-node
Code:
mkdir -p /usr/compat/linux/proc
mkdir -p /usr/local/games
cd /usr/local/games
git clone git://github.com/hexparrot/mineos-node minecraft
cd minecraft
chmod +x *.sh
./generate-sslcert.sh
cp mineos.conf /etc/mineos.conf
npm install jsegaert/node-userid
echo "CXX=c++ npm install" | sh


If you do not care to use SSL/HTTPS, you can edit the mineos configuration file /etc/mineos.conf to change parameter use_https to false.

4. Startup MineOS-node when jail starts and start the service

Code:
cat /usr/local/games/minecraft/init/supervisor_conf.bsd >> /usr/local/etc/supervisord.conf
sysrc supervisord_enable="YES"
service supervisord start


5. Add a unprivileged user to use with the MineOS web-ui
Use the adduser command to start the process
Code:
adduser

Follow the prompts; the result should more or less look like the example below. I'm sticking to the same user mcserver as the plugin.
Code:
[root@mineos_jail /usr/local/games/minecraft]# adduser
Username: mcserver
Full name: User for MineOS
Uid (Leave empty for default):
Login group [mcserver]:
Login group is mcserver. Invite mcserver into other groups? []: games
Login class [default]:
Shell (sh csh tcsh git-shell bash rbash nologin) [sh]: bash
Home directory [/home/mcserver]:
Home directory permissions (Leave empty for default):
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password:
Enter password again:
Lock out the account after creation? [no]:
Username   : mcserver
Password   : *****
Full Name  : User for MineOS
Uid        : 1001
Class      :
Groups     : mcserver games
Home       : /home/mcserver
Home Mode  :
Shell      : /usr/local/bin/bash
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (mcserver) to the user database.
Add another user? (yes/no): no
Goodbye!


6. Exit the jail & go to a browser
You should now be able to access the MineOS webUI using the following URL:
https://<IP address of jail>:8443/admin/login.html

Note 1: If you use NAT, you'll have to use the IP address of the FreeNAS host.
Note 2: Ideally you create a dataset to store your Minecraft server data on your main pool, and then mount it inside your jail, e.g.:
Code:
iocage fstab -a mineos-jail "/mnt/tank/mcdata /var/games/minecraft nullfs rw 0 0"


Many thanks to Joshua Parker Ruehlig and Hexparrot for their excellent instructions and documentation in various threads. For further reference, please see
 
Last edited:

rafadavidc

Dabbler
Joined
Mar 26, 2016
Messages
38
Imma go sandbox this when I get home and see what the difference is between this and the vB MineOS I have up is. Thanks for this.
 

clugo633

Dabbler
Joined
Apr 16, 2015
Messages
18
hello. Im new to using the shell but I continue to get the following fatal message when I enter:
  1. git clone git://github.com/hexparrot/mineos-node minecraft

    fatal: Unable to look up github.com (port 9418) (hostname nor servname provided, or not known)

    Can someone please point me in the right direction. Thanks.
 
Joined
Jul 10, 2016
Messages
521
Thanks! followed these steps was confused with running the last command still not sure what it does?
The last statement, to mount linprocfs is a requirement for the MineOS webui to run properly. It doesn't work without it.
 
Joined
Jul 10, 2016
Messages
521
You may be behind a proxy. Try using the https protocol instead of git protocol:
Code:
git clone https://github.com/hexparrot/mineos-node minecraft
 

clugo633

Dabbler
Joined
Apr 16, 2015
Messages
18
Tried that and still no luck. Not able to resolve
 

tfast500

Explorer
Joined
Feb 9, 2015
Messages
77
Make sure your dns are set in your jail.

/etc/resolv.conf

Sent from my Nexus 6P using Tapatalk
 

cygnus

Explorer
Joined
Mar 20, 2012
Messages
73
Hi All, thanks for this after plugin fails to create a server thought this helps unfortunately I get error on the second step after creating the jail as appears to create a jail for 10.3 version.
Updating FreeBSD repository catalogue...
Repository FreeBSD has a wrong packagesite, need to re-create database
pkg: http://pkg.FreeBSD.org/freebsd:10:x86:64/latest/meta.txz: No address record
repository FreeBSD has no meta file, using default settings
pkg: http://pkg.FreeBSD.org/freebsd:10:x86:64/latest/packagesite.txz: No address
record
Unable to update repository FreeBSD
All help greatly appreciated
Rgds
Cygnus
 
Joined
Jul 10, 2016
Messages
521
I suspect you don't have networking in your jail. Can you ping 8.8.8.8 ?
Please verify both your global network settings (Network > Global Configuration - make sure you have a default gateway specified) and jail specific network settings.
 

cygnus

Explorer
Joined
Mar 20, 2012
Messages
73
I suspect you don't have networking in your jail. Can you ping 8.8.8.8 ?
Please verify both your global network settings (Network > Global Configuration - make sure you have a default gateway specified) and jail specific network settings.


Thanks that helps but now the blimmin jail is started and can ping but when open http or https://192.168.0.157:8443/admin/login.html never shows the webinterface and times out.

Appears I get Err_Connection_Refused for some reason!
 
Last edited:

cygnus

Explorer
Joined
Mar 20, 2012
Messages
73
Thanks that helps but now the blimmin jail is started and can ping but when open http or https://192.168.0.157:8443/admin/login.html never shows the webinterface and times out.

Appears I get Err_Connection_Refused for some reason!

Is there a list of things I can check to see if installed correctly?
Many thanks
 
Joined
Jul 10, 2016
Messages
521
So I assume now you can both ping your jail IP from your LAN and ping outside from within your jail.

Logon to your jail and check that the service is running using service supervisord status

Check file /etc/mineos.conf if the parameter use_https = true, then you're supposed to use https, otherwise use http

If all that is OK, look for the following files in directory /var/log/
  • supervisord.log
  • mineos.log
 

cygnus

Explorer
Joined
Mar 20, 2012
Messages
73
So I assume now you can both ping your jail IP from your LAN and ping outside from within your jail.

Logon to your jail and check that the service is running using service supervisord status

Check file /etc/mineos.conf if the parameter use_https = true, then you're supposed to use https, otherwise use http

If all that is OK, look for the following files in directory /var/log/
  • supervisord.log
  • mineos.log
Thanks Jurgen, unfortunately I get this....
root@mineos_jail:/ # service supervisord status
supervisord is not running.
root@mineos_jail:/ # service supervisord start
Starting supervisord.
Error: .ini file does not include supervisord section
For help, use /usr/local/bin/supervisord -h
/usr/local/etc/rc.d/supervisord: WARNING: failed to start supervisord

on checking var/log I dont have either of those files you mention. So something must have not got installed correctly I'm guessing.

lastly use_https = false

Hope you can help me!
Thanks again
 
Joined
Jul 10, 2016
Messages
521
What is the content of supervisord configuration file? /usr/local/etc/supervisord.conf
It should pretty much look like the default file (/usr/local/etc/supervisord.conf.sample) with the contents from file
/usr/local/games/minecraft/init/supervisor_conf.bsd added at the end.
 

cygnus

Explorer
Joined
Mar 20, 2012
Messages
73
What is the content of supervisord configuration file? /usr/local/etc/supervisord.conf
It should pretty much look like the default file (/usr/local/etc/supervisord.conf.sample) with the contents from file
/usr/local/games/minecraft/init/supervisor_conf.bsd added at the end.

After your assistance I can now get to the webinterface - My last problem now is I cannot select a runnable Jar file to use. I managed to download the profile for the latest Mojang version but nothing shows on the dropdown for Runnable Jar files!!! Close but yet so far! :) thanks for your help!!

OK so copied my minecraft jar into the server folder and allows me to select it now but just wont start!!

Ever closer!
 
Last edited:
Joined
Jul 10, 2016
Messages
521
Hmm... that copying should happen automatically. Check these permissions:
  • Be sure to logon to the MineOS UI using the non-privileged user you created (mcserver) and not via root
  • Make sure that you added that user mcserver to the group games
  • Verify the ownership of the directory /var/games/minecraft and all its sub-directories. They should be owned by root:games.
Code:
root@mineos_3:/var/games/minecraft # ls -al                                     
total 12                                                                       
drwxr-xr-x  7 root  games  7 Feb 12 21:21 .                                     
drwxrwxr-x  3 root  games  3 Feb 12 21:21 ..                                   
drwxrwxr-x  3 root  games  3 Feb 12 21:25 archive                               
drwxrwxr-x  3 root  games  3 Feb 12 21:25 backup                               
drwxrwxrwx  2 root  games  2 Feb 12 21:21 import                               
drwxrwxr-x  3 root  games  3 Feb 12 21:25 profiles                             
drwxrwxr-x  3 root  games  3 Feb 12 21:25 servers                               
root@mineos_3:/var/games/minecraft #  

Also, now that everything seems to be installed stop/restart jail as per the steps in #6 in the guide
 

cygnus

Explorer
Joined
Mar 20, 2012
Messages
73
Hmm... that copying should happen automatically. Check these permissions:
  • Be sure to logon to the MineOS UI using the non-privileged user you created (mcserver) and not via root
  • Make sure that you added that user mcserver to the group games
  • Verify the ownership of the directory /var/games/minecraft and all its sub-directories. They should be owned by root:games.
Code:
root@mineos_3:/var/games/minecraft # ls -al                                    
total 12                                                                      
drwxr-xr-x  7 root  games  7 Feb 12 21:21 .                                    
drwxrwxr-x  3 root  games  3 Feb 12 21:21 ..                                  
drwxrwxr-x  3 root  games  3 Feb 12 21:25 archive                              
drwxrwxr-x  3 root  games  3 Feb 12 21:25 backup                              
drwxrwxrwx  2 root  games  2 Feb 12 21:21 import                              
drwxrwxr-x  3 root  games  3 Feb 12 21:25 profiles                            
drwxrwxr-x  3 root  games  3 Feb 12 21:25 servers                              
root@mineos_3:/var/games/minecraft # 

Also, now that everything seems to be installed stop/restart jail as per the steps in #6 in the guide

Thanks again Jurgen
my ls -al shows
root@mineos_jail:/var/games/minecraft # ls -al
total 12
drwxr-xr-x 7 root games 7 Feb 12 17:27 .
drwxrwxr-x 3 root games 3 Feb 12 17:27 ..
drwxrwxr-x 4 root games 4 Feb 12 18:01 archive
drwxrwxr-x 4 root games 4 Feb 12 18:01 backup
drwxrwxrwx 2 root games 2 Feb 12 17:27 import
drwxrwxr-x 4 root games 4 Feb 12 17:44 profiles
drwxrwxr-x 3 root games 3 Feb 12 18:01 servers

I have restarted the jail a number of times, but I cant see how to check if mcserver has also been added to games group? I'm 99% sure I requested it on the adduser command. but be great to check.
Many thanks
 
Joined
Jul 10, 2016
Messages
521
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.
 
Top