Page 1 of 1

Postconf error

Published: June 16, 2020 - 3:31 PM
by Aperi
Good morning,
Wapt server: 1.8.1
Debian Buster

There was a problem with postconf during database installation

Code: Select all

[*] postgresql - creating db wapt
ERROR:  new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)
HINT:  Use the same encoding as in the template database, or use template0 as template.
Traceback (most recent call last):
  File "/opt/wapt/waptserver/scripts/postconf.py", line 704, in <module>
    main()
  File "/opt/wapt/waptserver/scripts/postconf.py", line 439, in main
    ensure_postgresql_db(db_name=server_config['db_name'],db_owner=server_config['db_name'],db_password=server_config['db_password'])
  File "/opt/wapt/waptserver/scripts/postconf.py", line 319, in ensure_postgresql_db
    run(""" sudo -u postgres psql template1 -c "create database %s with owner=%s encoding='utf-8'; " """ % (db_name,db_owner), cwd='/opt/wapt/')
  File "/opt/wapt/waptserver/scripts/postconf.py", line 75, in run
    return subprocess.check_output(*args, shell=True, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command ' sudo -u postgres psql template1 -c "create database wapt with owner=wapt encoding='utf-8'; " ' returned non-zero exit status 1
It seems there's an encoding problem. Do you have any idea what it could be?

THANKS

Re: Postconf error

Published: June 16, 2020 - 6:50 PM
by htouvet
Good morning,
If it's a new installation, you need to install the Debian package "locales-all" before installing PostgreSQL...

See :
https://www.wapt.fr/fr/doc/waptserver-i ... -base.html

Code: Select all

apt install locales-all
localectl set-locale LANG=en_US.UTF-8
localectl status

Re: Postconf error

Published: June 17, 2020 - 08:24
by Aperi
Thank you.

It is indeed a new installation. I had already completed that part, and locales-all is already installed.
I should mention that it's a Proxmox container, in case that makes a difference.

Re: Postconf error

Published: June 17, 2020 - 09:34
by Aperi
After reinstalling on a virtual machine instead of a container, it works. So the problem seems to be there.
I'm not marking this as resolved yet; I'd like to know what's wrong with the container.

Since I'm in the area, I'd like to take this opportunity to thank you for this tool. I hope to convince the appropriate people to upgrade to the enterprise version.

Re: Postconf error

Published: June 17, 2020 - 10:55 PM
by dcardon
During the PostgreSQL installation, it initializes the template0 and template1 databases. The shell encoding used to install the .deb packages will also be used to run the `initdb` command. You need to configure your locale before installing the package.

Something like `export LC_ALL=en_US.utf8` or configuring it with `dpkg-reconfigure locales` should do the trick. Before installing PostgreSQL, double-check with the `export` command that you have `LC_*` lines.