Filament manager, external database. Can create spools, can't select them


#1

I have three OctoPi instances sharing a filament database. The database is installed on one of the Raspberries.

What works:

  • database is up;
  • clients can connect;
  • Windows client can connect;
  • any client can see existing spools;
  • any client can create new profiles and spools;
  • spools are available in the drop-down below jobs for selection.

What does not work:

  • when I select a spool for an upcoming job, an error popup saying "spool selection failed, see log for details" (not sure of the exact text, sorry) appears.

Where is the log I'm supposed to see (client Octopi, database host)?


#2

The log in question is the octoprint.log. The error message suggests that it has important information for you and even us.

I think I'd also wonder what version of PostgreSQL you're using.

And finally, your browser's JavaScript console might have something important. In Windows, this is usually an F12 thing and on Safari, it's more of a right-mouse click -> Inspect. In either case, find the Console tab.


#3

psql --version prints 9.4.15

This is the thing from the log:

2018-05-28 20:10:50,471 - octoprint.plugins.filamentmanager - ERROR - Failed to initialize database: (psycopg2.ProgrammingError) syntax error at or near "ON"
LINE 7: ON CONFLICT (table_na...
^
[SQL: '\n CREATE FUNCTION update_lastmodified()\n RETURNS TRIGGER AS func\n BEGIN\n INSERT INTO modifications (table_name, action, changed_at)\n VALUES(TG_TABLE_NAME, TG_OP, CURRENT_TIMESTAMP)\n ON CONFLICT (table_name) DO UPDATE\n SET action=TG_OP, changed_at=CURRENT_TIMESTAMP\n WHERE modifications.table_name=TG_TABLE_NAME;\n PERFORM pg_notify(TG_TABLE_NAME, TG_OP);\n RETURN NULL;\n END;\n func LANGUAGE plpgsql;\n ']


#4

ON CONFLICT only appears in PostgreSQL v9.5 and above, btw. Sounds like you need to slightly update your PostgreSQL a notch.


#5

That's the latest from the repository (that Raspbian's "apt install" can see). Any idea what to do?..


#6

Upgrade to Stretch or use the backports repository.


#7

I don't know what version of Raspbian you're on.

Here is a tutorial for installing PostgreSQL on Raspbian Jessie in the unlikely event that you have this version. Don't just run this example but learn from it.

sudo apt-get install x uses a standard place for pulling code. There are other channels for getting things and I'm sure somebody has a 9.5 version ready to go for the Raspbian you have.


A different approach is to change the SQL itself so that it doesn't use the new syntax.


The standard approach is to reach out to the Filament Manager author, create an issue having identified what you're seeing so that they can assist you.


#8

Octopi (which is where you're expected to run the Filament Manager plugin) comes as Raspbian Jessie image. I keep it current by updating to the latest stable and doing "sudo apt update && sudo apt upgrade" periodically. I don't think it's reasonable to expect OctoPi users to have any versions beyond that...


#9

My OctoPi 0.15.0 image comes with Raspbian Stretch loaded by default.

https://www.postgresql.org/download/linux/debian/

It's perhaps possible to get away from the ambiguity with: sudo apt-get install postgresql-10


#10

Hmm, interesting... I installed 4 instance at different times, they are all Jessie images. Have this changed recently?..


#11

...and no, as I mentioned before, postgresql-10 is not found in any reps for Jessie. Guess I need to add some backports repository, but I don't know where to look.

My workaround is installing a postgresql 10 Docker image on my Synology NAS - probably a better solution than running the database on one of the octopi boards anyway. Thanks for your help!


#12

@3dflat Yes, the recent release of the Raspberry Pi 3B+ has resulted in a new release of OctoPi (currently 0.15.1) which is based on Stretch instead of Jessie.