Subject: post-bootstrap init : permission denied pg_description

From: François SIMON <[email-masked]>
Date: Thu, 12 Sep 2024 12:58:30 +0200 (CEST)

Hello All,

I am trying to install PostgreSQL 16.4 on AIX 7.1.

I get an error at initdb step :

performing post-bootstrap initialization ... 2024-09-12 12:09:07.075 CEST [14745748] FATAL:  permission denied for table pg_description

This version of PostgreSQL was build on this machine with
IBM XL C compiler 10.1 :

export OBJECT_MODE=64
$srcdir/configure --prefix=$instdir --without-icu
make
make install

When I run initdb with -n option, I can see that files in
PGDATA directory seem to have expected permissions.

I have tried to install PostgreSQL 15.1, 16.0 and 16.3
but got the same error with all these versions.

Any help would be appreciated.

François

---

From: Adrian Klaver <[email-masked]>
Date: Thu, 12 Sep 2024 08:20:59 -0700

> performing post-bootstrap initialization ... 2024-09-12 12:09:07.075 CEST [14745748] FATAL:  permission denied for table pg_description

That looks like an issue with the user you are running the command as.

What user is that?

What is the complete initdb command you used?

-- 
Adrian Klaver
[email-masked]

---

From: François SIMON <[email-masked]>
Date: Thu, 12 Sep 2024 18:03:47 +0200

> That looks like an issue with the user you are running the command as.

A normal user account.

> What is the complete initdb command you used?

I use no option.

PGDATA is set to a subdirectory of $HOME for this user.
$HOME is on a NFS volume.

# export PGDATA=$HOME/data
# initdb
The files belonging to this database system will be owned by user "fsi".      
This user must also own the server process.                                        
                                                                                   
The database cluster will be initialized with locale "C".                          
The default database encoding has accordingly been set to "SQL_ASCII".             
The default text search configuration will be set to "english".                    
                                                                                   
Data page checksums are disabled.                                                  
                                                                                   
creating directory /net/h10/home/fsi/data ... ok                    
creating subdirectories ... ok                                                     
selecting dynamic shared memory implementation ... posix                           
selecting default max_connections ... 100                                          
selecting default shared_buffers ... 128MB                                         
selecting default time zone ... Europe/Paris                                       
creating configuration files ... ok                                                
running bootstrap script ... ok                                                    

Thank you for your help.

François

---

From: Adrian Klaver <[email-masked]>
Date: Thu, 12 Sep 2024 09:52:57 -0700

> A normal user account.

Is that the account you did the make install as?

> $HOME is on a NFS volume.

Have you read this?:

https://www.postgresql.org/docs/16/creating-cluster.html#CREATING-CLUSTER-FILESYSTEM

> running bootstrap script ... ok

Can you add the complete portion of the output that threw the error?

---

From: François SIMON <[email-masked]>
Date: Thu, 12 Sep 2024 19:06:39 +0200

> > That looks like an issue with the user you are running the command as.

I think the environment is ok because it works with an initdb
built with gcc.

# ls -l /prod/postgresql
V16.3 -> V16.3-build_gcc
V16.3-build_gcc
V16.3-build_xlc

# initdb
Success. You can start the database...

# ln -sf V16.3-build_xlc /prod/postgresl/V16.3
V16.3 -> V16.3-build_xlc
V16.3-build_gcc
V16.3-build_xlc

# pg_ctl -l logfile start
server started

# psql -d template1
psql (16.3à
Type "help" for help.

template1=# \l
List of databases
Name
--------
postgres
template0
template1
...

So the problem seems to come from xlc, and only at initdb step.
I can see that initdb runs a backend postgres in single user mode.
And this is this backend, when compiled with xlc, that shows :
FATAL:  permission denied for table pg_description

François

---

From: Adrian Klaver <[email-masked]>
Date: Thu, 12 Sep 2024 10:15:56 -0700

> FATAL:  permission denied for table pg_description

Well this is going to need someone else to troubleshoot as it is out of 
my depth.

---

From: François SIMON <[email-masked]>
Date: Thu, 12 Sep 2024 19:20:53 +0200

> https://www.postgresql.org/docs/16/creating-cluster.html#CREATING-CLUSTER-FILESYSTEM

Yes. I understand NFS is OK, but yes I see some warnings.

# initdb

creating directory /net/h10/home/fsi/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Europe/Paris
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... 2024-09-12 17:38:35.580 CEST [9896122] FATAL:  permission denied for table pg_description
2024-09-12 17:38:35.580 CEST [9896122] STATEMENT:
        WITH funcdescs AS ( SELECT p.oid as p_oid, o.oid as o_oid, oprname FROM pg_proc p JOIN pg_operator o ON oprcode = p.oid ) INSERT INTO pg_description   SELECT p_oid, 'pg_proc'::regclass, 0,     'implementation of ' || oprname || ' operator'   FROM funcdescs   WHERE NOT EXISTS (SELECT 1 FROM pg_description    WHERE objoid = p_oid AND classoid = 'pg_proc'::regclass)   AND NOT EXISTS (SELECT 1 FROM pg_description    WHERE objoid = o_oid AND classoid = 'pg_operator'::regclass         AND description LIKE 'deprecated%');

child process exited with exit code 1
initdb: removing data directory "/net/h10/home/fsi/data"

François

---

From: Tom Lane <[email-masked]>
Date: Thu, 12 Sep 2024 13:38:11 -0400

> FATAL:  permission denied for table pg_description

Yeah.  This seems like it must be an xlc code-generation bug.
It's got nothing to do with filesystem permissions: you're failing
an ACL check at the logical "table" level, which you should not
be because single-user mode implies superuser permissions.

We do have one buildfarm member building with 64-bit xlc on
AIX 7.1:

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=hornet&dt=2024-09-11%2003%3A51%3A02

I see that that uses a bunch of odd CFLAGS, but they look like they
are mostly to suppress compiler warnings.  Another important bit of
the recipe for AIX is -D_LARGE_FILES=1, but I'm not sure that that
would have any impact during initdb (since we're not dealing with
any large files at that point).

You could perhaps try different -O optimization levels.  Also
make sure your xlc is up-to-date.

			regards, tom lane

---

From: François SIMON <[email-masked]>
Date: Fri, 13 Sep 2024 16:15:59 +0200

> make sure your xlc is up-to-date.

Thank you for all this information.

Unfortunately I haven't obtained any better results yet.

I tried -O2, -O3, with or without -D_LARGE_FILES=1, xlc_r instead
of xlc, and all the same flags as the buildfarm member.

I will try with another version of xlc if possible.

François