Lists: | pgsql-bugs |
---|
From: | allan(dot)kristsensen(at)schneider-electric(dot)com |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #13612: postgresql94-setup initdb in kickstart fails |
Date: | 2015-09-10 08:13:12 |
Message-ID: | 20150910081312.2597.31540@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 13612
Logged by: Allan Kristensen
Email address: allan(dot)kristsensen(at)schneider-electric(dot)com
PostgreSQL version: 9.4.4
Operating system: Centos 7
Description:
Running "/usr/pgsql-9.4/bin/postgresql94-setup initdb" during Kickstart
install of a Centos/RHEL 7 will through the following error.
failed to find PGDATA setting in postgresql-9.4.service
Running in chroot, ignoring request.
In bin/postgresql94-setup the problematic lines are:
PGDATA=`systemctl show -p Environment "${SERVICE_NAME}.service" |
sed 's/^Environment=//' | tr ' ' '\n' |
sed -n 's/^PGDATA=//p' | tail -n 1`
if [ x"$PGDATA" = x ]; then
echo "failed to find PGDATA setting in ${SERVICE_NAME}.service"
exit 1
fi
systemctl returns an empty result as it won't run in a chroot.
Besides the above. What puzzles me is that PGDATA is overwritten further
down in the script.
# Get data directory from the service file
PGDATA=`sed -n 's/Environment=PGDATA=//p' "${SERVICE_FILE}"`
I have put things together to the following:
# this parsing technique fails for PGDATA pathnames containing spaces,
# but there's not much I can do about it given systemctl's output format...
PGDATA=`systemctl show -p Environment "${SERVICE_NAME}.service" |
sed 's/^Environment=//' | tr ' ' '\n' |
sed -n 's/^PGDATAA=//p' | tail -n 1`
if [ x"$PGDATA" = x ]; then
# Find the unit file for new version.
if [ -f "/etc/systemd/system/${SERVICE_NAME}.service" ]
then
SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service"
elif [ -f "/lib/systemd/system/${SERVICE_NAME}.service" ]
then
SERVICE_FILE="/lib/systemd/system/${SERVICE_NAME}.service"
else
echo "Could not find systemd unit file ${SERVICE_NAME}.service"
exit 1
fi
# Get data directory from the service file
PGDATA=`sed -n 's/Environment=PGDATA=//p' "${SERVICE_FILE}"`
if [ x"$PGDATA" = x ]; then
echo "Failed to find PGDATA setting in ${SERVICE_NAME}.service"
exit 1
fi
fi
export PGDATA
If systemctl does not find a path then try the searching in files and exit
if none of the methods provides a valid path.
From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | allan(dot)kristsensen(at)schneider-electric(dot)com |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #13612: postgresql94-setup initdb in kickstart fails |
Date: | 2015-09-10 13:11:33 |
Message-ID: | 20150910131133.GA4408@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
On Thu, Sep 10, 2015 at 08:13:12AM +0000, allan(dot)kristsensen(at)schneider-electric(dot)com wrote:
> The following bug has been logged on the website:
>
> Bug reference: 13612
> Logged by: Allan Kristensen
> Email address: allan(dot)kristsensen(at)schneider-electric(dot)com
> PostgreSQL version: 9.4.4
> Operating system: Centos 7
> Description:
>
> Running "/usr/pgsql-9.4/bin/postgresql94-setup initdb" during Kickstart
> install of a Centos/RHEL 7 will through the following error.
Uh, we didn't write or maintain that file.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
From: | Devrim GÜNDÜZ <devrim(at)gunduz(dot)org> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us>, allan(dot)kristsensen(at)schneider-electric(dot)com |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #13612: postgresql94-setup initdb in kickstart fails |
Date: | 2015-09-10 13:20:17 |
Message-ID: | 1441891217.12856.11.camel@gunduz.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
Hi,
On Thu, 2015-09-10 at 09:11 -0400, Bruce Momjian wrote:
> Uh, we didn't write or maintain that file.
It comes with the RPMs.
Allan, I'll take a look soon.
Regards,
--
Devrim GÜNDÜZ
Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR
From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Devrim GÜNDÜZ <devrim(at)gunduz(dot)org> |
Cc: | allan(dot)kristsensen(at)schneider-electric(dot)com, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #13612: postgresql94-setup initdb in kickstart fails |
Date: | 2015-09-10 13:23:45 |
Message-ID: | 20150910132345.GB4408@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
On Thu, Sep 10, 2015 at 04:20:17PM +0300, Devrim Gunduz wrote:
>
> Hi,
>
> On Thu, 2015-09-10 at 09:11 -0400, Bruce Momjian wrote:
> > Uh, we didn't write or maintain that file.
>
> It comes with the RPMs.
>
> Allan, I'll take a look soon.
Oh, OK. I wasn't sure if it was something from the RPMs, or something
Red Hat wrote.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Devrim GÜNDÜZ <devrim(at)gunduz(dot)org> |
Cc: | allan(dot)kristsensen(at)schneider-electric(dot)com, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #13612: postgresql94-setup initdb in kickstart fails |
Date: | 2015-09-10 13:25:23 |
Message-ID: | 20150910132523.GA20785@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
On Thu, Sep 10, 2015 at 09:23:45AM -0400, Bruce Momjian wrote:
> On Thu, Sep 10, 2015 at 04:20:17PM +0300, Devrim Gunduz wrote:
> >
> > Hi,
> >
> > On Thu, 2015-09-10 at 09:11 -0400, Bruce Momjian wrote:
> > > Uh, we didn't write or maintain that file.
> >
> > It comes with the RPMs.
> >
> > Allan, I'll take a look soon.
>
> Oh, OK. I wasn't sure if it was something from the RPMs, or something
> Red Hat wrote.
FYI, I am getting an email failure from the original poster, so there
might not be much point in replying to him:
User allan.kristsensen (allan(dot)kristsensen(at)schneider-electric(dot)com) not
listed in Domino Directory
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | Devrim GÜNDÜZ <devrim(at)gunduz(dot)org>, allan(dot)kristensen(at)schneider-electric(dot)com, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #13612: postgresql94-setup initdb in kickstart fails |
Date: | 2015-09-10 16:10:50 |
Message-ID: | 20150910161050.GM2912@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
Bruce Momjian wrote:
> On Thu, Sep 10, 2015 at 09:23:45AM -0400, Bruce Momjian wrote:
> > On Thu, Sep 10, 2015 at 04:20:17PM +0300, Devrim Gunduz wrote:
> > >
> > > Hi,
> > >
> > > On Thu, 2015-09-10 at 09:11 -0400, Bruce Momjian wrote:
> > > > Uh, we didn't write or maintain that file.
> > >
> > > It comes with the RPMs.
> > >
> > > Allan, I'll take a look soon.
> >
> > Oh, OK. I wasn't sure if it was something from the RPMs, or something
> > Red Hat wrote.
>
> FYI, I am getting an email failure from the original poster, so there
> might not be much point in replying to him:
>
> User allan.kristsensen (allan(dot)kristsensen(at)schneider-electric(dot)com) not
> listed in Domino Directory
He mistyped his address in the bug report form. I corrected it here.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From: | Allan(dot)Kristensen(at)schneider-electric(dot)com |
---|---|
To: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
Cc: | Bruce Momjian <bruce(at)momjian(dot)us>, Devrim GÜNDÜZ <devrim(at)gunduz(dot)org>, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #13612: postgresql94-setup initdb in kickstart fails |
Date: | 2015-09-11 06:26:38 |
Message-ID: | OFE71BC216.8F0D6B04-ONC1257EBD.0021CCE6-C1257EBD.0023659E@schneider-electric.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
Álvaro Herrera wrote:
> Bruce Momjian wrote:
> > On Thu, Sep 10, 2015 at 09:23:45AM -0400, Bruce Momjian wrote:
> > > On Thu, Sep 10, 2015 at 04:20:17PM +0300, Devrim Gunduz wrote:
> > > >
> > > > Hi,
> > > >
> > > > On Thu, 2015-09-10 at 09:11 -0400, Bruce Momjian wrote:
> > > > > Uh, we didn't write or maintain that file.
> > > >
> > > > It comes with the RPMs.
> > > >
> > > > Allan, I'll take a look soon.
> > >
> > > Oh, OK. I wasn't sure if it was something from the RPMs, or
something
> > > Red Hat wrote.
> >
> > FYI, I am getting an email failure from the original poster, so there
> > might not be much point in replying to him:
> >
> > User allan.kristsensen (allan(dot)kristsensen(at)schneider-electric(dot)com)
not
> > listed in Domino Directory
>
> He mistyped his address in the bug report form. I corrected it here.
Thanks Álvaro and sorry about the email address.
The rpm in question postgresql94-server-9.4.4-1PGDG.rhel7.x86_64.rpm
downloaded from the http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/
repo.
Best regards
Allan Kristensen
_____________________________________________________________________________________
Allan Kristensen | APC by Schneider Electric | IT Business |
Denmark | Configuration Management Administrator
Phone: +45 72190143 | Mobile: +45 20752220
Email: allan(dot)kristensen(at)schneider-electric(dot)com | Site:
www.schneider-electric.dk | Address: Silcon Alle, 6000 Kolding, Denmark
*** Please consider the environment before printing this e-mail ***
From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Devrim GÜNDÜZ <devrim(at)gunduz(dot)org>, Allan
Kristensen/DK/Schneider(at)Europe, pgsql-bugs(at)postgresql(dot)org
Date: 09/10/2015 18:10
Subject: Re: [BUGS] BUG #13612: postgresql94-setup initdb in
kickstart fails
Bruce Momjian wrote:
> On Thu, Sep 10, 2015 at 09:23:45AM -0400, Bruce Momjian wrote:
> > On Thu, Sep 10, 2015 at 04:20:17PM +0300, Devrim Gunduz wrote:
> > >
> > > Hi,
> > >
> > > On Thu, 2015-09-10 at 09:11 -0400, Bruce Momjian wrote:
> > > > Uh, we didn't write or maintain that file.
> > >
> > > It comes with the RPMs.
> > >
> > > Allan, I'll take a look soon.
> >
> > Oh, OK. I wasn't sure if it was something from the RPMs, or something
> > Red Hat wrote.
>
> FYI, I am getting an email failure from the original poster, so there
> might not be much point in replying to him:
>
> User allan.kristsensen (allan(dot)kristsensen(at)schneider-electric(dot)com) not
> listed in Domino Directory
He mistyped his address in the bug report form. I corrected it here.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
______________________________________________________________________
From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Allan(dot)Kristensen(at)schneider-electric(dot)com |
Cc: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Devrim GÜNDÜZ <devrim(at)gunduz(dot)org>, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #13612: postgresql94-setup initdb in kickstart fails |
Date: | 2015-09-11 21:19:20 |
Message-ID: | 20150911211920.GB4139@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
On Fri, Sep 11, 2015 at 08:26:38AM +0200, Allan(dot)Kristensen(at)schneider-electric(dot)com wrote:
> lvaro Herrera wrote:
> > Bruce Momjian wrote:
> > > On Thu, Sep 10, 2015 at 09:23:45AM -0400, Bruce Momjian wrote:
> > > > On Thu, Sep 10, 2015 at 04:20:17PM +0300, Devrim Gunduz wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > On Thu, 2015-09-10 at 09:11 -0400, Bruce Momjian wrote:
> > > > > > Uh, we didn't write or maintain that file.
> > > > >
> > > > > It comes with the RPMs.
> > > > >
> > > > > Allan, I'll take a look soon.
> > > >
> > > > Oh, OK. I wasn't sure if it was something from the RPMs, or something
> > > > Red Hat wrote.
> > >
> > > FYI, I am getting an email failure from the original poster, so there
> > > might not be much point in replying to him:
> > >
> > > User allan.kristsensen (allan(dot)kristsensen(at)schneider-electric(dot)com) not
> > > listed in Domino Directory
> >
> > He mistyped his address in the bug report form. I corrected it here.
>
> Thanks lvaro and sorry about the email address.
>
> The rpm in question postgresql94-server-9.4.4-1PGDG.rhel7.x86_64.rpm downloaded
> from the http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/ repo.
Thanks. I would be interested to know how email list subscribers like
me can determine who the source of the OS-specific script is so we can
properly route such messsages.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
From: | Allan(dot)Kristensen(at)schneider-electric(dot)com |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Devrim GÜNDÜZ <devrim(at)gunduz(dot)org>, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #13612: postgresql94-setup initdb in kickstart fails |
Date: | 2015-10-27 09:08:26 |
Message-ID: | OF5C73D522.300CF89C-ONC1257EEB.002DC722-C1257EEB.0032360A@schneider-electric.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-bugs |
> On Fri, Sep 11, 2015 at 08:26:38AM +0200,
Allan(dot)Kristensen(at)schneider-electric(dot)com wrote:
> > lvaro Herrera wrote:
> > > Bruce Momjian wrote:
> > > > On Thu, Sep 10, 2015 at 09:23:45AM -0400, Bruce Momjian wrote:
> > > > > On Thu, Sep 10, 2015 at 04:20:17PM +0300, Devrim Gunduz wrote:
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > On Thu, 2015-09-10 at 09:11 -0400, Bruce Momjian wrote:
> > > > > > > Uh, we didn't write or maintain that file.
> > > > > >
> > > > > > It comes with the RPMs.
> > > > > >
> > > > > > Allan, I'll take a look soon.
> > > > >
> > > > > Oh, OK. I wasn't sure if it was something from the RPMs, or
something
> > > > > Red Hat wrote.
> > > >
> > > > FYI, I am getting an email failure from the original poster, so
there
> > > > might not be much point in replying to him:
> > > >
> > > > User allan.kristsensen
(allan(dot)kristsensen(at)schneider-electric(dot)com) not
> > > > listed in Domino Directory
> > >
> > > He mistyped his address in the bug report form. I corrected it
here.
> >
> > Thanks lvaro and sorry about the email address.
> >
> > The rpm in question postgresql94-server-9.4.4-1PGDG.rhel7.x86_64.rpm
downloaded
> > from the http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/ repo.
>
> Thanks. I would be interested to know how email list subscribers like
> me can determine who the source of the OS-specific script is so we can
> properly route such messsages.
>
> --
> Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> EnterpriseDB http://enterprisedb.com
>
> + Everyone has their own god. +
I have been using the lines from OP for over a month now and did not find
any issues. What is the process for incorporating it into the next
release?
Here is the diff if that makes life easier.
########### Diff start ###########
--- /usr/pgsql-9.4/bin/postgresql94-setup 2015-06-11
13:19:27.000000000 +0200
+++ /usr/pgsql-9.4/bin/postgresql94-setup.new 2015-10-26
16:05:28.082858681 +0100
@@ -79,32 +79,34 @@
sed 's/^Environment=//' | tr ' ' '\n' |
sed -n 's/^PGDATA=//p' | tail -n 1`
if [ x"$PGDATA" = x ]; then
- echo "failed to find PGDATA setting in ${SERVICE_NAME}.service"
- exit 1
+ # Find the unit file for new version.
+ if [ -f "/etc/systemd/system/${SERVICE_NAME}.service" ]
+ then
+ SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service"
+ elif [ -f "/lib/systemd/system/${SERVICE_NAME}.service" ]
+ then
+ SERVICE_FILE="/lib/systemd/system/${SERVICE_NAME}.service"
+ else
+ echo "Could not find systemd unit file ${SERVICE_NAME}.service"
+ exit 1
+ fi
+
+ # Get data directory from the service file
+ PGDATA=`sed -n 's/Environment=PGDATA=//p' "${SERVICE_FILE}"`
+
+ if [ x"$PGDATA" = x ]; then
+ echo "Failed to find PGDATA setting in ${SERVICE_NAME}.service"
+ exit 1
+ fi
fi
-# Find the unit file for new version.
-if [ -f "/etc/systemd/system/${SERVICE_NAME}.service" ]
-then
- SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service"
-elif [ -f "/lib/systemd/system/${SERVICE_NAME}.service" ]
-then
- SERVICE_FILE="/lib/systemd/system/${SERVICE_NAME}.service"
-else
- echo "Could not find systemd unit file ${SERVICE_NAME}.service"
- exit 1
-fi
+export PGDATA
# Log file for pg_upgrade
PGUPLOG=/var/lib/pgsql/$PGMAJORVERSION/pgupgrade.log
# Log file for initdb
PGLOG=/var/lib/pgsql/9.4/initdb.log
-# Get data directory from the service file
-PGDATA=`sed -n 's/Environment=PGDATA=//p' "${SERVICE_FILE}"`
-
-export PGDATA
-
# For SELinux we need to use 'runuser' not 'su'
if [ -x /sbin/runuser ]
then
########### Diff end ###########
Best regards
Allan Kristensen
_____________________________________________________________________________________
Allan Kristensen | APC by Schneider Electric | IT Business |
Denmark | Configuration Management Administrator
Phone: +45 72190143 | Mobile: +45 20752220
Email: allan(dot)kristensen(at)schneider-electric(dot)com | Site:
www.schneider-electric.dk | Address: Silcon Alle, 6000 Kolding, Denmark
*** Please consider the environment before printing this e-mail ***