Project

General

Profile

Bug #3028

postgresql installation and postgresql-openrc issue

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

Status:
confirmed
Priority:
bug
Assignee:
-
% Done:

0%

History

#1

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
[Trigger]
Type = File
Operation = Install
Operation = Upgrade
Target = usr/lib/sysusers.d/*.conf

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

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

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

#2

Updated by bill-auger almost 3 years ago

  • Description updated (diff)

bug 1: (opentmpfiles) is fixed in abslibre

#3

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
        file="${PGDATA%/}/${file}.conf" 
        if [ -f "${file}" ] ; then
            checkpath -f -m 0600 -o postgres:postgres "${file}" 
        else
            eerror "${file} not found" 
            eerror "HINT: mv ${DATA_DIR%/}/*.conf ${PGDATA}" 
            return 1                                                                                                   
        fi
    done

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