Skip to content

check for "/var/lib/postgresql/9.4/data/base" failed: No such file or directory #29

@jlegido

Description

@jlegido

Hi there.

First of all many thanks to all the people involved in this project for their time.

I'm trying to follow the provided example in the README, and I get an error.

Steps to reproduce

mkdir -p postgres-upgrade-testing

cd postgres-upgrade-testing

OLD='9.4'
NEW='9.5'

docker pull "postgres:$OLD"

docker run -dit \
  --name postgres-upgrade-testing \
  -v "$PWD/$OLD/data":/var/lib/postgresql/data \
  "postgres:$OLD"

sleep 5 

docker logs --tail 100 postgres-upgrade-testing

docker exec -it \
  -u postgres \
  postgres-upgrade-testing \
  pgbench -i -s 10

docker stop postgres-upgrade-testing

docker rm postgres-upgrade-testing

docker run --rm \
 -v "$PWD":/var/lib/postgresql \
 "tianon/postgres-upgrade:$OLD-to-$NEW" \
 --link

Expected behaviour

See a success message in the standard out

Found behaviour

The process stopped with an error message:

The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/lib/postgresql/9.5/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Etc/UTC
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
creating template1 database in /var/lib/postgresql/9.5/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok

Success. You can now start the database server using:

    pg_ctl -D /var/lib/postgresql/9.5/data -l logfile start


WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

check for "/var/lib/postgresql/9.4/data/base" failed: No such file or directory

Failure, exiting

Error message

check for "/var/lib/postgresql/9.4/data/base" failed: No such file or directory

Failure, exiting

Additional information

  • Operating system: GNU/Linux debian Debian GNU/Linux bullseye/sid \n \l
  • Docker version: 19.03.8, build afacb8b7f0

I'm almost sure that the root cause of the issue is the owner of the docker host directories.

The start of the workaround will require re-building a custom image with something like below:

ARG GNAME='groupname'
ARG GID=123
ARG USERID=113

# fix permissions so it can persist data on the host nfs file system
RUN groupadd -g $GID $GNAME \
 && usermod -g $GNAME postgres \
 && usermod -u $USERID postgres

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions