Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jlegido opened this issue Jun 18, 2020 · 2 comments

Comments

@jlegido
Copy link

jlegido commented Jun 18, 2020

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
@sjoerdschouten
Copy link

I run into the same issue when upgrading from 10 to 12

@meizenga
Copy link

meizenga commented Jul 22, 2020

I run into the same issue when upgrading from 10 to 12

Same here, and I can confirm the file /var/lib/postgresql/10/data/PG_VERSION really exists:

image

`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/12/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 ... Etc/UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

Success. You can now start the database server using:

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

initdb: 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.

could not open version file "/var/lib/postgresql/10/data/PG_VERSION": No such file or directory
Failure, exiting`

Repository owner locked and limited conversation to collaborators Feb 25, 2022
@tianon tianon converted this issue into discussion #52 Feb 25, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants