SUSE Manager/PublicCloud

From MicroFocusInternationalWiki
Jump to: navigation, search

SUSE Manager Main Page

Installing SUSE Manager in Public Cloud


See the database problem below - Amazon images are subject to the same database template troubles as Azure.


Database Problem: In the MS Public Cloud from the SLES12 SP1 image in the gallery, creation of postgresql database during SUMA setup fails with this output:

   createdb: database creation failed: 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.
   No answer provided for 'Hostname (leave empty for local)'
   grep: /etc/rhn/rhn.conf: No such file or directory
   ERROR: spacewalk-setup failed

Solution: First, we need to drop template1. Templates can’t be dropped, so we first modify it so it’s an ordinary database:

       su - postgres
       UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';

Now we can drop it:

       DROP DATABASE template1;

Now its time to create database from template0, with a new default encoding:


Now modify template1 so it’s actually a template:

       UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';

Now switch to template1 and VACUUM FREEZE the template:

       \c template1
       ctrl-z (to exit psql)

Problem should be resolved.

This problem can be solved much more easily: Since we are the only users of the embedded database, we can just drop everything and recreate it with correct encoding:

e115:~ # systemctl stop postgresql
e115:~ # rm -rf /var/lib/pgsql/data
e115:~ # su - postgres -c "initdb -D /var/lib/pgsql/data --locale en_US.UTF-8"
e115:~ #

Check for correct setting:

e115:~ # systemctl start postgresql
e115:~ # su - postgres
postgres@e115:~> psql 
psql (9.4.12)
Type "help" for help.

postgres=# \l
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(3 rows)

postgres=# \q
postgres@e115:~> logout
e115:~ # 

If you can see "UTF8" as encoding, everything is fine.

See also