Forum OpenACS Development: Installing OpenACS on NavServ

Request notifications

Posted by Iuri Sampaio on
Hi there,

In attempt to install OpenACS as per tutorial available at:

I got the following error:

"createdb: database creation failed: ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)"

Meaning that apt-get installed PostgreSQL 9.1 with ASCII as standard encoding. Thus, template and template0 databases were wrongly created such as default.

Then when istallation scripts reach the point when db is created it returns that error.

I already started to write notes how to solve this problem.

Does anyone already have a solution?

Posted by Jim Lynch on
It looks like a problem with postgres, if there are no databases yet, you probably could run initdb again, man initdb and set the encoding... if you are using that pg (for something else) you can initdb (with proper encoding) and run a separate postmaster on that location
Posted by Gustaf Neumann on
It is interesting, at least for fresh installs (various ubuntu versions, FC) the standard encoding is unicode. On what exact operating system are you installing? Since you mention apt-get, this is from the debian familiy, but what exactly?

Since this looks like a fresh install, probably

apt-get remove postgresql postgresql-contrib postgresql-devel
export LANG=en_US.UTF-8
apt-get install postgresql postgresql-contrib postgresql-devel
should do this trick. If so, i'll add the LANG setting to the script.

Posted by Jim Lynch on
Yeah, I suspect pretty strongly postgres was built from source and initdb run by hand, because I'm pretty sure any recent debian packages would run initdb with utf8 as default encoding. Also recent debians and ubuntus are utf-8 from the start. Or, maybe it's an old installation? I'm also not so sure env vars are allowed to be influential to a package install; instead the language and other settings are stored in a config file using the debconf mechanism.


Posted by Iuri Sampaio on

I wouldn't be so strongly sure about it. We installed postgresql from apt-get. I removed and installed again even.

See version details on this post still.

source.list is bellow:

deb precise main restricted universe
deb precise-updates main restricted universe
deb precise-security main restricted universe multiverse
deb precise partner

Posted by Iuri Sampaio on

See details of OS installation. It isn't that old.

root@newiuri:~# cat /etc/issue
Ubuntu 12.04.4 LTS \n \l

postgres@newiuri:~$ uname -a
Linux newiuri 2.6.32-22-pve #1 SMP Mon Jul 15 08:36:46 CEST 2013 x86_64 x86_64 x86_64 GNU/Linux

Furthermore, after running apt-get again as per your notes I got warnings telling that postgresql-dev wether's missing or obsolete. it also indicates libpq-dev as a replacement. See bellow.

root@newiuri:~# apt-get install postgresql postgresql-contrib postgresql-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package postgresql-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libpq-dev:i386 libpq-dev

E: Package 'postgresql-dev' has no installation candidate

I installed it anyway. You can see bellow the default encoding's cuoriously set to ASCII.

postgres@newiuri:~$ /usr/lib/postgresql/9.1/bin/initdb -D /var/lib/postgresql/9.1/main/
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale C.
The default database encoding has accordingly been set to SQL_ASCII.
The default text search configuration will be set to "english".

initdb: directory "/var/lib/postgresql/9.1/main" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/postgresql/9.1/main" or run initdb
with an argument other than "/var/lib/postgresql/9.1/main".


Moreover, I ran initdb command using -E argument
/usr/lib/postgresql/9.1/bin/initdb -E UTF8 -D /var/lib/postgresql/9.1/main/

Now, templates were properly encoded. OACS script finished successfuly!


Posted by Gustaf Neumann on
We installed the script on various fresh installs of Ubuntu 12.04.4, where postgres initializes itself to unicode, but maybe you have a nationalized version of ubuntu that causes this effect, or you are running the script from a shell where the environment variables cause this effect. To be on the safe side, i've added setting of environment variables to the script.

glad, everything works fine now.

Posted by Gustaf Neumann on
Concerning package "postgresql-devel": sorry, i've pasted in my above posting the package name for readhat/fedora core. The script uses libpq-dev for the debian family.
Posted by Cesareo Garci­a Rodicio on

As Jim says, this is an error with postgres OR with that Database.

Mostly, this encoding problem doesn't seem to occur me now but, when it occurred to me I solved it manually (with initdb). So you have to check:
- psql -l (to see DB and encoding data)
- If SQL_ASCII , use initdb (re-install or do it manually via console)

But, it doesn't to occur via those install-**.sh scripts . Perhaps there are another postgres instances or old setup

Posted by Iuri Sampaio on
Thanks Cesareo.

Issue's already solved. See previous posts.