Setting up OctoPrint on TrueNAS 12 server inside iocage Jails

Ok, I'm getting somewhere. Seems as soon as I logged into the jail it wasn't putting me into the correct folder. I've got it all installed but it still wont start up automatically or via the octoprint menu.

When I try service octoprint start or service octoprint status its stating:

root@OctoPrint:/ # service octoprint status
/etc/rc.d/octoprint: WARNING: $command_interpreter /root/OctoPrint/venv/bin/python2.7 != /root/OctoPrint/venv/bin/python3.8
/etc/rc.d/octoprint: WARNING: $octoprint_enable is not set properly - see rc.conf(5).
Cannot 'status' octoprint. Set octoprint_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'.
root@OctoPrint:/ #

I have added the line octoprint_enable="YES" to the /etc/rc.conf and also made the script (octoprint) executable. I also noticed the usbconfig also gives an error: no device match or lack of permissions But this maybe because I'm putting the usb ports to my VM, but not sure on that.

Hi @victor76,

I've never been able to get the octoprint menu start/restart to work - but I rarely use it - so I just accepted the limitation of my skills :rofl:. Once you get the jail to autostart it - you should be good.

Based on the first warning - I'm guessing you have python 3.8 installed, but there's a mismatch to python2.7

The second warning should have been addressed by your edit to rc.conf.

IIRC, if you've defined allow_mount_devfs in your jail definition - you should be okay regarding the USB ports. But this will be pretty obvious if you're able/not able to connect to your printer.

Yes I have 3.8 installed as 2.7 command was giving me errors when I tried to install it where as 3.8 went straight through.

The edit is whats confusing me lol as its showing the line there but then states its not there.

Yes I followed the guide for rule set 3 and allow_mount_devfs

Is this what you have in your octoprint rc script? And does it exist?

lol oops forgot to alter that line, thats now fixed :wink: Just refuses to say rc.conf has been changed

What does service octoprint status output now?

Also, if you're running the service as root, octoprint won't run unless you have the command line argument "iknowwhatimdoing":

command_args="serve --iknowwhatimdoing --basedir ${octoprint_basedir} > /dev/null 2>&1 &"

Show this:

root@OctoPrint:/usr/local/etc # service octoprint status
/etc/rc.d/octoprint: WARNING: $octoprint_enable is not set properly - see rc.conf(5).
Cannot 'status' octoprint. Set octoprint_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'.
root@OctoPrint:/usr/local/etc #

Yep I have the 'iknowwhatimdoing' in the server command

If you type:

sysrc octoprint_enable

You should see the current value of octoprint_enable. And to set it, you can type:

sysrc octoprint_enable=YES

lol as soon as I tried those commands it showed:

octoprint_enable: YES

I thought I would give the enable command ago and it stated it changed it from YES -> YES but now shows that theres no octoprint in the directory or not executable:

service ocotoprint start
ocotoprint does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d), or is not executable

Where is the file you've been editing?

Mine is in /usr/local/etc/rc.d and has the following permissions:

[root@octoprint /usr/local/etc/rc.d]$ ls -l octoprint
-rwxr-xr-x  1 root  wheel  1955 Dec 18 18:38 octoprint

lol, its in the folder its stating it isnt, I've just copied the file from where it says it isn't into /usr/local/etc/rc.d/ folder and its gone back to the message:

root@OctoPrint:/usr/local/etc/rc.d # service octoprint restart
/etc/rc.d/octoprint: WARNING: $octoprint_enable is not set properly - see rc.conf(5).
Cannot 'restart' octoprint. Set octoprint_enable to YES in /etc/rc.conf or use 'onerestart' instead of 'restart'.
root@OctoPrint:/usr/local/etc/rc.d #

Dont you just linux lol

What happens if you do as it suggests:

service octoprint onestart

And can you show the output of ls -l in the /usr/local/etc/rc.d folder?

I've just deleted the OctoPrint file from that folder and restarted the jail.

Heres the details of the octoprint file from the /etc/rc.d/ folder

-rwxr-xr-x 1 root wheel 427 Jan 16 17:24 octoprint

Using the 'service octoprint onestart' or onestatus or onerestart all work, but not from the menu part of octoprint and if I install a plugin I have to restart the service from within putty or the truenas shell

Yes, I haven't been able to get service restart to work from the Octoprint menu - but for me, it's a small nuisance since normally, I'm not needing to restart it after it's all setup.

Maybe there was a conflict with the two rc scripts - if onestart works, then your service is defined - what about restart at the command line?

service octoprint onerestart
service octoprint onestatus

both work fine. I was mainly looking at when updates come through as that requires the restart command but I may just go through putty for that.

Well I think I’ve solved my issues, I did have a usb pci card pass through to Ubuntu where I had octoprint installed which is why octoprint in the jail couldn’t see the printer. But after I disabled that passthrough and reinstalled a brand new jail and then installed everything from the guide it’s now all working, well except the menu part which will turn octoprint off but won’t restart it even with the onerestart command. To restart octoprint I have to login to the jail and use the service command that way, but it does seem rare to have to reboot it after I’ve got everything installed.

For those interested, after setting OctoPrint up I installed all the plugins I normally use and one was causing issues PrintTimeGenius, as it was trying to find a marlin calculator for the OS which there wasn’t one. But with the help of the creator of the plug-in I’ve made a calculator for freebsd (TrueNas) and shared it with the creator.

Did you manage to solve the issue?I'd like to add a usb webcam too. Thanks!

From what I've read its all to do with the permissions within freebsd. Unfortunately I've been unable to get any webcam working following all different guides even those from freebsd.

Well I’ve gone a funny way about it, but I’ve got a webcam working on octoprint.

For what I got working I made a Ubuntu VM as I needed it for a CCTV program and from there I was able to get a feed from that program to feed into Octoprint. The program I’m using is AgentDvr which allows a MJPG feed in the format of:

192.168.0.2/video.mjpg?oids=1&size=1280x720

The ‘oids=1’ is the camera feed of which camera you want to appear. So if you have for example 5 cameras and your printer camera is on feed 5 you’d change it to ‘oids=5’

Hope this helps others.