pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #16204: Fail to setup
5+ messages / 3 participants
[nested] [flat]
* BUG #16204: Fail to setup
@ 2020-01-11 15:22 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 5+ messages in thread
From: PG Bug reporting form @ 2020-01-11 15:22 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: chamaharun@outlook.com
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
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #16204: Fail to setup
@ 2020-01-11 15:42 Tom Lane <tgl@sss.pgh.pa.us>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 5+ messages in thread
From: Tom Lane @ 2020-01-11 15:42 UTC (permalink / raw)
To: chamaharun@outlook.com; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.org> writes:
> 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 :
No, that guess is wrong. The error message told you to look in
/var/lib/pgsql/10/initdb.log, so what does that file contain?
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #16204: Fail to setup
@ 2020-01-12 09:22 $B>.NS(B $B9*(B <chamaharun@outlook.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 5+ messages in thread
From: $B>.NS(B $B9*(B @ 2020-01-12 09:22 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Dear Tom
Thank you for your reply.
Yeah my guess seem to be wrong but the log says "Success" like this:
[root@tkw-pgcl-sv004 ~]# ls -l /var/lib/pgsql/10/initdb.log
-rw-------. 1 postgres postgres 831 1$B7n(B 12 00:52 /var/lib/pgsql/10/initdb.log
[root@tkw-pgcl-sv004 ~]# cat /var/lib/pgsql/10/initdb.log
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 text search configuration will be set to "english".
Data page checksums are enabled.
fixing permissions on existing directory /mnt/postgres/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Asia/Tokyo
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
Success. You can now start the database server using:
/usr/pgsql-10/bin/pg_ctl -D /mnt/postgres/data -l logfile start
[root@tkw-pgcl-sv004 ~]#
And I have another hypothesis that
"The path used in postgresql-10-setup:L151,L158 is different from data path I set in the environment variable PGSETUP_INITDB_OPTION"
[root@tkw-pgcl-sv004 ~]# ls -l /var/lib/pgsql/10/data//PG_VERSION
ls: cannot access /var/lib/pgsql/10/data//PG_VERSION: No such file or directory
[root@tkw-pgcl-sv004 ~]# ls -l /mnt/postgres/data/PG_VERSION
-rw-------. 1 postgres postgres 3 1$B7n(B 12 00:52 /mnt/postgres/data/PG_VERSION
[root@tkw-pgcl-sv004 ~]# cat /mnt/postgres/data/PG_VERSION
10
from: my log below, $PGDATA might not be set from the environment variable:
+ 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
Is this some kind of bug or can I set data path not to default ?
Best regards, Takumi Kobayashi
________________________________
$B:9=P?M(B: Tom Lane <tgl@sss.pgh.pa.us>
$BAw?.F|;~(B: 2020$BG/(B1$B7n(B12$BF|(B 0:42
$B08@h(B: chamaharun@outlook.com <chamaharun@outlook.com>
CC: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
$B7oL>(B: Re: BUG #16204: Fail to setup
PG Bug reporting form <noreply@postgresql.org> writes:
> 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 :
No, that guess is wrong. The error message told you to look in
/var/lib/pgsql/10/initdb.log, so what does that file contain?
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #16204: Fail to setup
@ 2020-01-12 16:55 Tom Lane <tgl@sss.pgh.pa.us>
parent: $B>.NS(B $B9*(B <chamaharun@outlook.com>
0 siblings, 1 reply; 5+ messages in thread
From: Tom Lane @ 2020-01-12 16:55 UTC (permalink / raw)
To: $B>.NS(B $B9*(B <chamaharun@outlook.com>; +Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
=?iso-2022-jp?B?GyRCPi5OUxsoQiAbJEI5KhsoQg==?= <chamaharun@outlook.com> writes:
> [root@tkw-pgcl-sv004 ~]# cat /var/lib/pgsql/10/initdb.log
> ...
> fixing permissions on existing directory /mnt/postgres/data ... ok
> ...
> Success. You can now start the database server using:
> /usr/pgsql-10/bin/pg_ctl -D /mnt/postgres/data -l logfile start
Right. So, clearly, initdb thinks it was told to initialize
/mnt/postgres/data. Looking back at your original trace,
we see it being called like this:
+ 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'
^^^^^^^^^^^^^^^^^^^^^
So evidently that won out over the earlier --pgdata switch,
which is unsurprising. But it definitely looks like this
service script is confused, or else you've put a -D switch
into some option that's not supposed to contain that.
The Postgres project as such doesn't distribute systemd
service scripts, so you'll need to take this up with
whoever created the script you're using.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: BUG #16204: Fail to setup
@ 2020-01-13 09:50 $B>.NS(B $B9*(B <chamaharun@outlook.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 5+ messages in thread
From: $B>.NS(B $B9*(B @ 2020-01-13 09:50 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Thanks.
>The Postgres project as such doesn't distribute systemd
>service scripts, so you'll need to take this up with
>whoever created the script you're using.
Before I install postgresql-10 server, it is no systemd unit file:
[root@tkw-pgcl-sv003 ~]# ls -l /lib/systemd/system/posttgres*
ls: /lib/systemd/system/postgres* $B$K%"%/%;%9$G$-$^$;$s(B: $B$=$N$h$&$J%U%!%$%k$d%G%#%l%/%H%j$O$"$j$^$;$s(B
But after install it be created:
[root@tkw-pgcl-sv003 ~]# ls -l /lib/systemd/system/postgres*
-rw-r--r--. 1 root root 1728 11$B7n(B 30 23:29 /lib/systemd/system/postgresql-10.service
[root@tkw-pgcl-sv003 ~]# cat /lib/systemd/system/postgresql-10.service
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the
# best way is to create a file "/etc/systemd/system/postgresql-10.service",
# containing
# .include /usr/lib/systemd/system/postgresql-10.service
# ...make your changes here...
# For more info about custom unit files, see
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F
# Note: changing PGDATA will typically require adjusting SELinux
# configuration as well.
# Note: do not use a PGDATA pathname containing spaces, or you will
# break postgresql-setup.
[Unit]
Description=PostgreSQL 10 database server
Documentation=https://www.postgresql.org/docs/10/static/
After=syslog.target
After=network.target
[Service]
Type=notify
User=postgres
Group=postgres
# Note: avoid inserting whitespace in these Environment= lines, or you may
# break postgresql-setup.
# Location of database directory
Environment=PGDATA=/var/lib/pgsql/10/data/
# Where to send early-startup messages from the server (before the logging
# options of postgresql.conf take effect)
# This is normally controlled by the global default set by systemd
# StandardOutput=syslog
# Disable OOM kill on the postmaster
OOMScoreAdjust=-1000
Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
Environment=PG_OOM_ADJUST_VALUE=0
ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA}
ExecStart=/usr/pgsql-10/bin/postmaster -D ${PGDATA}
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
KillSignal=SIGINT
# Do not set any timeout value, so that systemd will not kill postmaster
# during crash recovery.
TimeoutSec=0
[Install]
WantedBy=multi-user.target
The systemd unit file seems to derive from the rpm package the official site distributes.
So where should I contact to solve this issue?
I installed postgresql-10 server from the repository from official website:
https://yum.postgresql.org/repopackages.php
And installed commands are:
# yum -y install https://downloareporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# yum -y install postgresql10-server postgresql10-contrib
# mkdir /mnt/postgres
# mkdir /mnt/postgres/data
# chown postgres:postgres /mnt/postgres/data
Best regards, Takumi Kobayashi
________________________________
$B:9=P?M(B: Tom Lane <tgl@sss.pgh.pa.us>
$BAw?.F|;~(B: 2020$BG/(B1$B7n(B13$BF|(B 1:55
$B08@h(B: $B>.NS(B $B9*(B <chamaharun@outlook.com>
CC: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
$B7oL>(B: Re: BUG #16204: Fail to setup
=?iso-2022-jp?B?GyRCPi5OUxsoQiAbJEI5KhsoQg==?= <chamaharun@outlook.com> writes:
> [root@tkw-pgcl-sv004 ~]# cat /var/lib/pgsql/10/initdb.log
> ...
> fixing permissions on existing directory /mnt/postgres/data ... ok
> ...
> Success. You can now start the database server using:
> /usr/pgsql-10/bin/pg_ctl -D /mnt/postgres/data -l logfile start
Right. So, clearly, initdb thinks it was told to initialize
/mnt/postgres/data. Looking back at your original trace,
we see it being called like this:
+ 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'
^^^^^^^^^^^^^^^^^^^^^
So evidently that won out over the earlier --pgdata switch,
which is unsurprising. But it definitely looks like this
service script is confused, or else you've put a -D switch
into some option that's not supposed to contain that.
The Postgres project as such doesn't distribute systemd
service scripts, so you'll need to take this up with
whoever created the script you're using.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2020-01-13 09:50 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-01-11 15:22 BUG #16204: Fail to setup PG Bug reporting form <noreply@postgresql.org>
2020-01-11 15:42 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-01-12 09:22 ` $B>.NS(B $B9*(B <chamaharun@outlook.com>
2020-01-12 16:55 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-01-13 09:50 ` $B>.NS(B $B9*(B <chamaharun@outlook.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox