BUG #16204: Fail to setup - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #16204: Fail to setup
Date
Msg-id 16204-d78de1072fe55ae4@postgresql.org
Whole thread Raw
Responses Re: BUG #16204: Fail to setup
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      16204
Logged by:          Takumi Kobayashi
Email address:      chamaharun@outlook.com
PostgreSQL version: 10.11
Operating system:   CentOS7
Description:

I installed postgresql10.11 and ran postgresql-10-setup but it fails.
Maybe character $ for variable of PG_VERSION is missing in
/usr/pgsql-10/bin/postgresql-10-setup below :

150 
151     if [ -f "$PGDATA/PG_VERSION" ]; then
152         return 0
153     fi
154     return 1
155 }
156 
157 initdb(){
158     if [ -f "$PGDATA/PG_VERSION" ]; then
159         echo $"Data directory is not empty!"
160         echo


These are my environment:

[root@tkw-pgcl-sv004 ~]# rpm -qa | grep postgres
postgresql10-10.11-2PGDG.rhel7.x86_64
postgresql10-server-10.11-2PGDG.rhel7.x86_64
postgresql10-libs-10.11-2PGDG.rhel7.x86_64
postgresql10-contrib-10.11-2PGDG.rhel7.x86_64

[root@tkw-pgcl-sv004 ~]# cat /etc/redhat-release 
CentOS Linux release 7.7.1908 (Core)
[root@tkw-pgcl-sv004 ~]# yum list installed | grep postgresql10
postgresql10.x86_64                   10.11-2PGDG.rhel7
@pgdg10   
postgresql10-contrib.x86_64           10.11-2PGDG.rhel7
@pgdg10   
postgresql10-libs.x86_64              10.11-2PGDG.rhel7
@pgdg10   
postgresql10-server.x86_64            10.11-2PGDG.rhel7
@pgdg10   
[root@tkw-pgcl-sv004 ~]# 

And log is here:

[root@tkw-pgcl-sv004 ~]# PGSETUP_INITDB_OPTIONS="--data-checksums -E utf8
--no-locale -D /mnt/postgres/data" bash -x
/usr/pgsql-10/bin/postgresql-10-setup initdb
+ PGVERSION=10
++ echo 10
++ sed 's/^\([0-9]*\.[0-9]*\).*$/\1/'
+ PGMAJORVERSION=10
+ PGENGINE=/usr/pgsql-10/bin
+ PREVMAJORVERSION=9.6
+ PREVPGENGINE=/usr/pgsql-9.6/bin
+ PREVDATADIR=/var/lib/pgsql/9.6/data
+ SERVICE_NAME=
+ '[' x = x ']'
+ SERVICE_NAME=postgresql-10
+ OLD_SERVICE_NAME=
+ '[' x = x ']'
+ OLD_SERVICE_NAME=postgresql-9.6
+ USAGE_STRING='
Usage: /usr/pgsql-10/bin/postgresql-10-setup {initdb|check_upgrade|upgrade}
[SERVICE_NAME]

Script is aimed to help sysadmin with basic database cluster
administration.

The SERVICE_NAME is used for selection of proper unit configuration file;
For
more info and howto/when use this script please look at the docu file
.  The '\''postgresql'\''
string is used when no SERVICE_NAME is explicitly passed.

Available operation mode:
  initdb        Create a new PostgreSQL database cluster.  This is usually
the
                first action you perform after PostgreSQL server
installation.
  check_upgrade Checks whether the old cluster can be upgraded to the new
version
                or not.
  upgrade       Upgrade PostgreSQL database cluster to be usable with new
                server.  Use this if you upgraded your PostgreSQL server
to
                newer major version (currently from 9.6 to 10).

Environment:
  PGSETUP_INITDB_OPTIONS     Options carried by this variable are passed
to
                             subsequent call of `initdb` binary (see man
                             initdb(1)).  This variable is used also
during
                             '\''upgrade'\'' mode because the new cluster is
actually
                             re-initialized from the old one.
  PGSETUP_PGUPGRADE_OPTIONS  Options in this variable are passed next to
the
                             subsequent call of `pg_upgrade`.  For more
info
                             about possible options please look at man
                             pg_upgrade(1).
  PGSETUP_DEBUG              Set to '\''1'\'' if you want to see debugging
output.'
+ case "$1" in
++ systemctl show -p Environment postgresql-10.service
++ sed 's/^Environment=//'
++ tr ' ' '\n'
++ tail -n 1
++ sed -n 's/^PGDATA=//p'
+ PGDATA=/var/lib/pgsql/10/data/
+ '[' x/var/lib/pgsql/10/data/ = x ']'
+ '[' -f /etc/systemd/system/postgresql-10.service ']'
+ '[' -f /usr/lib/systemd/system/postgresql-10.service ']'
+ SERVICE_FILE=/usr/lib/systemd/system/postgresql-10.service
+ PGUPLOG=/var/lib/pgsql/10/pgupgrade.log
+ PGLOG=/var/lib/pgsql/10/initdb.log
+ export PGDATA
+ '[' -x /sbin/runuser ']'
+ SU=runuser
+ script_result=0
+ case "$1" in
+ initdb
+ '[' -f /var/lib/pgsql/10/data//PG_VERSION ']'
+ echo -n 'Initializing database ... '
Initializing database ... + perform_initdb
+ '[' '!' -e /var/lib/pgsql/10/data/ ']'
+ '[' -x /sbin/restorecon ']'
+ /sbin/restorecon /var/lib/pgsql/10/data/
+ '[' '!' -e /var/lib/pgsql/10/initdb.log -a '!' -h
/var/lib/pgsql/10/initdb.log ']'
+ touch /var/lib/pgsql/10/initdb.log
+ chown postgres:postgres /var/lib/pgsql/10/initdb.log
+ chmod go-rwx /var/lib/pgsql/10/initdb.log
+ '[' -x /sbin/restorecon ']'
+ /sbin/restorecon /var/lib/pgsql/10/initdb.log
+ initdbcmd='/usr/pgsql-10/bin/initdb
--pgdata='\''/var/lib/pgsql/10/data/'\'' --auth='\''ident'\'''
+ initdbcmd+=' --data-checksums -E utf8 --no-locale -D /mnt/postgres/data'
+ runuser -l postgres -c '/usr/pgsql-10/bin/initdb
--pgdata='\''/var/lib/pgsql/10/data/'\'' --auth='\''ident'\''
--data-checksums -E utf8 --no-locale -D /mnt/postgres/data'
+ mkdir /var/lib/pgsql/10/data//log
+ chown postgres:postgres /var/lib/pgsql/10/data//log
+ chmod go-rwx /var/lib/pgsql/10/data//log
+ '[' -x /sbin/restorecon ']'
+ /sbin/restorecon /var/lib/pgsql/10/data//log
+ '[' -f /var/lib/pgsql/10/data//PG_VERSION ']'
+ return 1
+ echo 'failed, see /var/lib/pgsql/10/initdb.log'
failed, see /var/lib/pgsql/10/initdb.log
+ script_result=1
+ echo

+ exit 1


pgsql-bugs by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Autovacuum potential bug
Next
From: Tom Lane
Date:
Subject: Re: BUG #16204: Fail to setup