Subject: PGDG packaged RepMgr v5.2.1 does not create necessary directories

From: Greg Clough <[email-masked]>
Date: Mon, 18 Jan 2021 17:27:00 +0000

Hi,

When I install RepMgr v5.2.1 for PostgreSQL v13.1 on CentOS v7.9.2009
using the PGDG repo, the following /run/repmgr and /var/run/repmgr
directories are missing, which prevents RepMgr from starting:

[root@localhost ~]# yum install -y
https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
Loaded plugins: fastestmirror, langpacks
pgdg-redhat-repo-latest.noarch.rpm                       | 6.8 kB     00:00
...
[root@localhost ~]# yum install postgresql13-server repmgr13
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
...
Installed:
  postgresql13-server.x86_64 0:13.1-3PGDG.rhel7
                                          repmgr_13.x86_64
0:5.2.1-1.rhel7

Dependency Installed:
  postgresql13.x86_64 0:13.1-3PGDG.rhel7
                                 postgresql13-libs.x86_64
0:13.1-3PGDG.rhel7

Complete!

[root@localhost ~]# ls -ald /run/repmgr /var/run/repmgr
ls: cannot access /run/repmgr: No such file or directory
ls: cannot access /var/run/repmgr: No such file or directory

If I install the 2ndQuadrant repo, then it works fine:

[root@localhost ~]# curl
https://dl.2ndquadrant.com/default/release/get/13/rpm | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  5375  100  5375    0     0  11245      0 --:--:-- --:--:-- --:--:-- 11244

Installation finished: 2ndquadrant.com RPM repository
dl/default/release for PG13

[root@localhost ~]# yum install postgresql13-server repmgr13
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.melbourne.co.uk
 * extras: mirror.as29550.net
 * updates: mirror.as29550.net
Resolving Dependencies
--> Running transaction check
---> Package postgresql13-server.x86_64 0:13.1-3PGDG.rhel7 will be installed
--> Processing Dependency: postgresql13-libs(x86-64) =
13.1-3PGDG.rhel7 for package:
postgresql13-server-13.1-3PGDG.rhel7.x86_64
--> Processing Dependency: postgresql13(x86-64) = 13.1-3PGDG.rhel7 for
package: postgresql13-server-13.1-3PGDG.rhel7.x86_64
--> Processing Dependency: libpq.so.5()(64bit) for package:
postgresql13-server-13.1-3PGDG.rhel7.x86_64
---> Package repmgr13.x86_64 0:5.2.1-1.el7 will be installed
--> Running transaction check
---> Package postgresql13.x86_64 0:13.1-3PGDG.rhel7 will be installed
---> Package postgresql13-libs.x86_64 0:13.1-3PGDG.rhel7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================================================================================================================================
 Package                                            Arch
                   Version
Repository
Size
===================================================================================================================================================================================================================
Installing:
 postgresql13-server                                x86_64
                   13.1-3PGDG.rhel7
pgdg13                                                             5.4
M
 repmgr13                                           x86_64
                   5.2.1-1.el7
2ndquadrant-dl-default-release-pg13                                269
k
Installing for dependencies:
 postgresql13                                       x86_64
                   13.1-3PGDG.rhel7
pgdg13                                                             1.4
M
 postgresql13-libs                                  x86_64
                   13.1-3PGDG.rhel7
pgdg13                                                             379
k

Transaction Summary
===================================================================================================================================================================================================================
Install  2 Packages (+2 Dependent packages)

Total download size: 7.4 M
Installed size: 31 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): postgresql13-libs-13.1-3PGDG.rhel7.x86_64.rpm

                                              | 379 kB  00:00:01
(2/4): postgresql13-13.1-3PGDG.rhel7.x86_64.rpm

                                              | 1.4 MB  00:00:01
warning: /var/cache/yum/x86_64/7/2ndquadrant-dl-default-release-pg13/packages/repmgr13-5.2.1-1.el7.x86_64.rpm:
Header V4 RSA/SHA1 Signature, key ID d6baf0c3: NOKEY
Public key for repmgr13-5.2.1-1.el7.x86_64.rpm is not installed
(3/4): repmgr13-5.2.1-1.el7.x86_64.rpm

                                              | 269 kB  00:00:00
(4/4): postgresql13-server-13.1-3PGDG.rhel7.x86_64.rpm

                                              | 5.4 MB  00:00:01
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total

                                     2.7 MB/s | 7.4 MB  00:00:02
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-2NDQ-DL-DEFAULT
Importing GPG key 0xD6BAF0C3:
 Userid     : "Public repository signing key 2ndQuadrant <[email-masked]>"
 Fingerprint: 8565 305c ea7d 0b66 4933 d250 9904 cd4b d6ba f0c3
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-2NDQ-DL-DEFAULT
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : postgresql13-libs-13.1-3PGDG.rhel7.x86_64

                                                                 1/4
  Installing : postgresql13-13.1-3PGDG.rhel7.x86_64

                                                                 2/4
  Installing : postgresql13-server-13.1-3PGDG.rhel7.x86_64

                                                                 3/4
  Installing : repmgr13-5.2.1-1.el7.x86_64

                                                                 4/4
  Verifying  : postgresql13-libs-13.1-3PGDG.rhel7.x86_64

                                                                 1/4
  Verifying  : repmgr13-5.2.1-1.el7.x86_64

                                                                 2/4
  Verifying  : postgresql13-server-13.1-3PGDG.rhel7.x86_64

                                                                 3/4
  Verifying  : postgresql13-13.1-3PGDG.rhel7.x86_64

                                                                 4/4

Installed:
  postgresql13-server.x86_64 0:13.1-3PGDG.rhel7
                                            repmgr13.x86_64
0:5.2.1-1.el7

Dependency Installed:
  postgresql13.x86_64 0:13.1-3PGDG.rhel7
                                 postgresql13-libs.x86_64
0:13.1-3PGDG.rhel7

Complete!
[root@localhost ~]# ls -ald /run/repmgr /var/run/repmgr
drwxr-xr-x. 2 postgres postgres 40 Jan 18 16:53 /run/repmgr
drwxr-xr-x. 2 postgres postgres 40 Jan 18 16:53 /var/run/repmgr

Unless I'm barking up the wrong tree and have made a rookie error,
could you please update the PGDG YUM package to include these two
directories with the correct ownership and permissions?

Thanks.
Greg.

---

From: Devrim Gündüz <[email-masked]>
Date: Thu, 21 Jan 2021 21:42:50 +0000

Hi Greg,

> ls: cannot access /var/run/repmgr: No such file or directory

systemd will create these directories. See:

 /usr/lib/tmpfiles.d/repmgr_13.conf

What error are you getting?

Cheers,
-- 
Devrim Gündüz
Open Source Solution Architect, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

---

From: Greg Clough <[email-masked]>
Date: Thu, 21 Jan 2021 22:30:57 +0000

Hi Devrim,

When repmgr tried to start, it failed because those directories don't
exist.  I cleaned it up with a fresh OS install and tried the 2ndQuadrant
repo packages... and these made the directories during the "yum install".

I didn't think repmgr was SUID root (but I didn't check), so it can't mkdir
in /run during startup, right?

Maybe I've screwed something up here, so I'll do some more basic testing,
and send you the output.

Thanks,
Greg.

---

From: Devrim Gündüz <[email-masked]>
Date: Fri, 22 Jan 2021 00:52:46 +0000

Hi Greg,

> repo packages... and these made the directories during the "yum

Failing to reproduce this here on CentOS 7 (and Fedora 33) :-( 
However, noticed that I create similar directory for PostgreSQL
already. 

Pushed a new set of RPMs to testing repo. To use them, please run:

yum --enablerepo pgdg13-updates-testing install repmgr_13

Can you please see if this works?

Cheers,