Bug #3028

postgresql installation and postgresql-openrc issue

0xddc - almost 3 years ago - . Updated almost 2 years ago.

% Done:




Updated by bill-auger almost 3 years ago

  • Status changed from unconfirmed to confirmed

i have identified 4 bugs with one of postgresql, postgresql-openrc, opentmpfiles, or opensysusers

bug 1: (opentmpfiles) patch is broken
this was my bad - i had multiple WIP versions of the 'chattr-ignore-nocow.patch' patch, and i used the wrong one

bug 2: (postgresql-openrc?) HINT: is wrong

$ sudo rc-service postgresql start
[sudo] pasvorto por bill:
 * /var/lib/postgres/data/postgresql.conf not found
 * HINT: mv /var/lib/postgres/data/*.conf /var/lib/postgres/data/
 * ERROR: postgresql failed to start

bug 3: (postgresql?) TODO: 'data' dir is not supposed to exist before running `initdb`

$ sudo ls /var/lib/postgres/data/

bug 4: (opensysusers?) PG user should have shell

$ sudo -iu postgres
This account is currently not available.

$ grep postgres /etc/passwd
postgres:x:968:968:PostgreSQL user:/var/lib/postgres:/sbin/nologin

$ cat /usr/share/libalpm/hooks/20-opensysusers.hook
Type = File
Operation = Install
Operation = Upgrade
Target = usr/lib/sysusers.d/*.conf

Description = Creating system user accounts...
When = PostTransaction
Exec = /usr/share/libalpm/scripts/sysusers-hook sysusers

$ pkgfile /usr/lib/sysusers.d/postgresql.conf

$ cat /usr/lib/sysusers.d/postgresql.conf
u postgres - "PostgreSQL user" /var/lib/postgres /bin/bash


Updated by bill-auger over 2 years ago

  • Description updated (diff)

bug 1: (opentmpfiles) is fixed in abslibre


Updated by Zuss almost 2 years ago

bug 2 + 3:
This is caused by the postgres init file and the code block is shown here:

    # Check for the existence of PostgreSQL's config files, and set the
    # proper mode and ownership.
    # Only three files should be checked as potentially other files
    # may be in PGDATA that should not be touched.
    local file
    for file in postgresql pg_hba pg_ident ; do
        if [ -f "${file}" ] ; then
            checkpath -f -m 0600 -o postgres:postgres "${file}" 
            eerror "${file} not found" 
            eerror "HINT: mv ${DATA_DIR%/}/*.conf ${PGDATA}" 
            return 1                                                                                                   

The problem is that the Arch package creates the /var/lib/postgres/data dir upon installation which is empty by default and will always lead to this case being executed until you run the initdb command.
Perhaps we can add on the same hint line something like "or make sure you have run initdb"

bug 4:

This looks to be fixed in v14.3. The postgres user has shell access

$ grep postgres /etc/passwd
postgres:x:958:958:PostgreSQL user:/var/lib/postgres:/bin/bash

Also available in: Atom PDF