Setting up OctoPrint on TrueNAS 13 server inside iocage Jails

Guide updated to work with python3 and TrueNAS 12, i would try to make a webcam work within the jail but i don't have an available one in the moment.

@Jemison Using this script...does it allow the OctoPrint restart menu to function as it should? I'd prefer not to have to log into TrueNAS everytime I update a plugin or make some other simple change in OctoPrint. Could very well be times where I need to restart the jail but I'd prefer that to be minimal. Thank you.

If you follow the guide carefully, there are commands to restart octoprint and they work within FreeBSD just fine.
Reply if you need further help.

Hi @MarkD

I never got restart to work successfully - maybe I was just doing something wrong. In any case, I stumbled upon the suggestion @puterboy made here to add > /dev/null and now it works like a charm.


This, for me, simply always worked. Β―_(ツ)_/Β―

Hi all

Very much a newbie here, never really coded anything outside of VBA before, but these instructions have been very useful so far.

I have got to the following section in the instructions:

Silly question, but how do I manually start the octoprint server? Using ./OctoPrint/bin/octoprint serve appears as if it's working but then gives me an error "You should not run OctoPrint as root!"

Well, that's fine, but how do I run it otherwise?

Create a second user and switch / login with it.
you could run it with octoprint serve --iknowwhatimdoing.
but (no offense) you don't know what you're doing so run it with a non root user.

Hi, thanks for your response.
Sorry for yet another silly question - but do you mean login to the GUI with the second user? I thought you could only login as root?
And no offence taken, you are absolutely correct - I have no idea what I'm doing! This is just an old PC that I set up as a file server, this is the first time I'm venturing into anything more exotic.

no it also works with a user without any special permissions.

I just tested it to make sure it works, but it requires some additional steps.

I'll try to add them to the guide soon.

What I did:
logged in via webshell in the freenas webgui
enabled ssd
added user oprint
installed packages from the guide

logged in via ssh with user oprint
installed octoprint
started octoprint
checked which port was listed in the octoprint webui (in my case it was /dev/cuaU0)

added chown oprint /dev/cuaU0 to /etc/rc.local
restarted the jail via freenas webui

logged back in via ssh with user oprint
started octoprint again

opened octoprint webui again
connected to /dev/cuaU0
works

Bildschirmfoto vom 2022-09-03 16-29-37

Thanks for your help, almost got it sorted.

Octoprint is now installed and running, it's just not connecting to the printer.
I'm stuck on the line "added chown oprint /dev/cuaU0 to /etc/rc.local" - could you explain a bit more about what to do here please?

So close to getting it sorted and sorry for all of the silly questions, I really appreciate your help!

Nah those questions aren't silly - how are you supposed to learn new things if you don't ask :slight_smile:

Well to be honest that part is a bit hacky.
On linux I would just add the user to the group that has access to serial devices (like your printer) and that's it.
I'm not really familiar with the groups on bsd so instead of putting the user in a group I just allowed him to access this usb device.

So what you do is type nano /etc/rc.local as root which opens a text editor.
Paste the chown <username> <usbdevice> line in it - in my case it was chown oprint /dev/cuaU0.
Exit the text editor with CTRL + X and confirm the question with Y.

That's all

Continuing the discussion from Setting up OctoPrint on TrueNAS 12 server inside iocage Jails:

Hi, when I go to my Octoprint ip, it brings me to the truenas login page.

Can you help me?

Thanks!

You probably forgot to add the port at the end of the address, normally it is 5000, so if your jail IP is 192.168.0.7, then you need to put 192.168.0.7:5000 in your browser's address bar. Let us know if it worked for you.

Thank you for the answer. No it doesn't work. If I put 192.168.2.8:5000 in the address bar of my browser it gives me Unable to connect. If I put only 192.168.2.8 it brings me to the truenas login page.
Sorry for my English I'm french.

Thank.

Then your Octoprint server is probably not running, if you followed the guide correctly and without any problems, then you can try restarting the jail in which OctoPrint is installed and trying to start it with the command ./OctoPrint/bin/octoprint serve --iknowwhatimdoing
Good luck!

Yes, it works now. That was my problem, thanks

Hi, I can manually start the server with the command, but if I close the octoprint shell, the server goes offline. Is there a way to keep the server online?

Thank

Yes there is, you can use screen or termux, but there is a section on the guide specific about running octoprint as a service inside the jail, using rc.d, go back to it and check it out.

Is it possible to use a usb camera? If so, do you have a procedure?
Thank

I just registered here to say thank you! It works like charm on Truenas Core 13 :tada:

No issues at all with basic functionality, apart from some plugins that refuse to install.

Great job with the guide.

Brg. //Erik