Groov RIO locale and database issues

I’ve started to port one of my applications to the groov RIO. It’s a linux based application that uses a Postgres database for its storage.

Whenever I run the postgresql-setup initdb, it would return [FAILED]. Digging into this, I tried to replicate what the script was doing by hand and ran initdb directly, and it gave me the error:

initdb: invalid locale settings; check LANG and LC_* environment variables
All of those variables are set to either en_US.utf8 or en_US.UTF-8, but running locale states “locale: Cannot set LC_ALL to default locale: No such file or directory” which indicates to me that the utf-8 locales are not properly installed in the system.

locale -a shows C, POSIX, en_US.utf8, and en_US.UTF-8 are available, but when I set LC_ALL to these, only C and POSIX succeed, the other two throw the same error as above.

I was able to confirm that setting the locale to C or POSIX allowed me to successfully create the database files, but running postgres afterward gave me a different message.

“An old version of the database format was found. You need to upgrade the data format before using PostgreSQL.” Which seems to indicate that even if we correct the locale problem there may be a version mismatch in the packages that are in the repository. I put the same locale change in the postgresql-server init script but that did not correct this issue. (The database files that initdb created say the postgres version is 10, the server says it’s 10.5.)

Any ideas on how to solve these issues, or do they need to be fixed upstream in the repo?

Hi Keith, welcome to the Opto Forums.

Are you following the guide here? Installing and Configuring PostgreSQL on groov EPIC | Opto 22 Developer
I did not put that guide together, Im more of a MariaDB guy and have tested that one.
If that guide is the one you are following and its not working on the latest RIO firmware, then I will need to find who put it together and try and sort out what needs to be updated in the guide.
The guides were more intended for EPIC. Not sure how many of them have been tested on a RIO.

(I’m going to leave the question about running PostgresDB on a RIO on the table for now).

I’m pretty close to that document though I’m running it as a script, I’m installing the libpq-dev package as well as the ones that the document listed, since that’s needed for compiling the application. I didn’t install the postgresql-doc package because it’s not needed for the operation of the program generally, but the next time I’m at the office I’ll go ahead and add it as well. It’s halting on step #1 of the second section.

The script I’m using works on the Epic though, since I’ve used the application there before.

The postgresql-doc did not fix the issue, so that’s out.

I found a bug in the init.d script, but for now I just bypassed it.

Near the top of the program it has this:

PGMAJORVERSION=echo "$PGVERSION" | sed 's/^\([0-9]*\.[0-9]*\).*$/\1/'

There’s supposed to be backticks in there but the forum changes those to a different font area instead.
This script fails, it’s supposed to put “PGMAJORVERSION” to 10, but instead it puts it to 10.5, then when it compares it to the database version below, the 10.5 doesn’t match the 10 in the file.

In addition, the locales are still broken, so I bypassed that in this file as well,

$SU -l postgres -c “$PGENGINE/…” becomes
$SU -l postgres -c “LC_ALL="C" $PGENGINE/…”

So that’s gotten my database up, but it’s probably a couple of things that should be fixed upstream.

Ok, I’ve fiddled around with sed until I figured out the right command.

PGMAJORVERSION=`echo "$PGVERSION" | sed 's/^\([0-9]*\)\(\.[0-9]*\)*$/\1/'`

This should replace the one in /etc/init.d/postgresql-server

Still no proper solution for Locales, just a bypass.