Problem installing Truenas 12

Post any problems / bugs / issues that are Mylar-related in here.
Post Reply
Melotron07
Posts: 10
Joined: Fri Nov 08, 2013 3:24 pm

Problem installing Truenas 12

Post by Melotron07 »

Iam trying to make a new install in a new iocage on truenas (freenas)
I have a old one going that i want to scatch, think its from an old plugin jail around 9.2 that arent healthy time to time.
So I want to make a fresh install and been following this guide:
https://psychogun.github.io/docs/freena ... cage-jail/

It looks as everything are working and no error messages.
But when I try to start it so are it complaining about the module Request.

Code: Select all

root@mylarr:/tmp # service mylar3 start
Starting mylar3.
Traceback (most recent call last):
  File "/usr/local/mylar3/Mylar.py", line 26, in <module>
    import mylar
  File "/usr/local/mylar3/mylar/__init__.py", line 27, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'
/usr/local/etc/rc.d/mylar3: WARNING: failed to start mylar3
When I go in to python and import requests myself so is it installed.

Code: Select all

root@mylarr:/tmp # python3.7
Python 3.7.10 (default, Apr  8 2021, 01:15:14)
[Clang 10.0.1 ([email protected]:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611a on freebsd12
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> exit()
Also when i list all the installed modules so are it installed.

Code: Select all

root@mylarr:/tmp # pip freeze
altgraph==0.17
APScheduler==3.7.0
beautifulsoup4==4.9.3
certifi==2020.12.5
cffi==1.14.5
cfscrape==2.1.1
chardet==4.0.0
cheroot==8.2.1
CherryPy==18.6.0
configparser==5.0.2
feedparser==6.0.2
idna==2.10
importlib-metadata==4.0.1
jaraco.classes==3.2.1
jaraco.collections==3.3.0
jaraco.functools==3.3.0
jaraco.text==3.5.0
Mako==1.1.4
MarkupSafe==2.0.1
more-itertools==8.8.0
natsort==7.1.1
Pillow==6.2.2
portend==2.7.1
pycparser==2.20
pyinstaller==4.3
pyinstaller-hooks-contrib==2021.1
pytz==2021.1
requests==2.25.1
sgmllib3k==1.0.0
simplejson==3.17.2
six==1.16.0
soupsieve==2.2.1
sqlite3==0.0.0
tempora==4.0.2
typing-extensions==3.10.0.0
tzlocal==2.1
unrar==0.4
unrar-cffi==0.1.0a5
urllib3==1.26.4
virtualenv==16.7.5
zc.lockfile==2.0
zipp==3.4.1
Anyone have any advice on how to procede??
Melotron07
Posts: 10
Joined: Fri Nov 08, 2013 3:24 pm

Re: Problem installing Truenas 12

Post by Melotron07 »

Found out that itsa a problem in the rc.d script.

Anyone have a coppy of a working on or know what I need to edit in it ??

Code: Select all

#!/bin/sh
#
# PROVIDE: mylar3
# REQUIRE: DAEMON
# BEFORE:  LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#           mylar3_enable="YES"
# Start it with:
#           service mylar3 start
#
# Stop it with:
#           service mylar3 stop
#
#
#
#
# mylar3_user:  The user account Mylar daemon runs as what
#           you want it to be. It uses 'mylar' user by
#           default. Do not sets it as empty or it will run
#           as root.
# mylar3_dir:   Directory where Mylar lives.
#           Default: /usr/local/mylar3
# mylar3_pid:  The name of the pidfile to create.
#           Default is mylar.pid in mylar_dir.
# mylar3_conf: The name of the config file you would like to launch with mylar3.
#
# command:    The path to your virtual environment executable
#
# https://psychogun.github.io/docs/freenas/Mylar3-in-a-FreeNAS-iocage-jail/
#

. /etc/rc.subr

name="mylar3"
rcvar="${name}_enable"

load_rc_config ${name}
: "${mylar3_enable:="NO"}"
: "${mylar3_user:="mylar"}"
: "${mylar3_dir:="/usr/local/mylar3"}"
: "${mylar3_conf:="/usr/local/mylar3/config.ini"}"

pidfile="/var/run/mylar3/mylar3.pid"

command="/usr/local/virtual/mylar/bin/python"
command_args="${mylar3_dir}/Mylar.py --daemon --nolaunch --pidfile $pidfile --config $mylar3_conf"


start_precmd="${name}_start_precmd"
mylar3_start_precmd() {
        if [ $($ID -u) != 0 ]; then
                err 1 "Must be root."
        fi

        if [ ! -d /var/run/$name ]; then
                install -do $mylar3_user /var/run/$name
        fi
}

load_rc_config ${name}
run_rc_command "$1"
Also no problem with runing it in colsole like this:
python Mylar.py --daemon --nolaunch

So I am guessing that the scrip to have it to run as deamon are wrong =/
Post Reply