Thread: Re: RHEL7 pgbouncer package /run/pgbouncer rights glitch after reboot

Re: RHEL7 pgbouncer package /run/pgbouncer rights glitch after reboot

From
Laurent Wandrebeck
Date:
Laurent Wandrebeck <l.wandrebeck@quelquesmots.fr> a écrit :

> Hi,
>
> I’d like to report a small problem with latest pgbouncer package
> (1.5.5-1.rhel7).
>
> /var/run being tmpfs, /var/log/pgbouncer becomes root:root after a
> reboot, thus pgbouncer fails to start, being unable to write its pid
> file.
>
> I’ve done a quick search to find where to change it at boot, and I
> stumbled upon prosody package, whose /run/prosody is ok.
>
> The package contains:
> # cat /usr/lib/tmpfiles.d/prosody.conf
> d /run/prosody 755 prosody prosody
>
> Hope it helps for 1.5.5-2.rhel7 :)
>
> Keep up the good work,
>
> Best,
> Laurent.

Replying to myself after willing to fix it there…

There’s already a /usr/lib/tmpfile.d/pgbouncer.conf
but it’s content is a bit borked, /var/run/pgbouncer/pqbouncer (yes, twice).
There we have the culprit :)

Laurent.


Re: RHEL7 pgbouncer package /run/pgbouncer rights glitch after reboot

From
Jeff Frost
Date:

On May 14, 2015, at 2:42 AM, Laurent Wandrebeck <l.wandrebeck@quelquesmots.fr> wrote:


Laurent Wandrebeck <l.wandrebeck@quelquesmots.fr> a écrit :

Hi,

I’d like to report a small problem with latest pgbouncer package(1.5.5-1.rhel7).

/var/run being tmpfs, /var/log/pgbouncer becomes root:root after a
reboot, thus pgbouncer fails to start, being unable to write its pid
file.

I’ve done a quick search to find where to change it at boot, and I
stumbled upon prosody package, whose /run/prosody is ok.

The package contains:
# cat /usr/lib/tmpfiles.d/prosody.conf
d /run/prosody 755 prosody prosody

Hope it helps for 1.5.5-2.rhel7 :)

Keep up the good work,

Best,
Laurent.

Replying to myself after willing to fix it there…

There’s already a /usr/lib/tmpfile.d/pgbouncer.conf
but it’s content is a bit borked, /var/run/pgbouncer/pqbouncer (yes, twice).
There we have the culprit :)

Looks like that’s this bit here in the spec file:

%global _varrundir %{_localstatedir}/run/%{name}

<SNIP>

# ... and make a tmpfiles script to recreate it at reboot.
%{__mkdir} -p %{buildroot}%{_tmpfilesdir}
cat > %{buildroot}%{_tmpfilesdir}/%{name}.conf <<EOF
d %{_varrundir}/pgbouncer 0700 pgbouncer pgbouncer -
EOF

I’m thinking the intent would be this:

d %{_varrundir} 0700 pgbouncer pgbouncer -

but just want Devrim to have a chance to comment.

Re: RHEL7 pgbouncer package /run/pgbouncer rights glitch after reboot

From
Jeff Frost
Date:

On May 30, 2015, at 1:22 AM, Laurent Wandrebeck <l.wandrebeck@quelquesmots.fr> wrote:



Le lun. 18 mai 2015 à 18:52, Jeff Frost <jeff@pgexperts.com> a écrit :

Looks like that’s this bit here in the spec file:

%global _varrundir %{_localstatedir}/run/%{name}

<SNIP>

# ... and make a tmpfiles script to recreate it at reboot.
%{__mkdir} -p %{buildroot}%{_tmpfilesdir}
cat > %{buildroot}%{_tmpfilesdir}/%{name}.conf <<EOF
d %{_varrundir}/pgbouncer 0700 pgbouncer pgbouncer -
EOF

I’m thinking the intent would be this:

d %{_varrundir} 0700 pgbouncer pgbouncer -

but just want Devrim to have a chance to comment.

Hi Jeff !

I agree with you here :) So just wanted to up that subject a bit. Haven’t heard of Devrim, nor git tree seems to have a fix on that point.

Keep up the good work,
Laurent.


Sorry for the slow reply, but I’ve been on vacation.

I just cut a branch jf/fix_pgbouncer_varrundir to fix this.

Will probably get that merged the next time we build these.

Re: RHEL7 pgbouncer package /run/pgbouncer rights glitch after reboot

From
Laurent Wandrebeck
Date:
Le 02/06/2015 01:47, Jeff Frost a écrit :


Sorry for the slow reply, but I’ve been on vacation.

I just cut a branch jf/fix_pgbouncer_varrundir to fix this.

Will probably get that merged the next time we build these.

np Jeff :)
Thanks for the branch.
Another point noticed since PG 9.4.2 and both its /tmp and /var/run sockets.
Shouldn’t pgbouncer definitely switch under postgres user and use /var/run too ?
I’ve had some glitches restarting pgbouncer after 9.4.2 updates.
My config here:
pg and pgbouncer use each other port (pg runs on 6432, pgb on 5432 for some apps not allowing to change port used).
I’ve switched pgbouncer under postgres user and put its socket file into /var/run/postgresql.
That’s imho definitely the simplest way to manage the change to /var/run as indicated in changelog:

* Fri May 22 2015 Devrim Gündüz <devrim@gunduz.org> - 9.4.2-2PGDG
- Create and own /var/run/postgresql directory. Per report from
  Pete Deffendol.

* Wed May 20 2015 Devrim Gündüz <devrim@gunduz.org> - 9.4.2-1PGDG
- Update to 9.4.2, per changes described at:
  http://www.postgresql.org/docs/9.4/static/release-9-4-2.html
- Add a new patch (Patch5) from Fedora:
  * Configure postmaster to create sockets in both /var/run/postgresql and /tmp;
    the former is now the default place for libpq to contact the postmaster.
- Add tmpfiles.d conf file

If you see any other (better) way to workaround these changes, that’s ok with me, provided it does not mess too much with running configs ;)

Thanks,
-- 
Laurent

Re: RHEL7 pgbouncer package /run/pgbouncer rights glitch after reboot

From
Jeff Frost
Date:

On Jun 2, 2015, at 1:28 AM, Laurent Wandrebeck <l.wandrebeck@quelquesmots.fr> wrote:

Le 02/06/2015 01:47, Jeff Frost a écrit :


Sorry for the slow reply, but I’ve been on vacation.

I just cut a branch jf/fix_pgbouncer_varrundir to fix this.

Will probably get that merged the next time we build these.

np Jeff :)
Thanks for the branch.
Another point noticed since PG 9.4.2 and both its /tmp and /var/run sockets.
Shouldn’t pgbouncer definitely switch under postgres user and use /var/run too ?
I’ve had some glitches restarting pgbouncer after 9.4.2 updates.
My config here:
pg and pgbouncer use each other port (pg runs on 6432, pgb on 5432 for some apps not allowing to change port used).
I’ve switched pgbouncer under postgres user and put its socket file into /var/run/postgresql.
That’s imho definitely the simplest way to manage the change to /var/run as indicated in changelog:

* Fri May 22 2015 Devrim Gündüz <devrim@gunduz.org> - 9.4.2-2PGDG
- Create and own /var/run/postgresql directory. Per report from
  Pete Deffendol.

* Wed May 20 2015 Devrim Gündüz <devrim@gunduz.org> - 9.4.2-1PGDG
- Update to 9.4.2, per changes described at:
  http://www.postgresql.org/docs/9.4/static/release-9-4-2.html
- Add a new patch (Patch5) from Fedora:
  * Configure postmaster to create sockets in both /var/run/postgresql and /tmp;
    the former is now the default place for libpq to contact the postmaster.
- Add tmpfiles.d conf file

If you see any other (better) way to workaround these changes, that’s ok with me, provided it does not mess too much with running configs ;)

Oh, so you’re suggesting that pgbouncer use both socket directories as well?

That would require a pgbouncer patch to support multiple socket locations.



Re: RHEL7 pgbouncer package /run/pgbouncer rights glitch after reboot

From
Laurent Wandrebeck
Date:
Le 2 juin 2015 22:28, Jeff Frost <jeff@pgexperts.com> a écrit :
>
>
> Oh, so you’re suggesting that pgbouncer use both socket directories as well?
>
> That would require a pgbouncer patch to support multiple socket locations.
>

Actually, I'm not :) I just copied changelog linked to that /var/run stuff, sorry it puzzled you.

Just suggested:
- Postgres user for both.
- /var/run/postgresql for sockets.

Do you think it could bring problems ? (ie apps using hardcoded path to find pg socket ?)
According to pgbouncer config file, it looks like debian uses /var/run/postgresql for a while, so I hope my proposal
doesn'tland in nonsense territory :) 

Laurent

Re: RHEL7 pgbouncer package /run/pgbouncer rights glitch after reboot

From
Jeff Frost
Date:
> On Jun 2, 2015, at 10:33 PM, Laurent Wandrebeck <l.wandrebeck@quelquesmots.fr> wrote:
>
>
> Le 2 juin 2015 22:28, Jeff Frost <jeff@pgexperts.com> a écrit :
>>
>>
>> Oh, so you’re suggesting that pgbouncer use both socket directories as well?
>>
>> That would require a pgbouncer patch to support multiple socket locations.
>>
>
> Actually, I'm not :) I just copied changelog linked to that /var/run stuff, sorry it puzzled you.
>
> Just suggested:
> - Postgres user for both.
> - /var/run/postgresql for sockets.
>
> Do you think it could bring problems ? (ie apps using hardcoded path to find pg socket ?)
> According to pgbouncer config file, it looks like debian uses /var/run/postgresql for a while, so I hope my proposal
doesn'tland in nonsense territory :) 

It’s not necessarily nonsense, but it’s likely to break quite a few existing apps that expect it in /tmp.  If we
decidedto go this way, we would probably only do it on new distros. 

Re: RHEL7 pgbouncer package /run/pgbouncer rights glitch after reboot

From
Laurent Wandrebeck
Date:


Le lun. 18 mai 2015 à 18:52, Jeff Frost <jeff@pgexperts.com> a écrit :

Looks like that’s this bit here in the spec file:

%global _varrundir %{_localstatedir}/run/%{name}

<SNIP>

# ... and make a tmpfiles script to recreate it at reboot.
%{__mkdir} -p %{buildroot}%{_tmpfilesdir}
cat > %{buildroot}%{_tmpfilesdir}/%{name}.conf <<EOF
d %{_varrundir}/pgbouncer 0700 pgbouncer pgbouncer -
EOF

I’m thinking the intent would be this:

d %{_varrundir} 0700 pgbouncer pgbouncer -

but just want Devrim to have a chance to comment.

Hi Jeff !

I agree with you here :) So just wanted to up that subject a bit. Haven’t heard of Devrim, nor git tree seems to have a fix on that point.

Keep up the good work,
Laurent.