docs
docs copied to clipboard
WARNING: could not open statistics file "pg_stat_tmp/global.stat": Operation not permitted
There are at least three instances of this problem coming up:
What I found can be seen here
In brief, somehow files inside the container are being owned by root. While attached to the db container, I see this:
root@ec24992481d1:~# find /var/lib/postgresql -user 0 -exec ls -ld {} +
-rw------- 1 root root 8 Sep 9 00:34 /var/lib/postgresql/data/pg_logical/replorigin_checkpoint
-rw------- 1 root root 2225 Sep 9 01:17 /var/lib/postgresql/data/pg_stat_tmp/db_0.stat
-rw------- 1 root root 6665 Sep 9 01:17 /var/lib/postgresql/data/pg_stat_tmp/db_13757.stat
-rw------- 1 root root 7035 Sep 9 01:17 /var/lib/postgresql/data/pg_stat_tmp/db_16384.stat
-rw------- 1 root root 94 Sep 9 00:29 /var/lib/postgresql/data/postmaster.pid
I have done chown -R postgres:postgres /var/lib/postgresql
but later the Warnings start up again and when I attach to the db container, I see that more files are owned by root.
I'm assuming that this is not suppose to happen and also assuming that this is part of the problem. I tried adding ps
to the container but I still can't see the processes started by docker compose.
I found how to list all the processes. That looks normal:
% docker top 1b6f6f0741c9
UID PID PPID C STIME TTY TIME CMD
999 64394 64369 0 00:29 ? 00:00:00 postgres
999 64566 64394 0 00:29 ? 00:00:00 postgres: checkpointer
999 64567 64394 0 00:29 ? 00:00:00 postgres: background writer
999 64568 64394 0 00:29 ? 00:00:00 postgres: walwriter
999 64569 64394 0 00:29 ? 00:00:00 postgres: autovacuum launcher
999 64570 64394 0 00:29 ? 00:00:00 postgres: stats collector
999 64571 64394 0 00:29 ? 00:00:00 postgres: logical replication launcher
So, it now appears to be a Docker issue... ???
I am having similar issues, lots of permission errors or file not found. If you don't mount the data folder it works normally. There is something wrong with docker. What version of docker are you running?
Docker version 20.10.17, build 100c701
Almost the same: Docker version 20.10.17, build 100c70180f
Docker Desktop 4.2.0 running Docker Engine v20.10.10 should not have this issue
My guess is that this has something to do with the filesystem sharing implementation in Docker Desktop -- beyond that, I'm at a loss for helping debug (as this doesn't seem to be something particular to PostgreSQL but rather to the environment in which it's running or storing data).